Jump to content
Sign in to follow this  
Pappy60

looping damage check script

Recommended Posts

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 by Pappy60

Share this post


Link to post
Share on other sites

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

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

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 by Big_Daddy

Share this post


Link to post
Share on other sites

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 by Pappy60

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×