• 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 npc spell seller ex: galuna, wont sell spells

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
1,990
Solutions
9
Reaction score
334
Location
Chile
Hello

I use tfs 1.5 I'm trying to make npcs that sells spells works, the problem is that I'not getting any errors in console
the npc reply to hi bye and if a certain vocation that is not in the array want to get an spell the noc replys that only sells spells to paladins

but when a paladn want to get an spells the npcs does no says nothing and i don't get any error in console


this is part of the code with the spells function
Lua:
function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    
    if getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 then
    else
        if msgcontains(msg, '') then
        npcHandler:say("Sorry, I only sell spells to paladins.", 1)
        return false
        end
    end
    
--name the spell--
if msgcontains(msg, 'find person') or msgcontains(msg, 'Find person') then
    spellprice = 80
    spellvoc = {1, 2, 3, 4, 5, 6, 7, 8}
    spellname = "find person"
    spellmagiclevel = 0
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for all vocations.", 1)
        talk_state = 0
        end

elseif msgcontains(msg, 'ultimate healing') or msgcontains(msg, 'Ultimate healing') then
    spellprice = 1000
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "ultimate healing"
    spellmagiclevel = 8
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end

elseif msgcontains(msg, 'invisible') or msgcontains(msg, 'Invisible') then
    spellprice = 1000
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "invisible "
    spellmagiclevel = 15
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'explosive arrow') or msgcontains(msg, 'Explosive arrow') then
    spellprice = 1000
    spellvoc = {3, 7}
    spellname = "explosive arrow"
    spellmagiclevel = 10
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for royal paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'destroy field') or msgcontains(msg, 'Destroy field') then
    spellprice = 350
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "destroy field"
    spellmagiclevel = 6
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'poison arrow') or msgcontains(msg, 'Poison arrow') then
    spellprice = 700
    spellvoc = {3, 7}
    spellname = "poison arrow"
    spellmagiclevel = 5
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'fireball') or msgcontains(msg, 'fireball') then
    spellprice = 800
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "fireball"
    spellmagiclevel = 5
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'magic shield') or msgcontains(msg, 'magic shield') then
    spellprice = 450
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "magic shield"
    spellmagiclevel = 4
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'heavy magic missile') or msgcontains(msg, 'Heavy magic missile') then
    spellprice = 600
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "heavy magic missile"
    spellmagiclevel = 3
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'great light') or msgcontains(msg, 'Great light') then
    spellprice = 500
    spellvoc = {1, 2, 3, 4, 5, 6, 7, 8}
    spellname = "great light"
    spellmagiclevel = 3
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for all vocations.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'conjure arrow') or msgcontains(msg, 'Conjure arrow') then
    spellprice = 450
    spellvoc = {3, 7}
    spellname = "conjure arrow"
    spellmagiclevel = 2
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'intense healing') or msgcontains(msg, 'Intense healing') then
    spellprice = 350
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "intense healing"
    spellmagiclevel = 2
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'antidote') or msgcontains(msg, 'Antidote') then
    spellprice = 150
    spellvoc = {1, 2, 3, 4, 5, 6, 7, 8}
    spellname = "antidote"
    spellmagiclevel = 2
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for all vocations.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'light magic missile') or msgcontains(msg, 'Light magic missile') then
    spellprice = 200
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "light magic missile"
    spellmagiclevel = 1
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'light healing') or msgcontains(msg, 'Light healing') then
    spellprice = 170
    spellvoc = {1, 2, 3, 4, 5, 6, 7, 8}
    spellname = "light healing"
    spellmagiclevel = 1
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for all vocations.", 1)
        talk_state = 0
        end   
        
elseif msgcontains(msg, 'create food') or msgcontains(msg, 'Create food') then
    spellprice = 150
    spellvoc = {2, 3, 6, 7}
    spellname = "create food"
    spellmagiclevel = 0
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for druids and paladins.", 1)
        talk_state = 0
        end   
    
elseif msgcontains(msg, 'light') or msgcontains(msg, 'Light') then
    spellprice = 100
    spellvoc = {1, 2, 3, 4, 5, 6, 7, 8}
    spellname = "light"
    spellmagiclevel = 0
        if isInArray(spellvoc, getPlayerVocation(cid)) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. spellprice .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for all vocations.", 1)
        talk_state = 0
        end       

--End of Give spell--

