Jump to content

Recommended Posts

Hi,

I'm making a custom character + item mod, and I want the weapon to give +10 HP to the user when they attack/hit.

I found some topics here and there similar to this, but wasn't able to put it to use because it was for much more complex situations. For example I found one where the lifesteal was percentage based on damage dealt or other more complicated events required to trigger lifesteal. And as a beginner it was hard to extract exactly what I needed to get the "simple" lifesteal to work.

I simply want the weapon to heal 10HP to user when hitting. No other conditions needed.

TYIA,

It's easily done with a SetOnAttack function added to your weapon:

--weapon prefab
local function Heal(inst,attacker,target)
	if attacker and attacker.components.health then
		attacker.components.health:DoDelta(10)
	end
end

--fn of the weapon after the ismastersim check
inst.components.weapon:SetOnAttack(Heal)

 

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