BIS fnc scriptedMove: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Add Arma 3 "broken" note)
No edit summary
Line 9: Line 9:
|game3= arma3
|game3= arma3
|version3= 0.50
|version3= 0.50
|arg= global
|eff= global


|gr1= Object Manipulation
|gr1= Object Manipulation


|descr= Force a unit to turn towards and walk to provided destination(s).
|descr= Forces a unit to turn towards and walk to provided destination(s). Will not work on [[player]].
{{Feature|arma3|This function is '''broken''' in {{arma3}} as its code relies on [[Arma 2: Multiplayer Framework]].}}
{{Feature | Important | Fixed version compatible with Arma 3 will be available in '''Arma 3 v2.10''' or in the dev branch}}


|s1= [unit, waypoints, code, walkAnim, animLength] call [[BIS_fnc_scriptedMove]]
|s1= [unit, waypoints, code, walkAnim, completionRadius, endAnim] call [[BIS_fnc_scriptedMove]]


|p1= unit: [[Object]]
|p1= unit: [[Object]] - unit of the class "Man"


|p2= waypoints: [[Array]] of [[Position]]s
|p2= waypoints: [[Array]] of [[Position]]s in format [pos1, pos2,...] or <nowiki>[</nowiki>[pos1, completionRadius1], [pos2, completionRadius2],...]


|p3= code: [[Code]] - (Optional, default {{ic|<nowiki>{}</nowiki>}}) code to run after waypoint completion
|p3= code: [[Code]] or [[Array]] - (Optional, default {{ic|<nowiki>{}</nowiki>}}) code to run after each waypoint completion. Format {code} or <nowiki>[</nowiki>[params], {code}]


|p4= walkAnim: [[String]] - (Optional, default "AmovPercMwlkSnonWnonDf")
|p4= walkAnim: [[String]] - (Optional, default "AmovPercMwlkSnonWnonDf")


|p5= animLength: [[Number]] - ('''required''' if ''walkAnim'' is defined) distance made by ''walkAnim'' animation
|p5= completionRadius: [[Number]] - (Optional, default 0.5) how far from waypoint center to consider waypoint completion
|p6= 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]]
|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>
|x1= <sqf>[myUnit, [getMarkerPos "wp1", getMarkerPos "wp2", getMarkerPos "wp3"]] call BIS_fnc_scriptedMove;</sqf>

Revision as of 12:53, 1 May 2022

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.
Fixed version compatible with Arma 3 will be available in Arma 3 v2.10 or in the dev branch
Execution:
call
Groups:
Object Manipulation

Syntax

Syntax:
[unit, waypoints, code, walkAnim, completionRadius, endAnim] call BIS_fnc_scriptedMove
Parameters:
unit: Object - unit of the class "Man"
waypoints: Array of Positions in format [pos1, pos2,...] or [[pos1, completionRadius1], [pos2, completionRadius2],...]
code: Code or Array - (Optional, default {}) code to run after each waypoint completion. Format {code} or [[params], {code}]
walkAnim: String - (Optional, default "AmovPercMwlkSnonWnonDf")
completionRadius: Number - (Optional, default 0.5) how far from waypoint center to consider waypoint completion
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:
movesetDriveOnPath

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