K120 1 Posted September 2, 2013 (edited) I'm trying to make flare drop every ~150 sec from sky after enemy detects me as long as there are any of 7 enemies with GL weapons alive. I've named them f1,f2,f3,f4,f5,f6 and f7. I have trigger that exec flare.sqf I've tried everything i have found with searching but so far i get every time error. This is as it currently is: if ((!alive f1) and (!alive f2) and (!alive f3) and (!alive f4) and (!alive f5) and (!alive f6) and (!alive f7)) then {exitWith {} } else {flrObj = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [0,100,200]); flrObj setVelocity [0,0,-10]}; sleep 150; if ((!alive f1) and (!alive f2) and (!alive f3) and (!alive f4) and (!alive f5) and (!alive f6) and (!alive f7)) then {exitWith {} } else {flrObj = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [100,0,200]); flrObj setVelocity [0,0,-10]}; sleep 150; if ((!alive f1) and (!alive f2) and (!alive f3) and (!alive f4) and (!alive f5) and (!alive f6) and (!alive f7)) then {exitWith {} } else {flrObj = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [0,100,200]); flrObj setVelocity [0,0,-10]}; sleep 150; if ((!alive f1) and (!alive f2) and (!alive f3) and (!alive f4) and (!alive f5) and (!alive f6) and (!alive f7)) then {exitWith {} } else {flrObj = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [100,0,200]); flrObj setVelocity [0,0,-10]}; and so on... Can anyone tell what's wrong?Am i using wrong brackets? Also is it possible to loop 2 flares (they drop from different spot) ? Edited September 2, 2013 by K120 Share this post Link to post Share on other sites
Zenophon 110 Posted September 2, 2013 Firstly, what error do you get? Please provide the exact description and line number. Anyway, I would rewrite that script like this: private ["_i", "_flare"]; for "_i" from 1 to 10 do { if (({alive _x} count [f1, f2, f3, f4, f5, f6, f7]) == 0) exitWith {}; sleep 150; if ((_i % 2) == 0) then { _flare = createVehicle ["F_20mm_Yellow", (player ModelToWorld [100,0,0]), [], 0, "NONE"] } else { _flare = createVehicle ["F_20mm_Yellow", (player ModelToWorld [0,100,0]), [], 0, "NONE"]; }; _flare setPosATL [((getPosATL _flare) select 0), ((getPosATL _flare) select 1), 200]; _flare setVelocity [0,0,-10]; }; As _i switches from even to odd, the 'modelToWorld' argument will change. I have tested that without the exitWith statement and with a car; it seems to work. Share this post Link to post Share on other sites
K120 1 Posted September 3, 2013 That seemed to work though i moved sleep to bottom so flares drop instantly when detected. This was the finishing touch for my mission,thanks! Share this post Link to post Share on other sites