Advanced Entities Scripts

Advanced Entities Scripts

Made by Wes and Annac0ndaa

Showcase Link - Crayta https://launch.crayta.com/play/fzbjyckm

Itch Submission Link - Advanced Entities Scripts by Wes1991 for Crayta $50,000 Build Jam - 'Science Fair' - itch.io

This package includes scripts that will allow you to bring crayta entities to life with no code. Using script properties you are able to chain states of entities together, and even transition the states over time!
At the core, this package is just 4 scripts, 1 for each entity type that is supported; Shapes, Sounds, Lights, Effects.

This forum post mostly covers the details in setting up and using the scripts, if you want to see more and learn about what the scripts can do for your games, you should play through the showcase first, the showcase includes a guided tour for some examples of the package capabilities.

The scripts replicate the properties of the entities, you can attach more than 1 copy of each script to store different states of the entity.

image
In this image, we have 3 duplicate shape scripts, “1default” is the starting state, “2pulseSmall” changes the color randomly and goes smaller, “3pulseBig” also changes color but scales big.

Videos

Layering multiple effects and sounds, and a shape and a light, we can create truly unique effects. Beam me up, Scotty!

A cube transitioning color and size to invert.

Click here to view more video examples

Click the headings below to read more;

Standard Properties

All scripts have some standard properties that are used to transition, trigger, and delay events.
Here’s an example of the standard properties on the AdvancedShapesScript;

  • Start On Init
    Each script is a link in a chain of states, for events that do not have any trigger event (such as onInteract or onTriggerEnter) then you need to start the chain somewhere - you should only have 1 startOnInit for each entity.
  • Start Delay
    This is min/max values in seconds. To trigger the change instantly, set the values to 0/0.
    Having 1/2 would randomize the startDelay between 1 and 2 seconds.
  • Transition Over Delay
    When the max start delay is set above 0 a tickbox appears to allow transitioning of the properties over the startDelay time. Not all properties can be transitioned (such as assets or tickboxes) - those get triggered at the end of the delay.
  • On Trigger
    This event property will be triggered after the Start Delay, this can be linked to another advanced entity script to trigger that state. For example, the shapes in the Gravity Pit in the Showcase are 2 scripts set to trigger each other in a loop to produce a pulsing effect.
  • Delay Trigger Event Time
    This delays the above event, can be used to hold the state like this after the transition.
Entity and Asset Properties

When you look at the scripts, you will notice there are quite a few non-standard properties, however these are just the properties of the entity. You use a copy of each script to store the settings and trigger them in-game using events like On Interact, On Collision, etc.

Advanced Shapes Script

image

Advanced Lights Script

image

Advanced Sounds Script

image

Advanced Effects Script

How to setup

Installation

  1. Search for “Advanced Entities Scripts” on the community tab of the Crayta Editor
  2. Find the package and click install

Basic Setup

  1. Place a supported entity (sound, shape, effect, light) in your world
    image

  2. Right click the entity and create child script folder
    image

  3. Optional, but I like to label the folder for what kind of state this is, the first state is your starting “default” state.

  4. Right click on the folder and add the “advancedEntityScript” for your entity.

  5. Start On Init will make this script apply on server start, so for the default state, we want to tick this.

  6. You can configure the other settings to your liking, as mentioned before - all other properties are replicated from the entity itself, then when you’re ready you can preview to see the default state take effect.

Advanced Setup - Setting up a loop

To create a loop we need 2 copies of the same script attached to the entity, both scripts trigger each other, and only the default state is set to StartOnInit.

  1. Right click on the default state folder and duplicate
    image

  2. Label the folder, and untick StartOnInit. You can set a delay and if the properties should transition.

  3. Drag the default folder onto the ‘+’ next to OnTrigger and drop.

  4. Click on the text “Unset Binding” to expand the event, and click the empty drop down and set it to “Trigger()”
    image

  5. Now you can set the other properties that will change the entity when this script is triggered.

  6. To trigger that script, we need also drag the script to the OnTrigger property on the default folder.

Now when you preview the entity will be cycling between 2 states, the default state and the 2nd one you set up!

Quick 2 minute basic setup guide:

3 Likes

Change log

27/10/22

Lights, Effects, Shapes -

  1. Fixed random color not working for instant trigger scripts

Lights -

  1. Updated property set to fully support all light types (point, spot, direction, rectangle)