Jump to content

Recommended Posts

I've been trying to make a character that only takes one damage from attacks. I've been avoiding health absorption because it is inconsistent, but the method I have currently makes it so that they don't take damage at all. How do I control how much damage a character takes from all attacks?

 

local function shielder(inst, data)
	inst.components.health:DoDelta(-1)
end

inst.components.health.absorb = 1

inst:ListenForEvent("attacked", shielder)

 

Link to comment
https://forums.kleientertainment.com/forums/topic/136796-super-armor/
Share on other sites

You can do this by overriding the GetAttacked function to always use 1 as the damage.

local oldGetAttacked = inst.components.combat.GetAttacked

inst.components.combat.GetAttacked = function(self, attacker, damage, weapon, stimuli)
	return oldGetAttacked(self, attacker, 1, weapon, stimuli)
end

 

  • Like 1

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...