Scanner [Science Fair Build Jam]

Scanner v1.1

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

How to install:

Search for the scanner in the community tab:
image

  1. Drop one “ScannerFX” template anywhere in your world.

  2. Attach the “ScannerUser” template to your user template.

  3. Attach a “ScannerObjectScript” to any mesh or shape in order to make it scannable.

  4. 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.

How to configure the user script:

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:
image

Other than that, all the options here can be left by default.

How to configure the object script:

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:
CraytaClient-Win64-Shipping_TVKuEmqETf

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:
image

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:
image

How to use the ScannerObjectScript:

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.
image

Suggestions:

  • 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:

To-do:

  • More action types performable on scanned entities.
  • Better graphics for the scan interface, with animated backgrounds and windows.
2 Likes

v1.1 update:

  • now you can choose if you want action sounds to be played server side for everyone to hear or if you want the sound to be played client side for only the player who performs the action. Useful for when you want the action to be private, like for example a sound for adding a new entry to a journal, or a machine giving the player money.
  • new script: ScannerReferralScript. 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, giving the same information, and containing the same cooldown data etc…