• 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!

[FIX] You need to buy spells to be able to use them.

Eldora

Banned User
Joined
Oct 19, 2009
Messages
604
Reaction score
26
How can i fix that you need to buy spells from a NPC to be able to use them?
I have forgot how to enable that.

Using Avesta, anyone know?
 
in spells.xml turn needlearn to "1". This means you need to learn the spell before using it.
Then you gotta config an npc, item or whatever you want to learn the spells.

example of the npc in case you didn't have one yet

Lua:
local keywordHandler = KeywordHandler:new() 
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler) 
local talkState = {} 
function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid)                        end 
function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid)                     end 
function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg)                end 
function onThink()                                      npcHandler:onThink()                                    end 
function creatureSayCallback(cid, type, msg) 
        if(not npcHandler:isFocused(cid)) then 
                return false 
        end 
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid         
local spells = { 
                [1] = {spell_name = "Antidote" ,price = 150, words = 'EXANA POX', number = 1}, 
                [2] = {spell_name = "Berserk" ,price = 2500, words = 'EXORI', number = 2}, 
                [3] = {spell_name = "Blood Rage" ,price = 8000, words = 'UTITO TEMPO', number = 3}, 
                [4] = {spell_name = "Challenge" ,price = 2000, words = 'EXETA RES', number = 4}, 
                [5] = {spell_name = "Charge" ,price = 1300, words = 'UTANI TEMPO HUR', number = 5}, 
                [6] = {spell_name = "Fierce Berserk" ,price = 5000, words = 'EXORI GRAN', number = 6}, 
                [7] = {spell_name = "Find Person" ,price = 80, words = 'EXIVA', number = 7}, 
                [8] = {spell_name = "Great Light" ,price = 500, words = 'UTEVO GRAN LUX', number = 8}, 
                [9] = {spell_name = "Groundshaker" ,price = 1500, words = 'EXORI MAS', number = 9}, 
                [10] = {spell_name = "Haste" ,price = 600, words = 'UTANI HUR', number = 10}, 
                [11] = {spell_name = "Levitate" ,price = 500, words = 'EXANI HUR', number = 11}, 
                [12] = {spell_name = "Light" ,price = 100, words = 'UTEVO LUX', number = 12}, 
                [13] = {spell_name = "Light Healing" ,price = 170, words = 'EXURA', number = 13}, 
                [14] = {spell_name = "Magic Rope" ,price = 200, words = 'EXANI TERA', number = 14}, 
                [15] = {spell_name = "Protector" ,price = 6000, words = 'UTAMO TEMPO', number = 15}, 
                [16] = {spell_name = "Train Party" ,price = 4000, words = 'UTITO MAS SIO', number = 16}, 
                [17] = {spell_name = "Whirlwind Throw" ,price = 800, words = 'EXORI HUR', number = 17}, 
                [18] = {spell_name = "Wound Cleansing" ,price = 300, words = 'EXANA MORT', number = 18}, 
                }     
for i = 1, #spells do 
    if msgcontains(msg, spells[i].spell_name) then 
        if getPlayerLearnedInstantSpell(cid, spells[i].spell_name) == false then 
            npcHandler:say("Would you like to buy "..spells[i].spell_name.." for "..spells[i].price.." gold?", cid) 
            talkState[talkUser] = spells[i].number 
        else 
            npcHandler:say("You already know how to cast this spell.", cid) 
        end 
    elseif msgcontains(msg, 'yes') then 
        if talkState[talkUser] == spells[i].number then 
            if getPlayerMoney(cid) >= spells[i].price then 
                doPlayerRemoveMoney(cid, spells[i].price) 
                npcHandler:say("To cast this spell say {"..spells[i].words.."}.", cid) 
                doPlayerLearnInstantSpell(cid, spells[i].spell_name) 
                doSendMagicEffect(getCreaturePosition(cid), 12) 
            else 
                npcHandler:say("You don\'t have enough money.", cid) 
            end 
        end 
    end 
end 
end 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())
 
Last edited:
Back
Top