aaronhance 1 Posted August 17, 2013 I've tried the below, but no luck. this addEventHandler ["HandleDamage", {if (_this select 3 in ["hgun_P07_F"]) then {_this select 0}}]; Also if you have the time - http://forums.bistudio.com/showthread.php?161706-Need-help-with-vehicle-spawn-script Share this post Link to post Share on other sites
Coding 12 Posted August 17, 2013 maybe this works: this addEventHandler ["HandleDamage", {_dmg = _this select 2;if (_this select 3 in ["hgun_P07_F"]) then {_dmg=0;}_dmg;}]; Share this post Link to post Share on other sites
Larrow 2828 Posted August 17, 2013 (edited) this addEventHandler ["HandleDamage", {if (_this select 3 in ["hgun_P07_F"]) then {[color="#FF0000"]0[/color]}else{ _this select 2}]; Just 0. quoteing the WIKI. Adding this eventhandler with no return value or with return value 0, replaces damage handling by the engine, making the object invulnerable if damage is not scripted in the eventhandler. If you want default processing to be done, be sure to return _this select 2. Also _this select 3 does not return the weapon fired but the unit that done the firing, you will need to find another way of discovering the weapon type. Edited August 17, 2013 by Larrow Share this post Link to post Share on other sites
aaronhance 1 Posted August 17, 2013 [/color] this addEventHandler ["HandleDamage", {if (_this select 3 in ["hgun_P07_F"]) then {[color="#FF0000"]0[/color]}else{ _this select 2}]; Just 0. quoteing the WIKI. Also _this select 3 does not return the weapon fired but the unit that done the firing, you will need to find another way of discovering the weapon type. Tried it, but it does not work, :( Share this post Link to post Share on other sites
Larrow 2828 Posted August 17, 2013 I only checked the return value was correct first time i looked at your code, I added shortly afterwards that select 3 was wrong for checking the weapon used as it only returns the unit that caused the damage. You will need to use this units current weapon to check against, something like this addEventHandler ["HandleDamage", {if ((currentWeapon (_this select 3)) in ["hgun_P07_F"]) then {0}else{ _this select 2}]; Share this post Link to post Share on other sites
aaronhance 1 Posted August 17, 2013 I only checked the return value was correct first time i looked at your code, I added shortly afterwards that select 3 was wrong for checking the weapon used as it only returns the unit that caused the damage. You will need to use this units current weapon to check against, something likethis addEventHandler ["HandleDamage", {if ((currentWeapon (_this select 3)) in ["hgun_P07_F"]) then {0}else{ _this select 2}]; I changed it to _this select 4 and put in the ammo class name. I've been using this http://forums.bistudio.com/showthread.php?113418-HandleDamage-EH-explained-%28-poor-man-s-getHit%29&highlight=event%20handler Share this post Link to post Share on other sites