--System that does the job after confirm spell--
elseif talk_state == 8754 and msgcontains(msg, 'yes') then
    if isInArray(spellvoc, getPlayerVocation(cid)) then
        if getPlayerMagLevel(cid) >= spellmagiclevel then
            if not getPlayerLearnedInstantSpell(cid, spellname) then
                if doPlayerRemoveMoney(cid, spellprice) == true then
                playerLearnInstantSpell(cid, spellname)
                doSendMagicEffect(getPlayerPosition(cid), 14)
                npcHandler:say("Here you are. Look in your spellbook for the pronounciation of this spell.", 1)
                talk_state = 0
                else
                npcHandler:say("Oh. You do not have enough money.", 1)
                talk_state = 0           
                end
            else
            npcHandler:say("You already know how to cast this spell.", 1)
            talk_state = 0   
            end
        else
        npcHandler:say("You must have magic level ".. spellmagiclevel .." or better to learn this spell!", 1)
        talk_state = 0
        end
    end
elseif talk_state == 8754 and msgcontains(msg, '') then
npcHandler:say("Maybe next time.", 1)
talk_state = 0
--End of the System that does the job after confirm spell--
    
elseif msgcontains(msg, 'spell') or msgcontains(msg, 'Spell') then
npcHandler:say("I sell 'find person', 'light', 'create food', 'light healing', 'light magic missile', 'antidote', 'intense healing', 'conjure arrow', 'great light', 'heavy magic missile', 'magic shield' and. ...", 1)
npcHandler:say("'fireball', 'poison arrow', 'destroy field', 'ultimate healing', 'explosive arrow' and 'invisible'.", 5)
talk_state = 0

elseif msgcontains(msg, 'missile') or msgcontains(msg, 'Missile') then
npcHandler:say("Paladins are the best missile fighters in Tibia!", 1)
talk_state = 0

end       
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
here full lua file
i tried changing part of the code from
Code:
    if getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 then
    else
        if msgcontains(msg, '') then
        npcHandler:say("Sorry, I only sell spells to paladins.", 1)
        return false
        end
    end
to this
Code:
    if player:getVocation():getId() == 3 or player:getVocation():getId() == 7 then
    else
        if msgcontains(msg, '') then
        npcHandler:say("Sorry, I only sell spells to paladins.", 1)
        return false
        end
    end
but with this i do get error and it does not replies either
Code:
: attempt to index global 'player' (a nil value)
 

Attachments

The error:

you need to set
Code:
player = Player(cid)
in line 5

Anyway, thats not a good way to make a npc spellseller. You have new functions that help you do that in data/npc/lib/npcsystem/modules.lua


How to use this module?

Inside npc use that:
Lua:
local node1 = keywordHandler:addKeyword({'light healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn light healing for 170 gp?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'light healing',vocation = 3, price = 170, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

And to use magiclevel instead of level like tibia before, just change in the module.

Same for vocations allowed, just change in module.
 
Last edited:
I'm trying to adap the script i have this so far. don't know for which value change spellmagiclevel
Lua:
function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    local player = Player(cid)
    if getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 then
    else
        if msgcontains(msg, '') then
        npcHandler:say("Sorry, I only sell spells to paladins.", 1)
        return false
        end
    end
    
--name the spell--
if msgcontains(msg, 'find person') or msgcontains(msg, 'Find person') then
    price = 80
    spellvoc = {1, 2, 3, 4, 5, 6, 7, 8}
    spellname = "find person"
    spellmagiclevel = 0
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for all vocations.", 1)
        talk_state = 0
        end

elseif msgcontains(msg, 'ultimate healing') or msgcontains(msg, 'Ultimate healing') then
    price = 1000
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "ultimate healing"
    spellmagiclevel = 8
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end

elseif msgcontains(msg, 'invisible') or msgcontains(msg, 'Invisible') then
    price = 1000
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "invisible "
    spellmagiclevel = 15
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'explosive arrow') or msgcontains(msg, 'Explosive arrow') then
    price = 1000
    spellvoc = {3, 7}
    spellname = "explosive arrow"
    spellmagiclevel = 10
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for royal paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'destroy field') or msgcontains(msg, 'Destroy field') then
    price = 350
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "destroy field"
    spellmagiclevel = 6
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'poison arrow') or msgcontains(msg, 'Poison arrow') then
    price = 700
    spellvoc = {3, 7}
    spellname = "poison arrow"
    spellmagiclevel = 5
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'fireball') or msgcontains(msg, 'fireball') then
    price = 800
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "fireball"
    spellmagiclevel = 5
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'magic shield') or msgcontains(msg, 'magic shield') then
    price = 450
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "magic shield"
    spellmagiclevel = 4
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'heavy magic missile') or msgcontains(msg, 'Heavy magic missile') then
    price = 600
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "heavy magic missile"
    spellmagiclevel = 3
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'great light') or msgcontains(msg, 'Great light') then
    price = 500
    spellvoc = {1, 2, 3, 4, 5, 6, 7, 8}
    spellname = "great light"
    spellmagiclevel = 3
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for all vocations.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'conjure arrow') or msgcontains(msg, 'Conjure arrow') then
    price = 450
    spellvoc = {3, 7}
    spellname = "conjure arrow"
    spellmagiclevel = 2
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'intense healing') or msgcontains(msg, 'Intense healing') then
    price = 350
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "intense healing"
    spellmagiclevel = 2
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'antidote') or msgcontains(msg, 'Antidote') then
    price = 150
    spellvoc = {1, 2, 3, 4, 5, 6, 7, 8}
    spellname = "antidote"
    spellmagiclevel = 2
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for all vocations.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'light magic missile') or msgcontains(msg, 'Light magic missile') then
    price = 200
    spellvoc = {1, 2, 3, 5, 6, 7}
    spellname = "light magic missile"
    spellmagiclevel = 1
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for sorcerers, druids and paladins.", 1)
        talk_state = 0
        end       
        
