igel69 Posted December 25, 2021 Share Posted December 25, 2021 (edited) 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 December 25, 2021 by igel69 Link to comment https://forums.kleientertainment.com/forums/topic/136491-need-help-with-one-line-of-code-component-health-doesnt-get-subtracted/ 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