Jump to content

Lightning Causing more Damage Character Mod


Recommended Posts

Hi. Add this into your [character's.name].lua (main folder->scripts->X)

Above local master_postinit
 

local function fullmetalarms(inst)
    if inst.components.health ~= nil and not (inst.components.health:IsDead() or inst.components.health:IsInvincible()) then
        if not inst.components.inventory:IsInsulated() then
		    local value = 1.75
            local mult = TUNING.ELECTRIC_WET_DAMAGE_MULT * inst.components.moisture:GetMoisturePercent()
            local damage = (TUNING.LIGHTNING_DAMAGE * value) + mult * TUNING.LIGHTNING_DAMAGE

            inst.components.health:DoDelta(-damage, false, "lightning")
            inst.sg:GoToState("electrocute")
        else
            inst:PushEvent("lightningdamageavoided")
        end
    end
end

(Lightning strike will deal extra 75% of base damage. If you need to change it just swap value "1.75" to something else.)

Inside local master_postinit

(Somewhere at the end of function)

Quote

    inst.components.playerlightningtarget:SetOnStrikeFn(fullmetalarms)

And that's all.

Edited by Yakuzashi
I have messed up something
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...