kittycat 0 Posted March 23, 2007 How to setup a "hit" eventhandler correctly? I want the car that is hit to report the damage based on the below condition. Quote[/b] ]?( getdammage (_this select 0) > 0.01): t1 exec "dammage_check.sqs"exit Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted March 23, 2007 I wrote some stuff back in the day on eventHandlers for ofp here. You'll want to substitue comref with biki, but other than that, pretty much all the information in that thread is still relevent word for word in arma today. There's also a few very informative posts by others in there too, so be sure and look at them as well. BTW, I wouldn't go replying in that old thread. It's long dead and should probably stay that way . Share this post Link to post Share on other sites
Big Dawg KS 6 Posted March 23, 2007 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">unit addEventHandler ["hit",{if(getdammage (_this select 0) > 0.01)then{t1 exec "dammage_check.sqs"}}]; You should probably take advantage the rest of the '_this' array (there are 3 items for hit; the unit that was hit, the unit that fired the round (if nobody fired it then this is just the unit that was hit again), and the damage the hit causes). Share this post Link to post Share on other sites
kittycat 0 Posted March 24, 2007 I have tried this in init.sqs Quote[/b] ]t1 addEventHandler ["hit",{[t1] exec "truck_blast.sqs"}]******* _unit = _this slect 0 _shooter = _this slect 1 _damage = _this slect 2 player globalChat format["Unit Firing: ""%1""", _unit] player globalChat format["weapon: ""%1""" , _shooter ] player globalChat format["muzzle: ""%1""" , _damage ] exit wont work Share this post Link to post Share on other sites
kittycat 0 Posted March 24, 2007 oh id does actaually work on soldiers. However I want it to work on cars. looks like hit eventhandlers wont react on cars getting fired at with rifles Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted March 24, 2007 Out of curiosity, does it work with cars getting hit by say, an rpg? Probably not, if rifles don't. That's interesting though. Wonder if it's a bug? Share this post Link to post Share on other sites
shuko 59 Posted March 24, 2007 _unit = _this slect 0_shooter = _this slect 1 _damage = _this slect 2 I guess thats a direct copy paste, so might wanna fix the typo. slect != select Share this post Link to post Share on other sites
Big Dawg KS 6 Posted March 25, 2007 oh id does actaually work on soldiers. However I want it to work on cars. looks like hit eventhandlers wont react on cars getting fired at with rifles Rifles don't cause enough damage on cars is why. The hit EH only fires when significant damage is done. Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted March 25, 2007 oh id does actaually work on soldiers. However I want it to work on cars. looks like hit eventhandlers wont react on cars getting fired at with rifles Rifles don't cause enough damage on cars is why. The hit EH only fires when significant damage is done. Ohh, nm. I misread what you said. Thought you said "Rifles don't cause damage on cars is why". --------------------------- Will the "dammaged" event handler work in place of the "hit" event handler? The difference is slight, but the information passed is different. Depends on what you're needing to do. Share this post Link to post Share on other sites