Moj mistrz
Monster Creator
Hello, it's me again. I've got some problem with one-time healing script, it's creaturescript and I'm trying to use globalstorage(dunno if correct) to make it work, but with no success.
ERROR
Basically I want monster to heal once when hp drops to 10%(or if possible to 0%, so when it should die - it wont, but heal for 5k hp), if not killed, but healed once for 5k global storage could remove in 30 mins so it can be healed again for 5k when hp drops to 0. Hope you get what I mean. 
Thanks for any help.
#edit
Is there any way to make spell which grants you/monster permanent invisible unless there's under you/monster a poison field? If yes, could someone make that spell?
Thanks.
#edit2
I've made something like this, but I wonder if there's in theforgottenserver-v0.2.15-win32gui (setHiddenHealth()) available. Ty for help.
or this
Code:
local running = false
function onThink(cid)
local hp = (getCreatureHealth(cid)/getCreatureMaxHealth(cid))*100
if (hp < 10 and not running) then
if getGlobalStorageValue(21342) ~= -1 then
return end
running = true
addEvent(removeStorage, 1000, cid)
end
end
function removeStorage(cid)
running = false
doCreatureAddHealth(cid, 5000)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
setGlobalStorage(21342, 1)
return true
end
Code:
[04/05/2014 13:33:48] Lua Script Error: [CreatureScript Interface]
[04/05/2014 13:33:48] in a timer event called from:
[04/05/2014 13:33:48] data/creaturescripts/scripts/test heal.lua:onThink
[04/05/2014 13:33:49] data/creaturescripts/scripts/test heal.lua:16: attempt to call global 'setGlobalStorage' (a nil value)
[04/05/2014 13:33:49] stack traceback:
[04/05/2014 13:33:49] [C]: in function 'setGlobalStorage'
[04/05/2014 13:33:49] data/creaturescripts/scripts/test heal.lua:16: in function <data/creaturescripts/scripts/test heal.lua:12>
Thanks for any help.
#edit
Is there any way to make spell which grants you/monster permanent invisible unless there's under you/monster a poison field? If yes, could someone make that spell?
Thanks.
#edit2
Code:
function onThink(cid)
local monster = Monster(cid)
local hp = (getCreatureHealth(cid)/getCreatureMaxHealth(cid))*100
if (hp < 99.99) and getCreatureName(cid) == "Zavarash" then
monster:setHiddenHealth(not monster:isHealthHidden())
elseif getCreatureCondition(cid, CONDITION_POISON) then
monster:addCreatureHealth()
return false
end
end
or this
Code:
function onThink(cid, param)
local monster = Monster(cid)
local isGhost = not monster:isInGhostMode()
local position = monster:getPosition()
local hp = (getCreatureHealth(cid)/getCreatureMaxHealth(cid))*100
if (hp < 99.99) and getCreatureName(cid) == "Zavarash" then
monster:setGhostMode(isGhost)
if isGhost then
position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
elseif getCreatureCondition(cid, CONDITION_POISON) then
end
return false
end
end