tophe 69 Posted July 3, 2009 I have this statement on a vehicle: if ((getDammage _unit > 0.1) and (count crew _unit == 0)) then {doStuff}; That will have the script doStuff when the vehicle is damaged and empty. But if the crew is killed and left inside the vehicle this won't return the true-value. Since dead crew still counts as crew. So what I need is something like this: if ((getDammage _unit > 0.1) and (count [b]alive [/b]crew _unit == 0)) then {doStuff}; I hope you know what I'm after. Any ideas on the syntax for such a statement? Share this post Link to post Share on other sites
Tajin 349 Posted July 3, 2009 This should do the job.: if ((getDammage _unit > 0.1) and ("alive _x" count crew _unit == 0)) then {doStuff}; see here: http://www.arma2.com/comref/full.html#CodecountArray Share this post Link to post Share on other sites
buliwyf 4 Posted July 3, 2009 Tajin posted a code working in OFP, but no longer in ArmA/ArmA2... So try this: if ((getDammage _unit > 0.1) and ([b]{[/b]alive _x[b]}[/b] count crew _unit == 0)) then {doStuff}; btw: What about an EventHandler "HIT" or "DAMAGE" to run your doStuff? Only an idea... :rolleyes: Share this post Link to post Share on other sites
tophe 69 Posted July 3, 2009 Thanks guys! I'll try these settings. I try to stay away from eventhandlers in this script. To make it as easy as possible to setup for any user. I only want the user having to execute the script on a unit, nothing more. If I went to eventhandlers I also would have to rewrite the whole script, since it checks for all kinds of things, not only damage and crew. Share this post Link to post Share on other sites
Tajin 349 Posted July 3, 2009 Tajin posted a code working in OFP, but no longer in ArmA/ArmA2... Oooops! Copy&Past can be a bitch :p Share this post Link to post Share on other sites