ArmaMan360 94 Posted November 19, 2015 ok this is not working: .. _convoy = [_vehicle2, _vehicle3]; { script_handler = [] spawn waitUntil {sleep 0.5; ((_mkrpos distance _x) < 70);} foreach _convoy; waitUntil {!alive _vehicle2 && !alive _vehicle3 || scriptDone script_handler}; if (!alive _vehicle2 && !alive _vehicle3) then { ["Task3", "FAILED", true] call BIS_fnc_taskSetState; } else { ["Task3", "SUCCEEDED", true] call BIS_fnc_taskSetState; }; }; I want that if the convoy reaches a distance less than 70 metres of _mkrpos, I fail the task., But I am able to take our veh 2 and veh 3, then I win. Will if statement be better for such multiple instances? I am getting errors now. Thank you. Share this post Link to post Share on other sites
Greenfist 1863 Posted November 19, 2015 First of all, if you're getting errors, you should tell us what they are. And, anything after the first line won't run at all. Check out how to use spawn. Share this post Link to post Share on other sites
ArmaMan360 94 Posted November 19, 2015 OK what changes are needed in this? waitUntil {sleep 3; (((_vehicle2 && _vehicle3) distance _mkrpos) < 70);}; ["Task3", "FAILED"] call BIS_fnc_taskSetState; waitUntil {sleep 3; (alive _vehicle2) && !(alive _vehicle3)}; ["Task3", "Succeeded"] call BIS_fnc_taskSetState; Right now i am getting the error that "Missing ; " after "...<70#).. As far as i know ";" isnt needed after the distance check. Share this post Link to post Share on other sites
ArmaMan360 94 Posted November 19, 2015 and this is throwing the error that Type object expected bool: waitUntil {sleep 3; ((_vehicle2 && _vehicle3 distance _mkrpos) < 70);}; ["Task3", "FAILED"] call BIS_fnc_taskSetState; Share this post Link to post Share on other sites
Greenfist 1863 Posted November 19, 2015 (_vehicle2 && _vehicle3) distance _mkrpos This doesn't work because (_vehicle2 && _vehicle3) doesn't mean anything. You could do the wait like this: waitUntil {sleep 0.5; { _x distance _mkrpos < 70 } count _convoy >= {alive _x} count _convoy }; Wait until the number of vehicles in 70m range is equal or greater than the number of alive vehicles in the convoy. edit. vehicles are considered alive until they explode; an immobile vehicle is still alive but can't reach the range ever. So you might want to replace the "alive _x" with "canMove _x". Dunno how reliable that is though. Share this post Link to post Share on other sites
ArmaMan360 94 Posted November 19, 2015 _convoy = [_vehicle2, _Vehicle3]; waitUntil {sleep 0.5; { _x distance _mkrpos < 70 } count _convoy >= {alive _x} count _convoy }; ["Task3", "FAILED"] call BIS_fnc_taskSetState; waitUntil {sleep 3; !(canMove _vehicle2) && !(canMove _vehicle3)}; ["Task3", "Succeeded"] call BIS_fnc_taskSetState; The first waituntil fires corectly when convoy reaches within 70 mtrs. of objective. But the second waituntil has 2 issues: 1. It doesnt fire when both the vehicles cannot move but rather need to be exploded 2. Even if it does fire, it still fails the task. Maybe the alive check in the first waituntil is responsible? Share this post Link to post Share on other sites
Greenfist 1863 Posted November 19, 2015 waitUntil {sleep 0.5; { _x distance _mkrpos < 70 } count _convoy >= {canMove _x} count _convoy }; if (canMove _vehicle2 && canMove _vehicle3) then { ["Task3", "Succeeded"] call BIS_fnc_taskSetState; } else { ["Task3", "FAILED"] call BIS_fnc_taskSetState; }; Share this post Link to post Share on other sites
ArmaMan360 94 Posted November 19, 2015 Works great thank youuuu... I just had the replace the words "succeeded" with "failed" and vice versa.. Ok when the convoy moves and if I start shooting them, it will change its course. If I go to rearm from base in case I run out of ammo, will the convoy still try to find a way to the obj or totally let go of the objective and keep wandering around the map? Share this post Link to post Share on other sites