BIS fnc scriptedMove: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " <h3 style="display:none">Notes</h3> <dl class="command_description"> <!-- Note Section BEGIN --> <!-- Note Section END --> </dl> " to "")
(Add BIS_fnc_unitCapture to see also)
 
(37 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Function|Comments=
<!--
{{TabView


| arma2oa |Game name=
|selected= 2


|1.51|Game version=
|title1= {{TabView/GameTitle|arma2oa}}
|content1=


|gr1 = Object Manipulation |GROUP1=
{{RV|type=function


| Force a unit to turn towards and walk to  |Description=
|game1= arma2oa
|version1= 1.50


| [unit, waypoints'', code, walkAnim, animLength''] call [[BIS_fnc_scriptedMove]] |Syntax=
|game2= tkoh
|version2= 1.00


|p1= unit: [[Object]] |Parameter 1=
|game3= arma3
|version3= 0.50


|p2= waypoints: [[Array]] of [[Position|Positions]] |Parameter 2=
|gr1= Object Manipulation


|p3= code: [[Code]] - (Optional, default {{Inline code|<nowiki>{}</nowiki>}}) code to run after waypoint completion |Parameter 3=
|descr= Force a unit to turn towards and walk to provided destination(s).
{{Feature|arma3|This syntax is '''broken''' in {{arma3}} as its code relies on [[Arma 2: Multiplayer Framework]] and only works since {{GVI|arma3|2.10}} (see other tab).}}


|p4= walkAnim: [[String]] - (Optional, default "AmovPercMwlkSnonWnonDf") |Parameter 4=
|s1= [unit, waypoints, code, walkAnim, animLength] call [[BIS_fnc_scriptedMove]]


|p5= animLength: [[Number]] - ('''not''' optional if ''walkAnim'' is defined) |Parameter 5=
|p1= unit: [[Object]]


| [[Script_(Handle)|Script Handle]] |Return value=
|p2= waypoints: [[Array]] of [[Position]]s


|x1= <code>[myUnit, [<nowiki/>[[getMarkerPos]] "wp1", [[getMarkerPos]] "wp2", [[getMarkerPos]] "wp3"]] [[call]] [[BIS_fnc_scriptedMove]];</code> |Example 1=
|p3= code: [[Code]] - (Optional, default <sqf inline>{}</sqf>) code to run after waypoint completion


| [[move]], [[setDriveOnPath]] |See also=
|p4= walkAnim: [[String]] - (Optional, default "AmovPercMwlkSnonWnonDf")
 
|p5= animLength: [[Number]] - ('''required''' if ''walkAnim'' is defined) distance made by ''walkAnim'' animation
 
|r1= [[Script Handle]]
 
|x1= <sqf>[myUnit, [getMarkerPos "wp1", getMarkerPos "wp2", getMarkerPos "wp3"]] call BIS_fnc_scriptedMove;</sqf>
 
|seealso= [[move]] [[setDriveOnPath]]
}}
}}


<h3 style="display:none">Bottom Section</h3>
|title2= {{TabView/GameTitle|arma3}}
[[Category:Functions|{{uc:scriptedMove}}]]
|content2=
 
-->{{RV|type=function
 
|game1= arma3
|version1= 2.10
 
 
|arg= global
|eff= global
 
|gr1= Object Manipulation
 
|descr= Forces a unit to turn towards and walk to provided destination(s). Will not work on [[player]]. When [[Group]] is used as argument, the function will be automatically executed for each unit in the group.
 
{{Feature|informative|When using ''endAnim'', make sure it is able to break ''walkAnim'' (not all animations are compatible). When code is executed, it receives the following params: [unit, waypoints, currentIndex, userArgs].}}
 
|s1= [unitOrGroup, waypoints, code, walkAnim, completionRadius, endAnim] call [[BIS_fnc_scriptedMove]]
 
|p1= unitOrGroup: [[Object]] or [[Group]] - unit or group of units of the class "Man"
 
|p2= waypoints: [[Array]] of [[Position]]s in format [pos1, pos2, ...] or [<nowiki/>[pos1, completionRadius1, turnSpeedCoef1], [pos2, completionRadius2, turnSpeedCoef2], ...]
 
|p3= code: [[Code]] or [[Array]] - (Optional, default <sqf inline>{}</sqf>) code to run after each waypoint completion. Format {code} or <nowiki>[</nowiki>[params], {code}]
 
|p4= walkAnim: [[String]] - (Optional, default "AmovPercMwlkSnonWnonDf") walking animation to be played in a loop
 
|p5= completionRadius: [[Number]] - (Optional, default 0.5) how far from waypoint center to consider waypoint completion. Global value. The completionRadius given with individual waypoint position overrides global value
 
|p6= turnSpeedCoef: [[Number]] - (Optional, default 1.0) how quickly the unit turns towards next waypoint (fast 0.1 ... 10 slow). The turnSpeedCoef given with individual waypoint position overrides global value
 
|p7= endAnim: [[Number]] - (Optional, default [[animationState]] of the unit prior to function execution) when unit reaches last point, this is the animation to be played immediately. Use "" to let last walkAnim run in full
 
|r1= [[Script Handle]] or [[String]] or [[Nothing]] - depends on execution (local/remote/error);
 
|x1= <sqf>[myUnit, [getMarkerPos "wp1", getMarkerPos "wp2", getMarkerPos "wp3"]] call BIS_fnc_scriptedMove;</sqf>
 
|seealso= [[move]] [[setDriveOnPath]] [[BIS_fnc_unitCapture]]
}}


[[Category:{{Name|arma2oa}}: Functions|{{uc:scriptedMove}}]]
<!--
[[Category:{{Name|tkoh}}: Functions|{{uc:scriptedMove}}]]
}}
[[Category:{{Name|arma3}}: Functions|{{uc:scriptedMove}}]]
-->

