Jump to content

Recommended Posts

24 minutes ago, SuperDavid said:

@Shinoryoshu It'd be a lot easier for me if you post your character here then I can see what's wrong & fix it or if you can tell me what's the crash then I can help you.

Also, did your character start crashing when you put this code


inst:ListenForEvent("lightningstrike", function(inst, data)

if not inst.alreadylightningdamage then -- you can save any name you want in inst. but it is not saved when leaving the game
    inst.alreadylightningdamage = true -- save that we already gave him the bonus, so this will only work once per session. This will be deleted in a new session automatically
    inst.components.combat.damagemultiplier = inst.components.combat.damagemultiplier * 1.5 -- 50% boost when strike by lightning
    inst.components.talker:Say("I feel so alive!")
    inst:AddTag("electricdamageimmune") -- Immune to electric damage.
    inst.components.burnable.lightningimmune = true -- Immune to lightning.
    local x, y, z = inst.Transform:GetWorldPosition() -- Cool effect.
    SpawnPrefab("sparks").Transform:SetPosition(x, y, z) -- Cool effect.
end

end)

in it?

You have to put the code above under this code


local master_postinit = function(inst)

in your character.lua if you did that & it crashes then that's really strange because that shouldn't happen.

 

nora.lua

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