doFSM: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Arma[ _]2(\|.*)\]\]" to "{{GameCategory|arma2|Scripting Commands}}")
m (Fixed formatting)
 
(38 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma1 |Game name=
|game1= arma1
|version1= 1.00


|1.00|Game version=
|game2= arma2
|version2= 1.00


|gr1= Unit Control |GROUP1=
|game3= arma2oa
____________________________________________________________________________________________
|version3= 1.50


| Orders a unit to process command defined by [[FSM]] file (silently).  
|game4= tkoh
|version4= 1.00
 
|game5= arma3
|version5= 0.50
 
|gr1= Unit Control
 
|descr= Orders a unit to process command defined by [[FSM]] file (silently).  


Unlike with execFSM where ''_this'' is passed to the FSM, the following parameters are passed when using doFSM/commandFSM:
Unlike with execFSM where ''_this'' is passed to the FSM, the following parameters are passed when using doFSM/commandFSM:


; _leader: leader of subgroup with this command  
: _leader: leader of subgroup with this command  
; _destination: command destination/position
: _destination: command destination/position
; _target: command target  
: _target: command target  
; _units: list of all persons in subgroup  
: _units: list of all persons in subgroup  
 
|s1= unit [[doFSM]] [fsmName, position, target]


|DESCRIPTION=
|p1= unit: [[Object]] or [[Array]] of [[Object|objects]]
____________________________________________________________________________________________


| unit '''doFSM''' [fsmName, position, target] |SYNTAX=
|p3= fsmName: [[String]]


|p1= unit: [[Object]] or [[Array]] (for multiple units) |PARAMETER1=
|p4= position: [[Array]]
|p2= [fsmName, position, target]: [[Array]] |PARAMETER2=


|p3= fsmName: [[String]] |PARAMETER3=
|p5= target: [[Object]]
|p4= position: [[Array]] |PARAMETER4=
|p5= target: [[Object]] |PARAMETER5=


| [[Nothing]] |RETURNVALUE=
|r1= [[Nothing]]
____________________________________________________________________________________________
 
|x1= <code>_soldierOne [[doFSM]] ["move.fsm", [[position]] [[player]], [[player]]];</code> |EXAMPLE1=
____________________________________________________________________________________________


| [[FSM]], [[FSM_Editor_Manual]], [[commandFSM]], [[completedFSM]], [[execFSM]], [[getFSMVariable]], [[setFSMVariable]], [[unitReady]] |SEEALSO=
|x1= <sqf>_soldierOne doFSM ["move.fsm", position player, player];</sqf>


|x2= <sqf>units player doFSM ["move.fsm", position player, player];</sqf>
|seealso= [[FSM]] [[FSM_Editor_Manual]] [[commandFSM]] [[completedFSM]] [[execFSM]] [[getFSMVariable]] [[setFSMVariable]] [[unitReady]]
}}
}}


<h3 style="display:none">Notes</h3>
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
 
<dd class="notedate">Posted on August 4, 2010 - 16:09
<dt></dt>
<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>
<dd class="notedate">Posted on 2010-08-04 - 16:09</dd>
<dt class="note">[[User:Rübe|Rübe]]</dt>
<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>
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.
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.
<!-- Note Section END -->
</dl>


<h3 style="display:none">Bottom Section</h3>
<dt></dt>
 
<dd class="notedate">Posted on 2015-02-14 - 13:36 (UTC)</dd>
[[Category:Scripting Commands|DOFSM]]
{{GameCategory|arma1|Scripting Commands}}
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}
 
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on February 14, 2015 - 13:36 (UTC)</dd>
<dt class="note">[[User:Katulobotomia|Katulobotomia]]</dt>
<dt class="note">[[User:Katulobotomia|Katulobotomia]]</dt>
<dd class="note">
<dd class="note">
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.
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.
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 14:04, 12 August 2024

Hover & click on the images for description

Description

Description:
Orders a unit to process command defined by FSM file (silently). Unlike with execFSM where _this is passed to the FSM, the following parameters are passed when using doFSM/commandFSM:
_leader: leader of subgroup with this command
_destination: command destination/position
_target: command target
_units: list of all persons in subgroup
Groups:
Unit Control

Syntax

Syntax:
unit doFSM [fsmName, position, target]
Parameters:
unit: Object or Array of objects
fsmName: String
position: Array
target: Object
Return Value:
Nothing

Examples

Example 1:
_soldierOne doFSM ["move.fsm", position player, player];
Example 2:
units player doFSM ["move.fsm", position player, player];

Additional Information

See also:
FSM FSM_Editor_Manual commandFSM completedFSM execFSM getFSMVariable setFSMVariable unitReady

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 2010-08-04 - 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 2015-02-14 - 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.