eclipsespectrum Posted December 2, 2019 Share Posted December 2, 2019 Hello! I'm helping a friend create a mod for her character, and one of the perks I'd like to add is that her character takes more damage from lightning strikes because of his metal arms. I'm not the greatest at coding, so any help with how to make this possible would be really great! Link to comment Share on other sites More sharing options...
Yakuzashi Posted December 5, 2019 Share Posted December 5, 2019 (edited) 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 December 5, 2019 by Yakuzashi I have messed up something Link to comment 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