Thought this was something simple and what I have done before but I cannot make the plane invulnerable
My code:
(vehicle player) addEventHandler ["HandleDamage",
{
params ["_veh","_section","_damage","_unit","_cause"];
_dam = 0;
_dam
}];
But the plane I'm flying explodes on too hard ground impact
I dont want to use allowdamage because eventually I want to reduce the damage not completely remove
any ideas?
thx!
I think that it's working this way :
Ps is 4:00 in the morning !
I can't test this further !
GF_HD_HitPart = {
_this addEventHandler ["HitPart", {
(_this select 0) params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"];
// [_target,false]remoteExec["allowDamage",_target];
_damage = damage _target;
systemchat format ["_damage %1",_damage];
if!(_target getVariable ["Var_GF_HD_HitPart_EH",false])then{
_new_damage = _damage / 2;
_target setDamage _new_damage;
systemchat format ["setDamage %1",_new_damage];
_target setVariable ["Var_GF_HD_HitPart_EH",true];
};
}];
};
[]spawn{
while{true}do{
waitUntil{uisleep 1;
{
if(
(alive _x)
&& (!(_x getVariable ["Var_GF_HD_HitPart",false]))
)then{
_x spawn GF_HD_HitPart;
};
_x setVariable ["Var_GF_HD_HitPart",true];
}forEach vehicles;
};
};
};