setDriveOnPath: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^<]*)\[\[Magic Variables#x\|(_x)\]\]([^<]*)<\/code>" to "<code>$1$2$3</code>")
m (Text replacement - "\|x([0-9])= *<code>([^<]*)<\/code>" to "|x$1= <sqf>$2</sqf>")
Line 21: Line 21:
|x1= <code>myVehicle setDriveOnPath [<nowiki/>getMarkerPos "wp1", getMarkerPos "wp2"];</code>
|x1= <code>myVehicle setDriveOnPath [<nowiki/>getMarkerPos "wp1", getMarkerPos "wp2"];</code>


|x2= <code>_points = allMapMarkers apply { getMarkerPos _x; }; // getting all marker positions
|x2= <sqf>_points = allMapMarkers apply { getMarkerPos _x; }; // getting all marker positions
{ _x pushBack 15; } forEach _points; // setting speed
{ _x pushBack 15; } forEach _points; // setting speed
myVehicle setDriveOnPath _points;</code>
myVehicle setDriveOnPath _points;</sqf>


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

Revision as of 11:24, 13 May 2022

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 vehicleName move getPos vehicleName) or doStop will stop the effect of this command.
This command doesn't work on air vehicles and boats. Only land vehicles are 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:
_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

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 June 25, 2021 - 07:42 (UTC)
Leopard20
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)