I would like to know the correct way to check a monster's life.
The way I do, crash server.
The way I do, crash server.
LUA:
function onStatsChange(cid, attacker, type, combat, value)
if not isPlayer(attacker) then
return true
end
local pos_msg = getCreaturePosition(cid)
if (getCreatureName(cid) == "Demon") then
local lifePercent = 100 / (getCreatureMaxHealth(cid) / getCreatureHealth(cid))
if getGlobalStorageValue(cid, 30074) == 6 then
if (lifePercent <= 10) then
setGlobalStorageValue(cid, 30074, 7)
doCreatureSay(cid, "TEST!", TALKTYPE_ORANGE_1, false, 0, pos_msg)
doCreateMonster("Demon", pos_msg, false, true);
end
end
end
return true
end