Pappy60 10 Posted October 2, 2009 (edited) Okay, I am trying to write a script that will check a helo for damage every 2 seconds and if it has damage equal to or greater than 0.8 playSound "calarm" which will play a cockpit alarm I stole this from the armaholic respawn script but don't know how to make it loop.... sleep 2; if ((getDammage _vehicle ==> 0.8) and ({alive _x} count crew _unit > 0)) then playSound "calarm"; Edited October 2, 2009 by Pappy60 Share this post Link to post Share on other sites
Big_Daddy 10 Posted October 2, 2009 while while {alive _vehicle} do { if ((getDammage _vehicle ==> 0.8) and ({alive _x} count crew _unit > 0)) then playSound "calarm"; sleep 2; }; Share this post Link to post Share on other sites
Pappy60 10 Posted October 2, 2009 okay I tried that with a couple of what I thought were corrections but it is not working....I changed "count crew _units to count crew _vehicle...could that be the issue? I have cockpit.sqf with this: while (alive _vehicle) do ( if ((getDammage _vehicle ==> 0.1) and ((alive _x) count crew _vehicle > 0)) then playSound "calarm"; sleep 2; ); and the helo init is : veh = [this] execVM "cockpit.sqf" PS I am not getting any errors either...seems like it never becomes true..... Share this post Link to post Share on other sites
Big_Daddy 10 Posted October 2, 2009 (edited) ahh, that would have helped.. :) You have to tell it what _vehicle is.. Heh, I thought you got the line from a working script.. errors, yes, I see where you'd get errors now. Fixed: _vehicle = _this select 0; while {alive _vehicle} do { if ((getDammage _vehicle >= 0.8) && (({alive _x} count crew _vehicle) > 0)) then {playSound "calarm";}; sleep 2; }; Edited October 2, 2009 by Big_Daddy Share this post Link to post Share on other sites
ProfTournesol 956 Posted October 2, 2009 well, ==> doesn't mean anything IMO. Use >= instead. Share this post Link to post Share on other sites
Pappy60 10 Posted October 2, 2009 (edited) okay you were correct that did fix it and it is all working, thank you ! I do learn from this...just a matter of time, help from guys like you and a whole lot of patience Edited October 2, 2009 by Pappy60 Share this post Link to post Share on other sites