Skip to main content

Custom Scripts

Custom Scripts allow you to create reusable procedures in your game that can be called from any of your scripts.

Your Custom Scripts will be listed in the Scripts section of the Navigator while on the Game World View.

Click the + button to create a new Custom Script or select one to edit from the list.

Once you've given your Custom Script a name you can start building a script in the same way you would for Actors, Triggers and Scenes.

Parameters

Whenever you add an event that reads a Variable it will get added to the list of input parameters for the Custom Script, where you are able to give that input a memorable name. Events that affect Actors will, by default, apply to the player but if you use the actor selector you will be able to set the event to read the Actor value from an input parameter also.

For example the following custom script makes Actor A rotate in a circle.

Passing by Reference or Value

When using variables in a custom script you have the choice to pass by reference (By Ref) or to pass by value (By Val) by clicking the drop down button next to each variable in the parameters list.

  • Pass By Reference Allows the custom script to modify the value of a variable parameter. Any changes to the variable's value from inside the script will also update the variable's value outside of the script. Use this if you want the custom script to be able to change the value of a variable that was passed in.

  • Pass By Value Copies the current value of the variable at call time so that any changes to the variable parameter from within the script will not affect the variable that was passed in. Use this if you want the custom script to NOT be able to change the variable that was passed in.

Calling a Custom Script

Once you have created a Custom Script you can call it from any other script by adding a Call Script event which will appear as follows.

You first must choose the script which you wish to call, if that script has any variable or actor parameters you can then choose which inputs to use.

If you ever want to edit the Custom Script you can return to it using the list on the Navigator or by selecting Edit Custom Script from the event dropdown menu.