bigshot 64 Posted November 17, 2020 Im working on updating my Duws mission, and have a scenario where you need to find the enemy HQ building and kill the officer inside of it...but I dont want players just blowing up the building from afar with rockets or bomb drops from Jtac for that matter. it would be played best if they could only kill him with any sort of bullets. While I already made the building itself indestructible he still dies from impact blasts from bombs and rockets. Is there any way to script it so that he will only take damage from bullets, or a small hand grenade? (taking him from a distance via sniper rifle is also ok). Share this post Link to post Share on other sites
wogz187 1086 Posted November 18, 2020 @bigshot, Disable damage on the NPC, this allowDamage false; The NPC will need a "hitPart" Event handler, this addEventHandler ["HitPart", { (_this select 0) params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"]; if (_isDirect) then {_target setDamage 1}; }]; Other parameters ("_projectile", "_ammo") may be better than simply "_isDirect" but it's a start. Have fun! 2 Share this post Link to post Share on other sites
bigshot 64 Posted November 18, 2020 Thanks very much for this idea!... will have a go at it, although it says this EH wont run unless the shooter is local to the EH. How might I get this to work if the server is a hosted one (non dedi) and a connected client makes the shot? Share this post Link to post Share on other sites
wogz187 1086 Posted November 18, 2020 @bigshot, Looking deeper into this it seems like the description for MPHit is exactly what you need. Same thing, this allowDamage false; Add MPHit EH andHandleDamage EH as per MPHit description. Have fun! 1 Share this post Link to post Share on other sites
pierremgi 4906 Posted November 18, 2020 In init field of the unit to be shot by rifle/gun only this addEventHandler ["handleDamage",{ params ["", "", "_damage", "", "_projectile"]; private _dam = 0; if (_projectile isKindOf "BulletBase") then {_dam = _damage}; _dam }]; 2 Share this post Link to post Share on other sites