FunnyCookieEver 1 Posted October 14, 2018 Is there any way to make enemy plane vulnerable only by player? Player is on the plane to specify. I want to make this because there are a lot of AAA on the ground, that are made to shoot very badly but they are still hitting enemy planes. Or the other way to make so, that turrets don't cause damage. Share this post Link to post Share on other sites
stanhope 411 Posted October 14, 2018 this addEventHandler ["HandleDamage", { params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"]; if (!(isPlayer _source || isPlayer _instigator)) then { _damage = 0; }; _damage }]; Untested 1 Share this post Link to post Share on other sites
FunnyCookieEver 1 Posted October 14, 2018 That didn't work Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted October 14, 2018 17 minutes ago, FunnyCookieEver said: That didn't work What exactly didn't work? The plane stops taking damage, as intended. If you also want to make the vehicles crew immune to any damage (explosions, piercing ammo, etc) where a player is not the damage source you'll have to handle that separately. Cheers Share this post Link to post Share on other sites
stanhope 411 Posted October 14, 2018 28 minutes ago, FunnyCookieEver said: That didn't work What exactly did it not do? I wrote that while writing on a java program at the same time so it's entirely possible that it there is something wrong wit it. If you want both the plane and the pilot not to take damage you can run something along these lines: private _EHCode = ["HandleDamage", { params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"]; if (!(isPlayer _source || isPlayer _instigator)) then { _damage = 0; }; _damage }]; _plane addEventHandler _EHCode; (driver _plane) addEventHandler _EHCode; Or is there a problem with the code itself? As mentioned I didn't test it so it's certainly possible. Share this post Link to post Share on other sites
FunnyCookieEver 1 Posted October 14, 2018 Thanks. I just didn't notice that the problem was with the pilot. Now it's working. Share this post Link to post Share on other sites