Latest revision as of 20:35, 8 October 2023

Hover & click on the images for description

Description

Description:
Forces a unit to turn towards and walk to provided destination(s). Will not work on player. When Group is used as argument, the function will be automatically executed for each unit in the group.
When using endAnim, make sure it is able to break walkAnim (not all animations are compatible). When code is executed, it receives the following params: [unit, waypoints, currentIndex, userArgs].
Execution:
call
Groups:
Object Manipulation

Syntax

Syntax:
[unitOrGroup, waypoints, code, walkAnim, completionRadius, endAnim] call BIS_fnc_scriptedMove
Parameters:
unitOrGroup: Object or Group - unit or group of units of the class "Man"
waypoints: Array of Positions in format [pos1, pos2, ...] or [[pos1, completionRadius1, turnSpeedCoef1], [pos2, completionRadius2, turnSpeedCoef2], ...]
code: Code or Array - (Optional, default {}) code to run after each waypoint completion. Format {code} or [[params], {code}]
walkAnim: String - (Optional, default "AmovPercMwlkSnonWnonDf") walking animation to be played in a loop
completionRadius: Number - (Optional, default 0.5) how far from waypoint center to consider waypoint completion. Global value. The completionRadius given with individual waypoint position overrides global value
turnSpeedCoef: Number - (Optional, default 1.0) how quickly the unit turns towards next waypoint (fast 0.1 ... 10 slow). The turnSpeedCoef given with individual waypoint position overrides global value
endAnim: Number - (Optional, default animationState of the unit prior to function execution) when unit reaches last point, this is the animation to be played immediately. Use "" to let last walkAnim run in full
Return Value:
Script Handle or String or Nothing - depends on execution (local/remote/error);

Examples

Example 1:
[myUnit, [getMarkerPos "wp1", getMarkerPos "wp2", getMarkerPos "wp3"]] call BIS_fnc_scriptedMove;

Additional Information

See also:
move setDriveOnPath BIS_fnc_unitCapture

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