Return Value Events

  • Some Components will have a 'Return Value Event' so that other components/MBScript can return a Value when a event happens.
770

The 'Health System Damage Modifer' component has a 'Ignore Damage' return value event. This script returns 'True' if the damage is less than 10.

This script can also modify the damage done - setting it to 10 if the damage is from a Toy

  • Code running inside a 'Return Value Event' can't change values on the Entity or World, or do operations. The reason for this is so the Return Value can be run at any time (like on hovering over the variable or viewing it in Entity Properties) and not have unexpected side effects.

  • ReturnValue Events always run Locally for Players - rather than running just on the server by default like normal MBScript events.

  • Multiple Event lines can be added with the same 'Return Value' variable. The first 'ReturnValue' line will set the value (the order of event lines can be set with MBScript Attributes )

Creating Return Value Event

Use ‘ReturnValue>x’, to create an Event that returns a value. This can also have parameters (if ReturnEvent(y)>x is selected).

447

The 'Can Pickup Weapon' is a ReturnValue event. Here 'Can Pickup Weapon' is True if the entity has a Health System.
The HealthSystem is shown as greyed out, since this Entity doesnt have it yet.

787

A 'Get Move Speed For Player' ReturnValue variable is added, with a parameter type of 'Player'. This sets it's Movement Speed to '30' only if it's on the Enemy team - otherwise it'll have it's default value of 100.

Another script could also then add a Event line to return a value.