{"name":"setDriveOnPath","operator":null,"title":"setDriveOnPath","type":"command","url":"https://community.bistudio.com/wiki/setDriveOnPath","revid":347683,"updated":"2023-10-10T16:57:57Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.68"}],"since":{"game":"arma3","name":"Arma 3","version":"1.68"},"arma3_since":"1.68","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Sets the path to follow for AI driver. Note that unitReady will return true even if AI is still driving through the points.\n\nUsing any other *move* command (e.g `_vehicle move getPosATL _vehicle`) or doStop will stop the effect of this command.\n\n> [!IMPORTANT]\n> 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.)\n\n> [!NOTE]\n> 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.","syntaxes":[{"syntax":"vehicleName setDriveOnPath points","since":null,"effect":null,"exec":null,"params":[{"name":"vehicleName","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"vehicleName: Object"},{"name":"points","type":"Array","optional":false,"default":null,"description":"list of Positions to format [x,y,z] OR to format [x,y,z, speed], speed being **in m/s**.","types":["Array"],"since":null,"text":"points: Array - list of Positions to format [x,y,z] OR to format [x,y,z, speed], speed being **in m/s**."}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"vehicleName","types":["Object"]},"right":{"text":"points","types":["Array"]}}],"examples":[{"text":"```sqf\nmyVehicle setDriveOnPath [getMarkerPos \"wp1\", getMarkerPos \"wp2\"];\n```","code":["myVehicle setDriveOnPath [getMarkerPos \"wp1\", getMarkerPos \"wp2\"];"]},{"text":"```sqf\nprivate _points = allMapMarkers apply { getMarkerPos _x; }; // getting all marker positions\n{ _x pushBack 15; } forEach _points; // setting speed\nmyVehicle setDriveOnPath _points;\n```","code":["private _points = allMapMarkers apply { getMarkerPos _x; }; // getting all marker positions\n{ _x pushBack 15; } forEach _points; // setting speed\nmyVehicle setDriveOnPath _points;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["move","forceSpeed","limitSpeed","Waypoint","useAISteeringComponent"],"notes":[{"user":"Leopard20","date":"2021-06-25T07:42:00Z","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)"}],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Manipulation","Introduced with Arma 3 version 1.68","Scripting Commands"]}