This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| dragengine:modules:dragonscript:behavior_statemachine [2026/10/12 17:57] – [element.set] dragonlord | dragengine:modules:dragonscript:behavior_statemachine [2026/11/18 16:37] (current) – dragonlord | ||
|---|---|---|---|
| Line 68: | Line 68: | ||
| This behavior adds these state machine actions. | This behavior adds these state machine actions. | ||
| + | |||
| + | ===== self ===== | ||
| + | |||
| + | Set state machine parameters. | ||
| + | |||
| + | ^Parameter^Value^Description^ | ||
| + | |debug.name|string|Set logging name. This name is prepended to logs if enabled.| | ||
| + | |debug.targets|list|List of whitespace separated targets to log. Valid targets: '' | ||
| + | |||
| + | This is an example of using this action to fully hide the owner element: | ||
| + | <code xml> | ||
| + | <action name=' | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| ===== element.set ===== | ===== element.set ===== | ||
| Line 84: | Line 100: | ||
| </ | </ | ||
| </ | </ | ||
| - | |||
| ===== element.update ===== | ===== element.update ===== | ||
| Line 121: | Line 136: | ||
| ^Parameter^Value^Description^ | ^Parameter^Value^Description^ | ||
| + | |interactElement.assign|string|Assign event element to [[behavior_interactelement|ECBehaviorInteractElement]] with identifier matching value string.| | ||
| + | |interact|string|Run interaction with name value on event element.| | ||
| + | |interact.parameters|string|Optional parameters to use with '' | ||
| |runEvent|string|Run named event on all ECBehaviorStateMachine instance of event element with the state machine element as event parameter.| | |runEvent|string|Run named event on all ECBehaviorStateMachine instance of event element with the state machine element as event parameter.| | ||
| Line 137: | Line 155: | ||
| |action|string|Name of action to run.| | |action|string|Name of action to run.| | ||
| |receiveEvents|'' | |receiveEvents|'' | ||
| + | |runEvent|string|Run event on all state machines of element set to receive game world events. The state machine owner is set as event parameter.| | ||
| This is an example of using this action to spawn a new element: | This is an example of using this action to spawn a new element: | ||
| Line 145: | Line 164: | ||
| < | < | ||
| < | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | This is an example of using this action to run event on [[appbehavior_behaviorstatemachine|application state machines]]: | ||
| + | <code xml> | ||
| + | <action name=' | ||
| + | < | ||
| + | < | ||
| </ | </ | ||
| </ | </ | ||
| Line 182: | Line 209: | ||
| |eventElement.flags.set|string|Event element has [[behavior_flags|ECBehaviorFlags]] with named flag set.| | |eventElement.flags.set|string|Event element has [[behavior_flags|ECBehaviorFlags]] with named flag set.| | ||
| |eventElement.flags.clear|string|Event element has [[behavior_flags|ECBehaviorFlags]] with named flag cleared.| | |eventElement.flags.clear|string|Event element has [[behavior_flags|ECBehaviorFlags]] with named flag cleared.| | ||
| + | |eventElement.interactElement.assigned|string|Event element is assigned to [[behavior_interactelement|ECBehaviorInteractElement]] with identifier matching value string.| | ||
| + | |eventElement.interactElement.assigned.not|string|Event element is not assigned to [[behavior_interactelement|ECBehaviorInteractElement]] with identifier matching value string.| | ||
| This is an example of using this action: | This is an example of using this action: | ||
| Line 277: | Line 306: | ||
| ====== Behavior Tree Actions ====== | ====== Behavior Tree Actions ====== | ||
| - | This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace '' | + | This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace '' |
| - | ===== attachSlot.update | + | ===== stateMachine.set ===== |
| - | Update attach slot. | + | Set state machine parameters. |
| ^Parameter^Value^Description^ | ^Parameter^Value^Description^ | ||
| - | |detach|empty string, '' | + | |reset| |Reset state machine |
| - | |interactElement.assign|string|Assign attached element | + | |state|string|Set state machine |
| - | |interact|string|Interact with attachable. If element is absent action fails. Runs interaction with name value. If interaction with name value is absent fails action. If interaction returns false fails action. Otherwise action succeeds.| | + | |
| - | |interact.parameters|string|Optional parameters | + | |
| - | This is an example of using this action: | + | This is an example of using this action |
| <code xml> | <code xml> | ||
| - | <action name='attachSlot.set'> | + | <action name='stateMachine.set'> |
| - | < | + | < |
| </ | </ | ||
| </ | </ | ||
| - | ===== attachSlot.check ===== | + | ===== stateMachine.event ===== |
| - | Check one or more attach slot parameters. Action succeeds if all parameter value matches their respective attach slot parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a attach slot parameter matches (or not). | + | Run event on state machine. |
| ^Parameter^Value^Description^ | ^Parameter^Value^Description^ | ||
| - | |empty|'' | + | |id|string|Identifier of event to run.| |
| - | |interact.name|string|Name of interaction| | + | |
| - | |interact.has|'' | + | This is an example of using this action to run event '' |
| - | |interact.query|'' | + | <code xml> |
| - | |interact.parameters|string|Optional parameters to use with '' | + | <action name='stateMachine.event'> |
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ===== stateMachine.check ===== | ||
| + | |||
| + | Check one or more state machine parameters. Action succeeds if all parameter value matches their respective state machine parameter otherwise action fails. This action | ||
| + | |||
| + | ^Parameter^Value^Description^ | ||
| + | |state|string|Current state machine state identifier matches value.| | ||
| + | |state.not|string|Current state machine state identifier does not match value.| | ||
| + | |state.starts|string|Current state machine state identifier begins | ||
| + | |state.starts.not|string|Current state machine state identifier does not begin with value.| | ||
| + | |state.ends|string|Current state machine state identifier ends with value.| | ||
| + | |state.ends.not|string|Current state machine state identifier does not end with value.| | ||
| + | |state.contains|string|Current state machine state identifier contains value.| | ||
| + | |state.contains.not|string|Current state machine state identifier does not contain value.| | ||
| |wait| |If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled| | |wait| |If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled| | ||
| - | This is an example of using this action: | + | This is an example of using this action |
| <code xml> | <code xml> | ||
| < | < | ||
| - | <action name='attachSlot.check'> | + | <action name='stateMachine.check'> |
| - | < | + | < |
| </ | </ | ||
| - | <!-- actions here run only if attach slot is not empty, hence an attachable is present | + | <!-- actions here run only if state machine |
| </ | </ | ||
| </ | </ | ||
| Line 320: | Line 364: | ||
| ====== Behavior Tree Conditions ====== | ====== Behavior Tree Conditions ====== | ||
| - | This behavior adds these behavior tree conditions if behavior tree is present. If behavior has non-empty identifier replace '' | + | This behavior adds these behavior tree conditions if behavior tree is present. If behavior has non-empty identifier replace '' |
| - | ===== attachSlot.check ===== | + | ===== stateMachine.check ===== |
| - | Check one or more attach slot parameters. Conditions returns true if all parameter value match their respective | + | Check one or more state machine |
| ^Parameter^Value^Description^ | ^Parameter^Value^Description^ | ||
| - | |attachSlot.empty|'' | + | |stateMachine.state|string|Current state machine state identifier matches value.| |
| - | |attachSlot.interact.name|string|Name of interaction| | + | |stateMachine.state.not|string|Current state machine state identifier does not match value.| |
| - | |attachSlot.interact.has|'' | + | |stateMachine.state.starts|string|Current state machine state identifier begins |
| - | |attachSlot.interact.query|'' | + | |stateMachine.state.starts.not|string|Current state machine state identifier does not begin with value.| |
| - | |attachSlot.interact.parameters|string|Optional parameters to use with '' | + | |stateMachine.state.ends|string|Current state machine state identifier ends with value.| |
| + | |stateMachine.state.ends.not|string|Current state machine state identifier does not end with value.| | ||
| + | |stateMachine.state.contains|string|Current state machine state identifier contains value.| | ||
| + | |stateMachine.state.contains.not|string|Current state machine state identifier does not contain value.| | ||
| - | This is an example of using this condition: | + | This is an example of using this condition |
| <code xml> | <code xml> | ||
| <action name=' | <action name=' | ||
| - | <parameter name=' | + | <condition>stateMachine.check</condition> |
| - | <condition> | + | <parameter name=' |
| </ | </ | ||
| </ | </ | ||