doFSM: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "{{Command " to "{{RV|type=command ") |
Lou Montana (talk | contribs) m (Text replacement - "<dd class="notedate">Posted on ([^<>]+) " to "<dd class="notedate">Posted on $1</dd> ") |
||
Line 34: | Line 34: | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dd class="notedate">Posted on August 4, 2010 - 16:09 | <dd class="notedate">Posted on August 4, 2010 - 16:09</dd> | ||
<dt class="note">[[User:Rübe|Rübe]]<dd class="note">Do not ''doStop'' a unit in a FSM called with ''doFSM'' or ''commandFSM''. Doing so nevertheless will halt your FSM, since no links are followed anymore (doing so in an end state should be fine though). Also this may crash your game in certain mysterious circumstances.<br><br> | <dt class="note">[[User:Rübe|Rübe]]<dd class="note">Do not ''doStop'' a unit in a FSM called with ''doFSM'' or ''commandFSM''. Doing so nevertheless will halt your FSM, since no links are followed anymore (doing so in an end state should be fine though). Also this may crash your game in certain mysterious circumstances.<br><br> | ||
You may design your FSM so that they may be called with doFSM/commandFSM and execFSM likewise by checking if ''_units'' or ''_this'' is nil and then init the variables accordingly. Just remember that you should use the low level ''moveTo'' (together with ''moveToCompleted'', ''moveToFailed'') if do-/commandFSM'd, and ''doMove'' or ''commandMove'' (together with ''unitReady'') if execFSM'd. A ''moveTo'' in an FSM started with ''execFSM'' won't do anything, likewise ''doMove'' in a FSM started with ''doFSM'' or ''commandFSM'' wont work either. Think about it for a minute and you will see why. (hint: a unit running a FSM called with ''doFSM'' or ''commandFSM'' will _never_ return true for ''(unitReady _unit)'')<br><br> | You may design your FSM so that they may be called with doFSM/commandFSM and execFSM likewise by checking if ''_units'' or ''_this'' is nil and then init the variables accordingly. Just remember that you should use the low level ''moveTo'' (together with ''moveToCompleted'', ''moveToFailed'') if do-/commandFSM'd, and ''doMove'' or ''commandMove'' (together with ''unitReady'') if execFSM'd. A ''moveTo'' in an FSM started with ''execFSM'' won't do anything, likewise ''doMove'' in a FSM started with ''doFSM'' or ''commandFSM'' wont work either. Think about it for a minute and you will see why. (hint: a unit running a FSM called with ''doFSM'' or ''commandFSM'' will _never_ return true for ''(unitReady _unit)'')<br><br> |
Revision as of 00:58, 30 January 2021
Description
- Description:
- Description needed
- Groups:
- Unit Control
Syntax
- Syntax:
- Syntax needed
- Parameters:
- unit: Object or Array (for multiple units)
- [fsmName, position, target]: Array
- fsmName: String
- position: Array
- target: Object
- Return Value:
- Return value needed
Examples
Additional Information
- See also:
- See also needed
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
- Posted on August 4, 2010 - 16:09
- Rübe
- Do not doStop a unit in a FSM called with doFSM or commandFSM. Doing so nevertheless will halt your FSM, since no links are followed anymore (doing so in an end state should be fine though). Also this may crash your game in certain mysterious circumstances.
You may design your FSM so that they may be called with doFSM/commandFSM and execFSM likewise by checking if _units or _this is nil and then init the variables accordingly. Just remember that you should use the low level moveTo (together with moveToCompleted, moveToFailed) if do-/commandFSM'd, and doMove or commandMove (together with unitReady) if execFSM'd. A moveTo in an FSM started with execFSM won't do anything, likewise doMove in a FSM started with doFSM or commandFSM wont work either. Think about it for a minute and you will see why. (hint: a unit running a FSM called with doFSM or commandFSM will _never_ return true for (unitReady _unit))
Anyway, if you want to be able to call your FSM either way, a "ready" condition might look light this: (moveToCompleted _unit) || (moveToFailed _unit) || (unitReady _unit), assuming you have a moveTo or a doMove (depending on how the fsm is called) in the prior state.
- Posted on February 14, 2015 - 13:36 (UTC)
- Katulobotomia
- Adding to Rübe's note, doFSM can be checked if it has finished by unitReady as of 2015 and it will return true when your FSM has completed.