• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How to keep track of actual player health inside spell script

BulawOw

Soul of Shinobi
Joined
Sep 15, 2014
Messages
204
Solutions
8
Reaction score
62
Lua:
function onCastSpell(creature, variant)
    local playerHealth = creature:getHealth()
end

So the code i show u will only get actual creature health on cast spell but i want to make the spell to keep track of actual health and if creature health == maxHealth something happend

Can somebody help me with this one ?
 
creature:getHealth() == creature:getMaxHealth()? You need to provide more details, what do you mean by "keep track"?
 
creature:getHealth() == creature:getMaxHealth()? You need to provide more details, what do you mean by "keep track"?
Lua:
function onCastSpell(creature, variant) -- So when player cast spell
    local playerHealth = creature:getHealth() -- It have to update this variable lets say each second and if this variable gonna be same as playerMaxHealth it will do the code below
    local playerMaxHealth = creature:getMaxHealth()
   
    if (playerHealth == playerMaxHealth) then
        something will happend
    end

end
 
Back
Top