setDriveOnPath: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(Correct description about when command doesn't work)
 
(42 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Command|=
{{RV|type=command
____________________________________________________________________________________________
 
|arma3 |= Game
|game1= arma3
|1.68|= Game Version
|version1= 1.68
|arg=  |= Multiplayer Arguments
 
|eff= |= Multiplayer Effects
|gr1= Object Manipulation
____________________________________________________________________________________________
 
| Sets the path to follow for AI driver |= Description
|descr= Sets the path to follow for AI driver. Note that [[unitReady]] will return [[true]] even if AI is still driving through the points.<br>
____________________________________________________________________________________________
Using any other ''move'' command (e.g <sqf inline>_vehicle move getPosATL _vehicle</sqf>) or [[doStop]] will stop the effect of this command.
| vehicleName [[setDriveOnPath]] [points] |= Syntax
{{Feature|important|This command does '''not''' work if the vehicle doesn't have an [[useAISteeringComponent|AI steering component]] defined in its config, or if the component is disabled. Thus, it never works on air vehicles and boats which don't use steering components. Only land vehicles may be compatible. (cars, tanks, APCs, etc.)}}
|p1= vehicleName: [[Object]] |= Parameter 1
{{Feature|informative|For the command to work properly, the unit must either be an [[createAgent|agent]], or in the case of normal AI, have been stopped using [[doStop]].}}
|p2= points: [[Array]] - List of points [x,y,z] |= Parameter 2
 
|p3=  |= Parameter 3
|s1= vehicleName [[setDriveOnPath]] points
|p4=  |= Parameter 4
 
|p5=  |= Parameter 5
|p1= vehicleName: [[Object]]
|p6=  |= Parameter 6
 
| [[Nothing]] |= Return Value
|p2= points: [[Array]] - list of [[Position]]s to format [x,y,z] OR to format [x,y,z, speed], speed being '''in m/s'''.
|s2=  |= Alternative Syntax
 
|p21= |= Alternative Parameter 1
|r1= [[Nothing]]
|p22=  |= Alternative Parameter 2
|p23=  |= Alternative Parameter 3
|p24=  |= Alternative Parameter 3
|r2=  |= Alternative Return Value
|x1= myVehicle setDriveOnPath [[1000,10,1000],[1100,10,1000]] |= Example 1
| - |= See Also
}}


<dl class='command_description'>
|x1= <sqf>myVehicle setDriveOnPath [getMarkerPos "wp1", getMarkerPos "wp2"];</sqf>
<!-- BEGIN Note Section -->
<!-- For example:
<dd class='notedate'>Posted on Month Day, Year - Time (UTC)</dd>
<dt class='note'>'''[[User:User Name|User Name]]'''</dt>
<dd class='note'>This is an example note. It is true and verifiable, and contains a little code snippet.
<code>[[if]] ([[_this]] == anExample) [[then]] { [[hint]] Leave it here for others to read; };</code></dd>
-->
<!-- END Note Section -->
</dl>


<h3 style='display:none'>Bottom Section</h3>
|x2= <sqf>
<!-- Appropriate categories go here -->
private _points = allMapMarkers apply { getMarkerPos _x; }; // getting all marker positions
{ _x pushBack 15; } forEach _points; // setting speed
myVehicle setDriveOnPath _points;
</sqf>


[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
|seealso= [[move]] [[forceSpeed]] [[limitSpeed]] [[Waypoint]] [[useAISteeringComponent]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
}}
 
{{Note
|user= Leopard20
|timestamp= 20210625074200
|text= To use this command, the AI must not have a [[formLeader]]. The easiest way to achieve this is to use [[doStop]] to stop the AI (warning! it'll break the AI waypoints)
}}

Latest revision as of 17:57, 10 October 2023

Hover & click on the images for description

Description

Description:
Sets the path to follow for AI driver. Note that unitReady will return true even if AI is still driving through the points.
Using any other move command (e.g _vehicle move getPosATL _vehicle) or doStop will stop the effect of this command.
This command does not work if the vehicle doesn't have an AI steering component defined in its config, or if the component is disabled. Thus, it never works on air vehicles and boats which don't use steering components. Only land vehicles may be compatible. (cars, tanks, APCs, etc.)
For the command to work properly, the unit must either be an agent, or in the case of normal AI, have been stopped using doStop.
Groups:
Object Manipulation

Syntax

Syntax:
vehicleName setDriveOnPath points
Parameters:
vehicleName: Object
points: Array - list of Positions to format [x,y,z] OR to format [x,y,z, speed], speed being in m/s.
Return Value:
Nothing

Examples

Example 1:
myVehicle setDriveOnPath [getMarkerPos "wp1", getMarkerPos "wp2"];
Example 2:
private _points = allMapMarkers apply { getMarkerPos _x; }; // getting all marker positions { _x pushBack 15; } forEach _points; // setting speed myVehicle setDriveOnPath _points;

Additional Information

See also:
move forceSpeed limitSpeed Waypoint useAISteeringComponent

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
Leopard20 - c
Posted on Jun 25, 2021 - 07:42 (UTC)
To use this command, the AI must not have a formLeader. The easiest way to achieve this is to use doStop to stop the AI (warning! it'll break the AI waypoints)