RS30002 28 Posted July 3, 2022 Hi, why is the sleep in between these two blocks not really working? Like it lands for a few seconds, turning engine off, the i can hear it rev up again and it flies off, it's on the ground max 5 secs. I tried a bunch of things, taking it's fuel away, disable path....but it never registers the delay fully... _chpdest1 = [5027.59,5904.36,0]; _chppltwp1 = tarugrp1 addWaypoint [[5027.59,5904.36,0], 0]; _chppltwp1 setWaypointType "MOVE"; _chppltwp1 setWaypointSpeed "NORMAL"; sleep 0.05; taru1 flyinheight 200; pad1 = createVehicle ["Land_HelipadEmpty_F", _chpdest1, [], 0, "CAN_COLLIDE"]; waitUntil {taru1 distance pad1 < 250 }; taru1 land "LAND"; if (isTouchingGround taru1) then {deletevehicle pad1;}; sleep 30; _chpdest2 = [4366.28,3816.18,0]; _chppltwp2 = tarugrp1 addWaypoint [[4366.28,3816.18,0], 0]; _chppltwp2 setWaypointType "MOVE"; _chppltwp2 setWaypointSpeed "NORMAL"; sleep 0.05; taru1 flyinheight 200; pad2 = createVehicle ["Land_HelipadEmpty_F", _chpdest2, [], 0, "CAN_COLLIDE"]; waitUntil {taru1 distance pad2 < 250 }; taru1 land "LAND"; if (isTouchingGround taru1) then {deletevehicle pad2;}; Thanks in advance for any insights. Share this post Link to post Share on other sites
f2k sel 164 Posted July 3, 2022 If memory serves me right the "LAND" command only puts the vehicle on the ground which it does it then throttles up again and takes off waiting for the next move command. Try placing a move waypoint right next to the first one, I think because it's so close to the first waypoint it won't bother trying to take off. 2 Share this post Link to post Share on other sites
RS30002 28 Posted July 3, 2022 nvm i figured it, just increase sleep.... it starts to count immediately after reaching the line where it says it has to wait with counting until something happens? idk... 1 Share this post Link to post Share on other sites
Harzach 2517 Posted July 3, 2022 Maybe don't delete the helipad until after the heli has taken off again. The sleep won't start until the command itself is executed. It won't execute while the waitUntil is still running. 1 Share this post Link to post Share on other sites
f2k sel 164 Posted July 3, 2022 the helipad probably isn't getting deleted as the code goes to the sleep command before it lands (touching ground) so the if is never true it needs a wait until ect. The problem with using the sleep command is that if the chopper gets delayed for longer than the sleep the the next waypoint becomes active. 3 Share this post Link to post Share on other sites
Larrow 2821 Posted July 4, 2022 Spoiler TAG_fnc_moveToWaypointAndLand = { params[ "_veh", "_wpPos" ]; private _group = group driver _veh; private _wp = _group addWaypoint[ _wpPos, 0 ]; _wp setWaypointType "MOVE"; _wp setWaypointSpeed "NORMAL"; _group setCurrentWaypoint _wp; _wpIndex = currentWaypoint _group; //Wait for waypoint completion waitUntil{ currentWaypoint _group > _wpIndex }; private _pad = createVehicle ['Land_HelipadEmpty_F', _pos, [], 0, 'CAN_COLLIDE']; _veh land "LAND"; //Wait for vehicle to land and come to complete stop waitUntil{ isTouchingGround _veh && { !isEngineOn _veh } }; deleteVehicle _pad; }; _chpdest1 = [5027.59,5904.36,0]; _chpdest2 = [4366.28,3816.18,0]; taru1 flyInHeight 200; { [ taru1, _x ] call TAG_fnc_moveToWaypointAndLand; sleep 30; }forEach[ _chpdest1, _chpdest2 ]; hint "Taru1 route completed"; 2 Share this post Link to post Share on other sites
pierremgi 4879 Posted July 4, 2022 16 hours ago, Rok Stuhne said: nvm i figured it, just increase sleep.... it starts to count immediately after reaching the line where it says it has to wait with counting until something happens? idk... Yes, running a command such as land doesn't mean the script halts until the helo is landing. The command initiates a cinematic for helo landing and the script goes while your helo lands. A waitUntil condition is far better than a sleep in this case. 2 Share this post Link to post Share on other sites