• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Learn spell script.

Swij

Active Member
Joined
Mar 2, 2009
Messages
120
Reaction score
40
Location
Sweden, Jönköping
Hello there!
Xampy solved it! heres the working script :D

Lua:
local spellItemID = 8981
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 \"Exevo vis rage\" to test it."
local Druidwords = "You've learned the Nature rage spell say \"Exevo pox rage\" to test it."
local Paladinwords = "You've learned the Holy rage spell say \"Exevo san rage\" to test it."
local Knightwords = "You've learned the Physical rage spell say \"Exevo hur rage\" 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

Rep++ to the ones who help!
 
Last edited:
There seems to be one more problem! when im using this item that is supposed to learn a spell, it gives the "Sorry, your not over level 250" message even though i'm well over level 250!
 
Try:

Lua:
local spellItemID = 8981
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 \"Exevo vis rage\" to test it."
local druidwords = "You've learned the Nature rage spell say \"Exevo pox rage\" to test it."
local Paladinwords = "You've learned the Holy rage spell say \"Exevo san rage\" to test it."
local Knightwords = "You've learned the Physical rage spell say \"Exevo hur rage\" to test it."
local Sorcerer = {1, 5}
local Druid = {2, 6}
local Paladin = {3, 7}
local Knight = {4, 8}
local level = 250

function onUse(cid, item, frompos, item2, topos)
        if item.itemid == spellItemID and getPlayerVocation(cid) == Sorcerer and getPlayerLevel(cid) >= level then
                playerLearnInstantSpell(cid, "Energy Rage")
                doCreatureSay(cid, Sorcererwords, 19)
                doRemoveItem(cid, item.uid, 1)
        elseif item.itemid == spellItemID and getPlayerVocation(cid) == Druid and getPlayerLevel(cid) >= level then
                playerLearnInstantSpell(cid, "Nature Rage")
                doCreatureSay(cid, Druidwords, 19)
                doRemoveItem(cid, item.uid, 1)
        elseif item.itemid == spellItemID and getPlayerVocation(cid) == Paladin and getPlayerLevel(cid) >= level then
                playerLearnInstantSpell(cid, "Holy Rage")
                doCreatureSay(cid, Paladinwords, 19)
                doRemoveItem(cid, item.uid, 1)
        elseif item.itemid == spellItemID and getPlayerVocation(cid) == Knight and getPlayerLevel(cid) >= level then
                playerLearnInstantSpell(cid, "Physical Rage")
                doCreatureSay(cid, Knightwords, 19)
                doRemoveItem(cid, item.uid, 1)
        else
                doPlayerSendCancel(cid, Cancelwords)
        end
        return 1
end

Regards :)
 
Last edited:
Okey, sorry for the missed end ^_^ xD

Try this one:

Lua:
local spellItemID = 8981
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 \"Exevo vis rage\" to test it."
local Druidwords = "You've learned the Nature rage spell say \"Exevo pox rage\" to test it."
local Paladinwords = "You've learned the Holy rage spell say \"Exevo san rage\" to test it."
local Knightwords = "You've learned the Physical rage spell say \"Exevo hur rage\" 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
 
Thank you soo much! i can see that all of my locals were a bit too much and that you solution is much better :D! but atleast i learned alot of lua today from working on this script :D. and by the way, i can't belive that you guys spend so much time on helping us noobs with our crappy scripts! I hope rep++ is a reward good wnough for you :D!
 

Similar threads

Back
Top