Maten
New Member
- Joined
- Mar 16, 2009
- Messages
- 219
- Reaction score
- 2
hi i tried to put this in my action.xml
and this in Learn.lua
I dont get any errors but when i use the scroll it sayas that the player learn a new spell but when they try out the spell it says "you have to learn this spell first"
where is the problem?
Code:
<action itemid="2345" event="script" value="other/Learn.lua"/>
and this in Learn.lua
Code:
local spellItemID = 2345
local Cancelwords = "You need to have a vocation and be over level 250 to read this book."
local Sorcererwords = "You've learned the Energy rage spell say \"apo\" to test it."
local Druidwords = "You've learned the Nature rage spell say \"colo\" to test it."
local Paladinwords = "You've learned the Holy rage spell say \"drunk san\" to test it."
local Knightwords = "You've learned the Physical rage spell say \"Exo\" to test it."
local reqLevel = 250
function onUse(cid, item, frompos, item2, topos)
if item.itemid == spellItemID and (getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5) and getPlayerLevel(cid) >= reqLevel then
playerLearnInstantSpell(cid, "Energy Rage")
doCreatureSay(cid, Sorcererwords, 19)
doRemoveItem(cid, item.uid, 1)
elseif item.itemid == spellItemID and (getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6) and getPlayerLevel(cid) >= reqLevel then
playerLearnInstantSpell(cid, "Nature Rage")
doCreatureSay(cid, Druidwords, 19)
doRemoveItem(cid, item.uid, 1)
elseif item.itemid == spellItemID and (getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7) and getPlayerLevel(cid) >= reqLevel then
playerLearnInstantSpell(cid, "Holy Rage")
doCreatureSay(cid, Paladinwords, 19)
doRemoveItem(cid, item.uid, 1)
elseif item.itemid == spellItemID and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) and getPlayerLevel(cid) >= reqLevel then
playerLearnInstantSpell(cid, "Physical Rage")
doCreatureSay(cid, Knightwords, 19)
doRemoveItem(cid, item.uid, 1)
else
doPlayerSendCancel(cid, Cancelwords)
end
return 1
end
I dont get any errors but when i use the scroll it sayas that the player learn a new spell but when they try out the spell it says "you have to learn this spell first"
where is the problem?