Jump to content

How do I make an armor have 100% damage absorption against certain mobs?


Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...