slendermang 2 Posted May 16, 2016 Hello, I'm trying to activate a trigger and have an integer passed by using the count command and deteremining the number of vehicles left alive. However I'm running into a syntax error, I've checked the count and array page but I'm abit lost on what exactly I'm doing incorrect. [] spawn waitUntil { sleep 1; time > 0; }; waitUntil { sleep 10; (!alive refinery) && (alive mi24); }; hint "It worked!"; deleteVehicle mi24; [helo] call DAC_Activate; [] spawn waitUntil { sleep 1; time > 0 }; waitUntil { sleep 10; (!alive refinery) }; _cnt = {alive _x} count thisList [hmmv_1,hmmv_2,hmmv_3,hmmv_4]; if (_cnt == 0) then { exitWith{hint "There's less than 0 Humvees"}; } else { _values = ["vic_reinf",[19,0,0,0],[],[_cnt,4,1,15],[],[],[1,1,8,0,2]]; [[5219.493,6786.812,0],40,40,0,0,_values] call DAC_fNewZone; {deletevehicle _x} forEach thisList [hmmv1,hmmv2,hmmv3,hmmv4]; [vick_reinf] call DAC_Activate; hint "Humvees activated"; } The .rpt tells me that the highlighted line is incorrect. 16:16:06 Error in expression <ry) }; _cnt = {alive _x} count thisList [hmmv_1,hmmv_2,hmmv_3,hmmv_4]; if (_cnt > 16:16:06 Error position: <[hmmv_1,hmmv_2,hmmv_3,hmmv_4]; if (_cnt > 16:16:06 Error Missing ; What is the correct method of using count to determine this using an array? Share this post Link to post Share on other sites
Guest Posted May 16, 2016 would it just be _cnt = {alive _x} count [hmmv_1,hmmv_2,hmmv_3,hmmv_4]; ? Share this post Link to post Share on other sites
slendermang 2 Posted May 16, 2016 would it just be _cnt = {alive _x} count [hmmv_1,hmmv_2,hmmv_3,hmmv_4]; ? It would appear you're correct. It seems I misunderstood thisList, I assumed it was to specify arrays. Upon re-reading it just means all units in a trigger's radius? However now it tells me 16:52:06 Error in expression <0and%20Kings.lingor3\alivecheck.sqf" [] spawn waitUntil { sleep 1; time > 0; };> 16:52:06 Error position: <spawn waitUntil { sleep 1; time > 0; };> Looking at another example [] spawn { waitUntil {something}; hint "cache 1 is down"; }; [] spawn { waitUntil {something different thats possible at the same time}; hint "cache 2 is down"; }; It looks right? EDIT: Woops! I forgot to enclose it in brackets as a new scheduled script. Share this post Link to post Share on other sites
killzone_kid 1326 Posted May 16, 2016 nvm, OP edited already. Share this post Link to post Share on other sites