asvinh Posted September 25, 2021 Share Posted September 25, 2021 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, Link to comment https://forums.kleientertainment.com/forums/topic/133955-need-help-adding-lifesteal-to-custom-weapon/ Share on other sites More sharing options...
Monti18 Posted September 26, 2021 Share Posted September 26, 2021 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) 1 Link to comment https://forums.kleientertainment.com/forums/topic/133955-need-help-adding-lifesteal-to-custom-weapon/#findComment-1498376 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