setDriveOnPath: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^ ]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^ ]*)<\/code>" to "<code>$1$2$3</code>")
(Correct description about when command doesn't work)
 
(15 intermediate revisions by 2 users not shown)
Line 7: Line 7:


|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>
|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 {{ic|vehicleName [[move]] [[getPos]] vehicleName}}) or [[doStop]] will stop the effect of this command.
Using any other ''move'' command (e.g <sqf inline>_vehicle move getPosATL _vehicle</sqf>) or [[doStop]] will stop the effect of this command.
{{Feature | important | This command '''doesn't work''' on air vehicles and boats. Only land vehicles are compatible. (cars, tanks, APCs, etc.)}}
{{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.)}}
{{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]]. }}
{{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]].}}


|s1= vehicleName [[setDriveOnPath]] points
|s1= vehicleName [[setDriveOnPath]] points
Line 15: Line 15:
|p1= vehicleName: [[Object]]
|p1= vehicleName: [[Object]]


|p2= points: [[Array]] - list of [[Position|Positions]] to format [x,y,z] OR to format [x,y,z, speed], speed being '''in m/s'''.
|p2= points: [[Array]] - list of [[Position]]s to format [x,y,z] OR to format [x,y,z, speed], speed being '''in m/s'''.


|r1= [[Nothing]]
|r1= [[Nothing]]


|x1= <code>myVehicle setDriveOnPath [<nowiki/>[[getMarkerPos]] "wp1", [[getMarkerPos]] "wp2"];</code>
|x1= <sqf>myVehicle setDriveOnPath [getMarkerPos "wp1", getMarkerPos "wp2"];</sqf>


|x2= <code>_points = [[allMapMarkers]] [[apply]] { [[getMarkerPos]] _x; }; {{cc|getting all marker positions}}
|x2= <sqf>
{ [[Magic Variables#x|_x]] [[pushBack]] 15; } forEach _points; {{cc|setting [[speed]]}}
private _points = allMapMarkers apply { getMarkerPos _x; }; // getting all marker positions
myVehicle [[setDriveOnPath]] _points;</code>
{ _x pushBack 15; } forEach _points; // setting speed
myVehicle setDriveOnPath _points;
</sqf>


|seealso= [[move]] [[forceSpeed]] [[limitSpeed]] [[Waypoint]]
|seealso= [[move]] [[forceSpeed]] [[limitSpeed]] [[Waypoint]] [[useAISteeringComponent]]
}}
}}


 
{{Note
<dl class="command_description">
|user= Leopard20
<dt></dt>
|timestamp= 20210625074200
<dd class="notedate">Posted on June 25, 2021 - 07:42 (UTC)</dd>
|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)
<dt class="note">[[User:Leopard20|Leopard20]]</dt>
}}
<dd class="note">
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)
</dd>
</dl>

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)