TragedyTurtle Posted October 28, 2019 Share Posted October 28, 2019 How do I make an armor have 100% damage absorption against mobs with a special tag and have the armor have x damage absorption against all other mobs without that tag? I've tried meddling with armorhit and onattack, but it didn't work out for me. xD Link to comment Share on other sites More sharing options...
Ultroman Posted October 30, 2019 Share Posted October 30, 2019 Extend the GetAbsorption function of the armor's armor component. Make it check whether the attacker has your tag, and if so, return 1.0. Otherwise, return whatever value the original function would give. Put this at the bottom of the fn() for the armor prefab. local oldGetAbsorption = inst.components.armor.GetAbsorption inst.components.armor.GetAbsorption = function(self, attacker, weapon) if attacker:HasTag("mytag") then return 1.0 end return oldGetAbsorption(self, attacker, weapon) end Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now