Skip to content
Guy Allard edited this page Feb 15, 2015 · 5 revisions

ScriptedBehavior Scripted behavior leaf node

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:

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

  2. onEnter - This is called the first time the behavior is run if the precondition was successful. onEnter does not use a return value.

  3. onExit - This is called when the behavior reaches completion. onExit does not use a return value.

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

Clone this wiki locally