elseif msgcontains(msg, 'light healing') or msgcontains(msg, 'Light healing') then
    price = 170
    spellvoc = {1, 2, 3, 4, 5, 6, 7, 8}
    spellname = "light healing"
    spellmagiclevel = 1
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for all vocations.", 1)
        talk_state = 0
        end   
        
elseif msgcontains(msg, 'create food') or msgcontains(msg, 'Create food') then
    price = 150
    spellvoc = {2, 3, 6, 7}
    spellname = "create food"
    spellmagiclevel = 0
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for druids and paladins.", 1)
        talk_state = 0
        end   
    
elseif msgcontains(msg, 'light') or msgcontains(msg, 'Light') then
    price = 100
    spellvoc = {1, 2, 3, 4, 5, 6, 7, 8}
    spellname = "light"
    spellmagiclevel = 0
        if table.contains(spellvoc, player:getVocation():getId()) then
        npcHandler:say("Do you want to learn the spell '".. spellname .."' for ".. price .." gold?", 1)
        talk_state = 8754
        else
        npcHandler:say("I am sorry but this spell is only for all vocations.", 1)
        talk_state = 0
        end       

--End of Give spell--

--System that does the job after confirm spell--
elseif talk_state == 8754 and msgcontains(msg, 'yes') then
    if table.contains(spellvoc, player:getVocation():getId()) then
        if getPlayerMagLevel(cid) >= spellmagiclevel then
            if not getPlayerLearnedInstantSpell(cid, spellname) then
                if doPlayerRemoveMoney(cid, price) == true then
                playerLearnInstantSpell(cid, spellname)
                doSendMagicEffect(getPlayerPosition(cid), 14)
                npcHandler:say("Here you are. Look in your spellbook for the pronounciation of this spell.", 1)
                talk_state = 0
                else
                npcHandler:say("Oh. You do not have enough money.", 1)
                talk_state = 0           
                end
            else
            npcHandler:say("You already know how to cast this spell.", 1)
            talk_state = 0   
            end
        else
        npcHandler:say("You must have magic level ".. spellmagiclevel .." or better to learn this spell!", 1)
        talk_state = 0
        end
    end
elseif talk_state == 8754 and msgcontains(msg, '') then
npcHandler:say("Maybe next time.", 1)
talk_state = 0
--End of the System that does the job after confirm spell--
    
elseif msgcontains(msg, 'spell') or msgcontains(msg, 'Spell') then
npcHandler:say("I sell 'find person', 'light', 'create food', 'light healing', 'light magic missile', 'antidote', 'intense healing', 'conjure arrow', 'great light', 'heavy magic missile', 'magic shield' and. ...", 1)
npcHandler:say("'fireball', 'poison arrow', 'destroy field', 'ultimate healing', 'explosive arrow' and 'invisible'.", 5)
talk_state = 0

elseif msgcontains(msg, 'missile') or msgcontains(msg, 'Missile') then
npcHandler:say("Paladins are the best missile fighters in Tibia!", 1)
talk_state = 0

end       
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
}

the npc is still replying to certain vocation and no to others it was partially working and now it does not :( don't know what i did
Code:
13:56 GM Ratx [37]: hi
13:56 Elane: Welcome to the paladins,  GM Ratx ! Can I help you?
13:57 GM Ratx [37]: buy find person
13:57 Elane: Sorry, I only sell spells to paladins.
13:57 Elane: Do you want to learn the spell 'find person' for 80 gold?
13:59 GM Ratx [37]: hi
Post automatically merged:

solved thanks @mano368
Lua:
15:36 Paladini [108]: hi
15:36 Elane: Hi,  Paladini ! What can I do for you?
15:36 Paladini [108]: light
15:36 Elane: Do you want to learn the spell 'light' for 100 gold?
15:36 Paladini [108]: yes
15:36 Elane: Here you are. Look in your spellbook for the pronounciation of this spell.
had to edit things in modules add the peice of code that you told me and few changes in scripts
 
Last edited:
Back
Top