Jump to content

Recommended Posts

Hello. What I want to do is, if the caster doesnt have 5 Spellenergy in his container, he loses 50 health. The code works perfectly with sanity but as soon as I put in health nothing happens anymore when not having enough Spell energy. Why does it work with Sanity and not with Health?

 

local function onblink(inst, owner, caster)
   
    if inst.components.container:Has("spellenergy",5) then
        inst.components.container:ConsumeByName("spellenergy", 5)
    print('if')
    else
        caster.components.health:DoDelta(-50) -- swapping health for sanity works
            print('else')
end
end    
Edited by igel69

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