memofighter
New Member
- Joined
- Mar 11, 2010
- Messages
- 10
- Reaction score
- 0
Hey there!
I've just started practicing Lua and it isn't going very well xD
I'm trying some things out with a lever, but when I use the lever ingame, it doesn't work. It just moves but I don't get any mana or a message.
This is the script I'm using:
File in actions.XML:
I've added the unique id in my map editor.
Does anyone see what I'm doing wrong?
Kind Regards, Memo
I've just started practicing Lua and it isn't going very well xD
I'm trying some things out with a lever, but when I use the lever ingame, it doesn't work. It just moves but I don't get any mana or a message.
This is the script I'm using:
Code:
function onUse(cid, item, frompos, item2, topos)
local mana = 50
if item.uid == 2020 and item.itemid == 1945 then
doTransformItem(item.uid, item.itemid + 1)
doCreatureAddMana(cid,mana)
doCreatureAddHealth(cid,mana)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid), "Mana Up!", TEXTCOLOR_ORANGE)
elseif item.uid == 2020 and item.itemid == 1946 then
doTransformItem(item.uid, item.itemid -1)
doCreatureAddMana(cid,mana)
doCreatureAddHealth(cid,mana)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid),"Mana Up!",TEXTCOLOR_ORANGE)
end
return TRUE
end
Code:
<action itemid="2020" event="script" value="tools/addmana.lua"/>
I've added the unique id in my map editor.
Does anyone see what I'm doing wrong?
Kind Regards, Memo
Last edited by a moderator: