-
Notifications
You must be signed in to change notification settings - Fork 8
ScriptedBehavior
Description:
The ScriptedBehavior leaf node allows for a structured behavior task to be defined in a script file.
ScriptedBehavior tasks can be composed of up to four parts:
-
precondition- This function should return a boolean indicating whether or not the behavior should continue. If precondition returns true, the rest of the behavior is evaluated. If precondition returns false, the behavior will abort.
-
onEnter - This is called the first time the behavior is run if the precondition was successful. onEnter does not use a return value.
-
onExit - This is called when the behavior reaches completion. onExit does not use a return value.
-
behavior - This is the main behavior function, evaluated each tick.
behavior must return a status (SUCCESS / FAILURE / RUNNING).
Parameters:
- preconditionMode
- ONCE - The precondition function is evaluated the first time the behavior is run
- TICK - The precondition function is evaluated every time the behavior is ticked
Examples
see scripts/server/BadBehavior/BadBot.cs for a selection of ScriptedBehavior task definitions.