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

TFS 1.X+ Learning spells problem

Hayvosh

Member
Joined
Feb 7, 2019
Messages
40
Solutions
2
Reaction score
10
Location
Sweden
Hello,

I am running TFS 1.4 downport with 7.72 client.
I have disabled autolearn spells so that players need to buy their own spells.
But for some reason when I got to trainers they just reply with "You cannot learn this spell", even with Light spell (utevo lux).
Here's some code snippets from paladin trainer Thais :

Elane.XML
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Elane" script="Elane.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="137" head="113" body="63" legs="120" feet="119" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|, I can teach spells and spell runes for paladins." />

<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="spells;spell runes" />

<parameter key="keyword_reply1" value="I can teach you, antidote, conjure arrow, conjure explosive arrow, create food, great light, find person, intense healing, light, light healing and ultimate healing." />
<parameter key="keyword_reply2" value="I can teach you, desintegrate, heavy magic missile and light magic missile,." />
</parameters>
</npc>

Elane.lua
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


-- OTServ event handling functions start
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
-- OTServ event handling functions end

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

local node1 = keywordHandler:addKeyword({'light magic missile'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn light magic missile for 500 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'light magic missile',vocation = 3, price = 500, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

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})

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

local node1 = keywordHandler:addKeyword({'find person'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn find person for 80 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'find person',vocation = 3, price = 80, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

local node1 = keywordHandler:addKeyword({'antidote'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn antidote for 150 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'antidote',vocation = 3, price = 150, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})


local node1 = keywordHandler:addKeyword({'create food'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn create food for 300 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'food',vocation = 3, price = 300, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})


local node1 = keywordHandler:addKeyword({'destroy field'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn destroy field for 700 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'destroy field',vocation = 3, price = 700, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

local node1 = keywordHandler:addKeyword({'conjure arrow'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn conjure arrow for 450 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'conjure arrow',vocation = 3, price = 450, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})


local node1 = keywordHandler:addKeyword({'conjure poisoned arrow'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn conjure poisoned arrow for 700 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'conjure poisoned arrow',vocation = 3, price = 700, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

local node1 = keywordHandler:addKeyword({'intense healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn intense healing for 350 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'intense healing',vocation = 3, price = 350, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

local node1 = keywordHandler:addKeyword({'ultimate healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn ultimate healing for 1000 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'ultimate healing',vocation = 3, price = 1000, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

local node1 = keywordHandler:addKeyword({'heavy magic missile'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn heavy magic missile for 1500 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'heavy magic missile',vocation = 3, price = 1500, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

local node1 = keywordHandler:addKeyword({'desintegrate'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn desintegrate for 900 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'desintegrate',vocation = 3, price = 900, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

local node1 = keywordHandler:addKeyword({'conjure explosive arrow'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn conjure explosive arrow for 1000 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'conjure explosive arrow',vocation = 3, price = 1000, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())

Is there come clever way of figuring this out?
I have tried with both Knight and Paladin trainers, and all are the same.
Spells work fine if I enable "needlearn" but I want to have people buy spells.
 
Solution
I would guess it's because you don't have any vocation set for utevo lux. Add them like this:
XML:
<instant name="Light" words="utevo lux" needlearn="0" mana="20" selftarget="1" aggressive="0" script="support/light.lua">
    <vocation name="Sorcerer" />
    <vocation name="Druid" />
    <vocation name="Paladin" />
    <vocation name="Knight" />
    <vocation name="Master Sorcerer" />
    <vocation name="Elder Druid" />
    <vocation name="Royal Paladin" />
    <vocation name="Elite Knight" />
</instant>
What level are the characters you are trying to buy the spells for?

Example, you are level 1 paladin, trying to buy utevo lux / light?

If you aren't high enough level to use the spell, you won't be high enough level to purchase the spell either.

When you look in modules you get these lines
Lua:
            elseif not player:canLearnSpell(parameters.spellName) then
                npcHandler:say("You cannot learn this spell.", cid)

and if we look at player:canLearnSpell in source
Lua:
int LuaScriptInterface::luaPlayerCanLearnSpell(lua_State* L)
{
    // player:canLearnSpell(spellName)
    const Player* player = getUserdata<const Player>(L, 1);
    if (!player) {
        lua_pushnil(L);
        return 1;
    }

    const std::string& spellName = getString(L, 2);
    InstantSpell* spell = g_spells->getInstantSpellByName(spellName);
    if (!spell) {
        reportErrorFunc(L, "Spell \"" + spellName + "\" not found");
        pushBoolean(L, false);
        return 1;
    }

    if (player->hasFlag(PlayerFlag_IgnoreSpellCheck)) {
        pushBoolean(L, true);
        return 1;
    }

    const auto& vocMap = spell->getVocMap();
    if (vocMap.count(player->getVocationId()) == 0) {
        pushBoolean(L, false);
    } else if (player->getLevel() < spell->getLevel()) {
        pushBoolean(L, false);
    } else if (player->getMagicLevel() < spell->getMagicLevel()) {
        pushBoolean(L, false);
    } else {
        pushBoolean(L, true);
    }
    return 1;
}

So it finds the spell by name..
-> Does a vocation check
-> checks the player level versus the spell level requirement
-> checks the player magic level (only runes generally have this requirement though)

So based on that.. I want to assume your characters level is really low.
Of course.. this is all assuming that the script is functioning as intended xP
 
Hello,

I was trying to buy utevo lux (light spell) in Thais from the Paladin trainer with for example a lvl 8 paladin with maglvl 0. And utevo lux should be from mag lvl 0 if I'm not mistaken?

Here's Spells.xml


XML:
<?xml version="1.0"?>
<spells>
    <!-- House Spells -->
    <instant function="editHouseGuest" enabled="1" words="aleta sio" name="House Guest List"/>
    <instant function="editHouseSubOwner" enabled="1" words="aleta som" name="House Subowner List"/>
    <instant function="editHouseDoor" enabled="1" words="aleta grav" name="House Door List"/>
    <instant function="houseKick" enabled="1" words="alana sio" name="House Kick" params="1"/>
    <!-- Rune Spells -->
    <rune name="adevo grav pox" id="2285" allowfaruse="1" maglv="0" blocktype="solid" charges="3" script="runes/poison_field_rune.lua"/>
    <rune name="adura gran" id="2265"  allowfaruse="1" maglv="1" needtarget="1" aggressive="0" charges="1" script="runes/intense_healing_rune.lua" />
    <rune name="adana pox" id="2266" allowfaruse="1" needtarget="1" aggressive="0" charges="1" script="runes/antidote_rune.lua" />
    <rune name="adori" id="2287" allowfaruse="1" needtarget="1" charges="5" script="runes/light_magic_missile_rune.lua" />
    <rune name="adevo grav flam" id="2301" allowfaruse="1" maglv="1" blocktype="solid" charges="3" script="runes/fire_field_rune.lua" />
    <rune name="adeta sio" id="2290" allowfaruse="1" maglv="5" needtarget="1" charges="1" script="runes/convince_creature_rune.lua" />
    <rune name="adito grav" id="2261" allowfaruse="1" maglv="3" range="4" blocktype="solid" aggressive="0" charges="3" script="runes/destroy_field_rune.lua" />
    <rune name="adevo grav vis" id="2277" allowfaruse="1" maglv="3" blocktype="solid" charges="3" script="runes/energy_field_rune.lua" />
    <rune name="adito tera" id="2310" allowfaruse="1" maglv="4" charges="3" range="1" script="runes/desintegrate_rune.lua" />
    <rune name="adura vita" id="2273" allowfaruse="1" maglv="4" needtarget="1" aggressive="0" charges="1" script="runes/ultimate_healing_rune.lua" />
    <rune name="adori gran" id="2311" allowfaruse="1" maglv="3" needtarget="1" charges="5" script="runes/heavy_magic_missile_rune.lua"/>
    <rune name="adevo mas pox" id="2286" allowfaruse="1" maglv="4" blocktype="solid" charges="2" script="runes/poison_bomb_rune.lua" />
    <rune name="adevo mas flam" id="2305" allowfaruse="1" maglv="5" blocktype="solid" charges="2" script="runes/fire_bomb_rune.lua" />
    <rune name="adevo res flam" id="2308" allowfaruse="1" maglv="7" needtarget="1" charges="2" script="runes/soulfire_rune.lua" />
    <rune name="adevo ina" id="2291" allowfaruse="1" maglv="4" selftarget="1" blocktype="solid" charges="1" script="runes/chameleon_rune.lua" /> <!-- broken somehow -->
    <rune name="adori flam" id="2302" allowfaruse="1" maglv="4" charges="3" script="runes/fireball_rune.lua" />
    <rune name="adana mort" id="2316" allowfaruse="1" maglv="4" blocktype="solid" charges="2" script="runes/animate_dead_rune.lua" />
    <rune name="adevo mas grav pox" id="2289" allowfaruse="1" maglv="5" blocktype="solid" charges="4" script="runes/poison_wall_rune.lua" />
    <rune name="adori gran flam" id="2304" allowfaruse="1" maglv="4" charges="2" script="runes/great_fireball_rune.lua" />
    <rune name="adevo mas hur" id="2313" allowfaruse="1" maglv="6" charges="3" script="runes/explosion_rune.lua" />
    <rune name="adevo grav tera" id="2293" allowfaruse="1" maglv="9" blocktype="all" charges="3" script="runes/magic_wall_rune.lua" />
    <rune name="adevo mas grav flam" id="2303" allowfaruse="1" maglv="6" blocktype="solid" charges="4" script="runes/fire_wall_rune.lua" />
    <rune name="adevo mas vis" id="2262" allowfaruse="1" maglv="10" blocktype="solid" charges="2" script="runes/energy_bomb_rune.lua" />
    <rune name="adevo mas grav vis" id="2279" allowfaruse="1" maglv="9" blocktype="solid" charges="4" script="runes/energy_wall_rune.lua" />
    <rune name="adori vita vis" id="2268" allowfaruse="1" maglv="15" needtarget="1" charges="1" script="runes/sudden_death_rune.lua" />
    <rune name="adevo res pox" id="2292" allowfaruse="1" maglv="4" needtarget="1" charges="3" script="runes/envenom_rune.lua" />
    <rune name="adana ani" id="2278" allowfaruse="1" maglv="18" needtarget="1" mana="1400" charges="1" script="runes/paralyze_rune.lua">
        <vocation name="Druid"/>
        <vocation name="Elder Druid"/>
    </rune>

    <!-- Instant Spells -->
    <instant name="Light" words="utevo lux" needlearn="0" mana="20" selftarget="1" aggressive="0" script="support/light.lua"/>
    <instant name="Find Person" words="exiva" needlearn="0" mana="20" params="1" script="support/find_person.lua"/>
    <instant name="Magic Rope" words="exani tera" needlearn="0" lvl="9" mana="20" aggressive="0" script="support/magic_rope.lua"/>
    <instant name="Light Healing" words="exura" needlearn="0" lvl="9" mana="25" selftarget="1" aggressive="0" script="healing/light_healing.lua"/>
    <instant name="Antidote" words="exana pox" needlearn="0" lvl="10" mana="30" selftarget="1" aggressive="0" script="healing/cure_poison.lua"/>
    <instant name="Intense Healing" words="exura gran" needlearn="0" lvl="11" mana="40" selftarget="1" aggressive="0" script="healing/intense_healing.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
        <vocation name="Paladin"/>   
        <vocation name="Royal Paladin"/>
    </instant>
    <instant name="Levitate" words="exani hur" needlearn="0" lvl="12" prem="1" mana="50" params="1" script="support/levitate.lua"/>
    <instant name="Energy Strike" words="exori vis" lvl="11" mana="20" direction="1" exhaustion="1000" script="attack/energy_strike.lua"> <!-- broken -->
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
    </instant>
    <instant name="Summon Creature" words="utevo res" needlearn="0" lvl="25" params="1" script="support/summon_creature.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
    </instant>
    <instant name="Great Light" words="utevo gran lux" needlearn="0" lvl="13" mana="60" selftarget="1" aggressive="0" script="support/great_light.lua"/>
    <instant name="Magic Shield" words="utamo vita" lvl="14" mana="50" selftarget="1" aggressive="0" script="support/magic_shield.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
        <vocation name="Paladin"/>   
        <vocation name="Royal Paladin"/>
    </instant>
    <instant name="Haste" words="utani hur" needlearn="0" lvl="14" prem="1" mana="60" selftarget="1" aggressive="0" script="support/haste.lua" />
    <instant name="Flame Strike" words="exori flam" lvl="12" prem="1" mana="20" direction="1" exhaustion="1000" script="attack/flame_strike.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
    </instant>
    <instant name="Force Strike" words="exori mort" needlearn="0" lvl="11" prem="1" mana="20" direction="1" exhaustion="1000" script="attack/force_strike.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
    </instant>
    <instant name="Fire Wave" words="exevo flam hur" needlearn="0" lvl="18" mana="80" direction="1" script="attack/fire_wave.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
    </instant>
    <instant name="Heal Friend" words="exura sio" needlearn="0" lvl="18" mana="70" prem="1" needtarget="1" params="1" aggressive="0" blockwalls="0" script="healing/heal_friend.lua">
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
    </instant>
    <instant name="Ultimate Healing" words="exura vita" needlearn="0" lvl="20" mana="160" selftarget="1" aggressive="0" script="healing/ultimate_healing.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
        <vocation name="Paladin"/>   
        <vocation name="Royal Paladin"/>
    </instant>
    <instant name="Strong Haste" words="utani gran hur" needlearn="0" lvl="20" prem="1" mana="100" selftarget="1" aggressive="0" script="support/strong_haste.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
    </instant>
    <instant name="Challenge" words="exeta res" needlearn="0" lvl="20" prem="1" mana="30" selftarget="1" script="support/challenge.lua">
        <vocation name="Elite Knight"/>
    </instant>
    <instant name="Energy Beam" words="exevo vis lux" needlearn="0" lvl="23" mana="100" direction="1" script="attack/energy_beam.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
    </instant>
    <instant name="Creature Illusion" words="utevo res ina" needlearn="0" lvl="23" mana="100" params="1" script="support/creature_illusion.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
    </instant>
    <instant name="Cancel Invisibility" words="exana ina" needlearn="0" lvl="26" prem="1" mana="200" selftarget="1" script="support/cancel_invisibility.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
    </instant>
    <instant name="Ultimate Light" words="utevo vis lux" needlearn="0" lvl="26" mana="140" aggressive="0" selftarget="1" script="support/ultimate_light.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
    </instant>
    <instant name="Great Energy Beam" words="exevo gran vis lux" needlearn="0" lvl="29" mana="200" direction="1" script="attack/great_energy_beam.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
    </instant>
    <instant name="Berserk" words="exori" needlearn="0" lvl="35" selftarget="1" script="attack/berserk.lua">
        <vocation name="Knight"/>     
        <vocation name="Elite Knight"/>
    </instant>
    <instant name="Invisibility" words="utana vid" needlearn="0" lvl="35" mana="440" prem="1" selftarget="1" aggressive="0" script="support/invisible.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
        <vocation name="Paladin"/>   
        <vocation name="Royal Paladin"/>
    </instant>
    <instant name="Mass Healing" words="exura gran mas res" needlearn="0" lvl="36" prem="1" mana="150" selftarget="1" aggressive="0" script="healing/mass_healing.lua">
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
    </instant>
    <instant name="Undead Legion" words="exana mas mort" needlearn="0" lvl="30" prem="1" mana="500" selftarget="1" script="support/undead_legion.lua"> <!-- broken -->
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
    </instant>
    <instant name="Ultimate Explosion" words="exevo gran mas vis" needlearn="0" lvl="60" prem="1" mana="1200" script="attack/ultimate_explosion.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
    </instant>
    <instant name="Poison Storm" words="exevo gran mas pox" needlearn="0" lvl="50" prem="1" mana="600" script="attack/poison_storm.lua">
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
    </instant>
    <instant name="Energy Wave" words="exevo mort hur" needlearn="0" lvl="38" mana="250" prem="1" direction="1" script="attack/force_wave.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Master Sorcerer"/>
    </instant>
    <instant name="Wild Growth" words="exevo grav vita" needlearn="0" lvl="27" mana="220" prem="1" script="support/wild_growth.lua">
        <vocation name="Elder Druid"/>
    </instant>
    <instant name="Food" words="exevo pan" needlearn="0" lvl="14" mana="120" soul="1" selftarget="1" aggressive="0" script="support/food.lua">
        <vocation name="Druid"/>   
        <vocation name="Elder Druid"/>
        <vocation name="Paladin"/>   
        <vocation name="Royal Paladin"/>
    </instant>

    <!-- Conjuring Spells -->
    <instant group="support" name="Animate Dead Rune" words="adana mort" level="27" mana="600" soul="5" premium="1" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/animate_dead_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Blank Rune" words="adori blank" level="20" mana="50" soul="1" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/blank_rune.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
        <vocation name="Paladin" />
        <vocation name="Royal Paladin" />
        <vocation name="Sorcerer" />
        <vocation name="Master Sorcerer" />
    </instant>
    <instant group="support" name="Chameleon Rune" words="adevo ina" level="27" mana="600" soul="2" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/chameleon_rune.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" spellid="51" name="Conjure Arrow" words="exevo con" level="13" mana="100" soul="1" premium="0" aggressive="0" selftarget="1" cooldown="2000" needlearn="0" script="conjuring/conjure_arrow.lua">
        <vocation name="Paladin" />
        <vocation name="Royal Paladin" />
    </instant>
    <instant group="support" spellid="79" name="Conjure Bolt" words="exevo con mort" level="17" mana="140" soul="2" premium="1" aggressive="0" selftarget="1" cooldown="2000" needlearn="0" script="conjuring/conjure_bolt.lua">
        <vocation name="Paladin" />
        <vocation name="Royal Paladin" />
    </instant>
    <instant group="support" spellid="49" name="Conjure Explosive Arrow" words="exevo con flam" level="25" mana="290" soul="3" premium="0" aggressive="0" selftarget="1" cooldown="2000" needlearn="0" script="conjuring/conjure_explosive_arrow.lua">
        <vocation name="Paladin" />
        <vocation name="Royal Paladin" />
    </instant>
    <instant group="support" spellid="48" name="Conjure Poisoned Arrow" words="exevo con pox" level="16" mana="130" soul="2" premium="0" aggressive="0" selftarget="1" cooldown="2000" needlearn="0" script="conjuring/conjure_poisoned_arrow.lua">
        <vocation name="Paladin" />
        <vocation name="Royal Paladin" />
    </instant>
    <instant group="support" spellid="95" name="Conjure Power Bolt" words="exevo con vis" level="59" mana="700" soul="4" premium="1" aggressive="0" selftarget="1" cooldown="2000" needlearn="0" script="conjuring/conjure_power_bolt.lua">
        <vocation name="Royal Paladin" />
    </instant>
    <instant group="support" name="Convince Creature Rune" words="adeta sio" level="16" mana="200" soul="3" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/convince_creature_rune.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Cure Poison Rune" words="adana pox" level="15" mana="200" soul="1" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/cure_poison_rune.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Destroy Field Rune" words="adito grav" level="17" mana="120" soul="2" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/destroy_field_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Paladin" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
        <vocation name="Royal Paladin" />
    </instant>
    <instant group="support" name="Disintegrate Rune" words="adito tera" level="21" mana="200" soul="3" premium="1" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/disintegrate_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Paladin" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
        <vocation name="Royal Paladin" />
    </instant>
    <instant group="support" spellid="92" name="Enchant Staff" words="exeta vis" level="41" mana="80" premium="1" aggressive="0" selftarget="1" cooldown="2000" needlearn="0" script="conjuring/enchant_staff.lua">
        <vocation name="Master Sorcerer" />
    </instant>
    <instant group="support" name="Energy Bomb Rune" words="adevo mas vis" level="37" mana="880" soul="5" premium="1" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/energy_bomb_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Master Sorcerer" />
    </instant>
    <instant group="support" name="Energy Field Rune" words="adevo grav vis" level="18" mana="320" soul="2" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/energy_field_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Energy Wall Rune" words="adevo mas grav vis" level="41" mana="1000" soul="5" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/energy_wall_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Explosion Rune" words="adevo mas hur" level="31" mana="570" soul="4" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/explosion_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Fire Field Rune" words="adevo grav flam" level="15" mana="240" soul="1" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/fire_field_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Fire Bomb Rune" words="adevo mas flam" level="27" mana="600" soul="4" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/fire_bomb_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Fire Wall Rune" words="adevo mas grav flam" level="33" mana="780" soul="4" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/fire_wall_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Fireball Rune" words="adori flam" level="27" mana="460" soul="3" premium="1" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/fireball_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Master Sorcerer" />
    </instant>
    <instant group="support" name="Great Fireball Rune" words="adori gran flam" level="30" mana="530" soul="3" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/great_fireball_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Master Sorcerer" />
    </instant>
    <instant group="support" name="Heavy Magic Missile Rune" words="adori gran" level="25" mana="350" soul="2" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/heavy_magic_missile_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Master Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Intense Healing Rune" words="adura gran" level="15" mana="120" soul="2" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/intense_healing_rune.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Light Magic Missile Rune" words="adori" level="15" mana="120" soul="1" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/light_magic_missile_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Magic Wall Rune" words="adevo grav tera" level="32" mana="750" soul="5" premium="1" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/magic_wall_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Master Sorcerer" />
    </instant>
    <instant group="support" name="Paralyze Rune" words="adana ani" level="54" mana="1400" soul="3" premium="1" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/paralyze_rune.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Poison Bomb Rune" words="adevo mas pox" level="25" mana="520" soul="2" premium="1" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/poison_bomb_rune.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Poison Field Rune" words="adevo grav pox" level="14" mana="200" soul="1" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/poison_field_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Poison Wall Rune" words="adevo mas grav pox" level="29" mana="640" soul="3" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/poison_wall_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Soulfire Rune" words="adevo res flam" level="27" mana="420" soul="3" premium="1" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/soulfire_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Stalagmite Rune" words="adevo res pox" level="24" mana="350" soul="2" premium="0" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/stalagmite_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Master Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
    </instant>
    <instant group="support" name="Sudden Death Rune" words="adori vita vis" level="45" mana="985" soul="5" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/sudden_death_rune.lua">
        <vocation name="Sorcerer" />
        <vocation name="Master Sorcerer" />
    </instant>
    <instant group="support" name="Ultimate Healing Rune" words="adura vita" level="24" mana="400" soul="3" aggressive="0" cooldown="2000" needlearn="0" script="conjuring/ultimate_healing_rune.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
    </instant>
</spells>
 
I would guess it's because you don't have any vocation set for utevo lux. Add them like this:
XML:
<instant name="Light" words="utevo lux" needlearn="0" mana="20" selftarget="1" aggressive="0" script="support/light.lua">
    <vocation name="Sorcerer" />
    <vocation name="Druid" />
    <vocation name="Paladin" />
    <vocation name="Knight" />
    <vocation name="Master Sorcerer" />
    <vocation name="Elder Druid" />
    <vocation name="Royal Paladin" />
    <vocation name="Elite Knight" />
</instant>
 
Solution
I would guess it's because you don't have any vocation set for utevo lux. Add them like this:
XML:
<instant name="Light" words="utevo lux" needlearn="0" mana="20" selftarget="1" aggressive="0" script="support/light.lua">
    <vocation name="Sorcerer" />
    <vocation name="Druid" />
    <vocation name="Paladin" />
    <vocation name="Knight" />
    <vocation name="Master Sorcerer" />
    <vocation name="Elder Druid" />
    <vocation name="Royal Paladin" />
    <vocation name="Elite Knight" />
</instant>
That solved my problem!
I had completely missed this :) Thank you
 
can somebody help me with this? this is my elane it reply to the greetings but don't want to sell spells there's no error in console
i use tfs 1.5
Lua:
keywordHandler:addKeyword({'spellbook'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "In a spellbook your spells are listed. There you will find the pronunciation of each spell. If you want to buy one, visit Xodet in his magic shop."})

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())
 
Back
Top