I wanted to make a scanner package ever since I player Cyberpunk 2077 and the science fair jam was the perfect opportunity ! It enables the player to scan the objects and NPCs of your world and get more information about them. It also allows the player to act on those objects by moving them, destroying or hiding them and much more!
Advanced users can also take advantage of the events that can be set and broadcast to all the scripts attached to the entity on which the action is performed.
Try the remixable showcase game: Crayta
Search for the scanner in the community tab:
Drop one “ScannerFX” template anywhere in your world.
Attach the “ScannerUser” template to your user template.
Attach a “ScannerObjectScript” to any mesh or shape in order to make it scannable.
Since v1.1, the “ScannerReferralScript” can be attached to an object and a referral property can be filled so that the scanner will display the data from another object to which the “ScannerObjectScript” has been attached.
All the options are self-explanatory and the tooltips provide more information if you need it. You may need to reselect the ScannerFX if it is missing at the bottom of the user script properties:
Other than that, all the options here can be left by default.
In this example, the ScannerObjectScript has been attached to the largeAnimalSkull mesh. What is needed at the minimum is a name and description so that the scanner widget will be able to provide that information to your player. You can notice that no action has been selected, which means that the player won’t be able to act on the animal skull entity in any way.
Let’s see another example:
In this example, the Destroy action has been selected, which will simply destroy the entity from the game. You can notice that some more options have appeared. You can customize the prompt that the player will see and the sound that will be played when the action is performed, as well as the range of that sound.
Let’s see one more example:
In this example, the action has been set to Rotate, which will make the entity… rotate. Notice that a new option has appeared: the action cooldown, which will grey out the action prompt until the cooldown is off. You can specify if the rotation is going to be relative to the parent or to the center of the world. You can choose to either rotate the entity instantly or over time. You can also set a return time if you want the entity to rotate back to its original state after a set number of seconds. If you don’t want the entity to return to a previous state, just leave the RotateReturnTimer to zero.
One more example:
In this last example, the entity is an NPC and the action has been set to Custom, which means that advanced users have the possibility to broadcast a server event to all the scripts attached to that entity so that custom behavior can be set. Pretty useful to create all kinds of effects.
And in general, all actions performed can broadcast a client and server event to all the script attached to the entity on which the action is performed, with this property field:
One last example:
In this last example, the action type has been set to PlayAnimation. This gives the possibility to play animations of any mesh that contains animations. Here the example is a door: the animation is set to “opening” which will open the door. PlayAnimationRepeatable is set to true so that when the cooldown is off, the action can be performed again, otherwise the action will be performable only once. HasSecondAnimation allows you to set a second animation and a timer between the 2 animations. In this example, the door will open, then close 4 seconds later.
Here is the current list of available actions for the v1.0:
Attach this script to an object, then select the entity to which it should refer to, and every time the object will be scanned, the scanner will actually read the data on the referral object. Example: you have built a template with many different meshes and shapes, like a giant robot. You would want the scanner to scan the whole template as if it was only one gameplay entity, displaying the same information regardless of the mesh or shape that is actually being scanned, and containing the same cooldown data etc…
The script contains only one script property, and it should point to the entity to which a ScannerObjectScript has been attached.
- The scanner would integrate well into any sci-fi game/experience.
- A game where the players have to gather information about the objects in their environment and the NPCs.
- A game where players have to move, rotate or scale any number of meshes or shapes in order to solve puzzles.
- The custom events that can be broadcast with each action basically means that the possibilities are endless and very complex mechanics can be built.
Some more customization
Some more customization is possible:
You can customize the green scanner frame by changing the option as shown here:
These 2 properties on the user script allow you to dramatically change how the scanner interface will look:
- More action types performable on scanned entities.
- Better graphics for the scan interface, with animated backgrounds and windows.