Under Influence
Advanced OT User
- Joined
- Jul 27, 2009
- Messages
- 152
- Reaction score
- 167
Can some one explain to me why the console gives me: LuaScriptInterface::luaDoRemoveItem(). Item not found
This is a script to make a spell which the player leaves a blue flame and if he uses the same spell within 5 seconds he will be teleported to the flame that was left. Also is it possible to read the timeleft from addEvent, so I can show a message with the cooldown time left?
I am a LUA scripting newbie by the way
This is a script to make a spell which the player leaves a blue flame and if he uses the same spell within 5 seconds he will be teleported to the flame that was left. Also is it possible to read the timeleft from addEvent, so I can show a message with the cooldown time left?
I am a LUA scripting newbie by the way
Code:
BLUE_FLAME = 1397
function onCastSpell(cid, var)
local pos = getPlayerPosition(cid)
local storage = getPlayerStorageValue(cid, BLUE_FLAME)
local thyitem
if storage > 0 then
doSendMagicEffect(pos, 10)
doTeleportThing(cid, getThingPos(storage))
doRemoveItem(storage)
setPlayerStorageValue(cid,BLUE_FLAME,0)
doSendMagicEffect(getThingPos(storage), CONST_ME_MAGIC_GREEN)
elseif storage == 0 then
doSendMagicEffect(pos, CONST_ME_POFF)
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
else
thyitem = Game.createItem(BLUE_FLAME, 1, pos)
setPlayerStorageValue(cid,BLUE_FLAME,thyitem)
addEvent(onBackTeleportField, 5 * 1000, pos,cid)
end
end
function onBackTeleportField(position,cid)
local storage = getPlayerStorageValue(cid, BLUE_FLAME)
if storage > 0 then
doRemoveItem(storage)
end
setPlayerStorageValue(cid,BLUE_FLAME,-1)
end
Last edited: