Jump to content

Recommended Posts

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

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

 

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
×
  • Create New...