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

Avesta 7.6 (Nottinghster) Bless problem.

Maximiko

New Member
Joined
Aug 2, 2007
Messages
9
Reaction score
0
Hello again Otlanders:
I have a problem with this server's blessing system. In the compilation of the server is added the (real system) here i show it in the database:
91319ac0d17d4a719fd29e573d82b93d.png

However, I have added the npc (Norf) but when buying the blessings i get this error:
80a579562c974aeb8fae7d2127f6a5c4.png

Here i put the npc script in case it is necessary for you to help me.
NPC:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Norf" script="Norf.lua" walkinterval="50000" access="3" floorchange="0">
    <health now="100" max="100"/>
    <look type="57" head="0" body="0" legs="0" feet="0" addons="0"/>
    <parameters>
      
       <parameter key="message_greet" value="Welcome, Pilgrim."/>
       <parameter key="message_farewell" value="Good bye, |PLAYERNAME|!"/>
      
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="job;name;pilgrimage;ashes;blessing;sacred places;spark;phoenix;embrace;fire;suns;wisdoms;solitude" />
        <parameter key="keyword_reply1" value="I am here to provide one of the five blessings." />
        <parameter key="keyword_reply2" value="My name is Norf." />
        <parameter key="keyword_reply3" value="Whenever you receive a lethal wound your lifeforce is damaged. With every single of the five blessings you have this damage will be reduced." />
        <parameter key="keyword_reply4" value="Whenever you receive a lethal wound your lifeforce is damaged. With every single of the five blessings you have this damage will be reduced." />
        <parameter key="keyword_reply5" value="There are five different blessings available in five sacred places. These blessings are: the spiritual shielding, the spark of the phoenix, the embrace of tibia, the fire of the suns and the wisdom of solitude." />
        <parameter key="keyword_reply6" value="Just ask in which of the five blessings you are interested in." />
        <parameter key="keyword_reply7" value="The spark of the phoenix is given by the dwarven priests of earth and fire in Kazordoon." />
        <parameter key="keyword_reply8" value="The spark of the phoenix is given by the dwarven priests of earth and fire in Kazordoon." />
        <parameter key="keyword_reply9" value="The druids north of Carlin will provide you with the embrace of tibia." />
        <parameter key="keyword_reply10" value="You can ask for the blessing of the two suns in the suntower near Ab'Dendriel." />
        <parameter key="keyword_reply11" value="You can ask for the blessing of the two suns in the suntower near Ab'Dendriel." />
        <parameter key="keyword_reply12" value="Talk to the hermit Eremo on the isle of Cormaya about this blessing." />
        <parameter key="keyword_reply13" value="Talk to the hermit Eremo on the isle of Cormaya about this blessing." />
        <parameter key="keyword_reply14" value="If you need money you should slay monsters and take their gold. Look for spiders and rats." />
        <parameter key="keyword_reply15" value="If you need money you should slay monsters and take their gold. Look for spiders and rats." />
    </parameters>
</npc>
SCRIPT:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


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


local node1 = keywordHandler:addKeyword({'spiritual shielding'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the spiritual shielding for 10000 gold?'})
    node1:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, bless = 2, premium = 1, cost = 10000})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

npcHandler:addModule(FocusModule:new())
 
Solution
Can you share with me 5 npc?

Sure, choose my answer as best answer for check SOLVED on the topic.
Here you are, the Five NPC Blessings.
NOTE THAT, the price of the blessings on this script are 10k each blessings, and not (200gp x level), this is a constant cost, 10k each bless ever.
NPC Norf I have posted, following the other NPCs.
The blessing Phoenix have 2 NPCs, Kawill and Pydar (Check the storage on NPC Kawill, and Pydar, you cant use this storage on other quests.)
It only happens on NPC Norf? other NPC blessings are ok?
I have used avesta, I have some scripts here.

Try this NPC script and tell me if works (I have all 5 Npc blessings)
Lua:
dofile(getDataDir() .. 'global/greeting.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

keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am here to provide one of the five blessings."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My name is Norf."})
keywordHandler:addKeyword({'time'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Now, it is |TIME|. Ask Gorn for a watch, if you need one."})

function creatureSayCallback(cid, type, msg)
    if(npcHandler.focus ~= cid) then
        return false
    end

if msgcontains(msg, 'heal') then
if getCreatureHealth(cid) <= 39 then
    npcHandler:say("You are looking really bad. Let me heal your wounds.", 1)
    doCreatureAddHealth(cid, -getCreatureHealth(cid)+40)
    doSendMagicEffect(getPlayerPosition(cid), 12)
    talk_state = 0
    return true
    else
    npcHandler:say("You aren't looking really bad. Sorry, I can't help you.", 1)
    talk_state = 0
    return true
    end
    talk_state = 0
end
    if(npcHandler.focus ~= cid) then
        return false
    end  
  
if msgcontains(msg, 'bless') then
    npcHandler:say("There are five different blessings available in five sacred places. These blessings are: the spiritual shielding, the spark of the phoenix, the embrace of tibia, the fire of the suns and the wisdom of solitude.", 1)
    talk_state = 0

elseif msgcontains(msg, 'spiritual') or msgcontains(msg, 'shielding') then
    npcHandler:say("Here in the whiteflower temple you may receive the blessing of spiritual shielding. But we must ask of you to sacrifice 10.000 gold. Are you still interested?", 1)
    talk_state = 1394


elseif talk_state == 1394 and msgcontains(msg, 'yes') then
    if doPlayerRemoveMoney(cid, 10000) == TRUE then
        if AddPlayerBlessing(cid, 1) == true then
        npcHandler:say("So receive the shielding of your spirit, pilgrim.", 1)
        doSendMagicEffect(getPlayerPosition(cid), 13)
        setPlayerStorageValue(cid, 30006, 1)
        talk_state = 0      
        else
        doPlayerAddMoney(cid, 10000)
        npcHandler:say("You already possess this blessing.", 1)
        talk_state = 0          
        end
    else
    npcHandler:say("Oh. You do not have enough money.", 1)
    talk_state = 0  
    end
  
elseif talk_state == 1394 and msgcontains(msg, '') then
    npcHandler:say("Ok. Suits me.", 1)
    talk_state = 0  
  
elseif msgcontains(msg, 'phoenix') then
    npcHandler:say("The spark of the phoenix is given by the dwarven priests of earth and fire in Kazordoon.", 1)
    talk_state = 0
  
elseif msgcontains(msg, 'embrace') then
    npcHandler:say("The druids north of Carlin will provide you with the embrace of tibia.", 1)
    talk_state = 0
  
elseif msgcontains(msg, 'suns') then
    npcHandler:say("You can ask for the blessing of the two suns in the suntower near Ab'Dendriel.", 1)
    talk_state = 0
  
elseif msgcontains(msg, 'wisdom') then
    npcHandler:say("Talk to the hermit Eremo on the isle of Cormaya about this blessing.", 1)
    talk_state = 0
  
elseif msgcontains(msg, 'spiritual') then
    npcHandler:say("You can ask for the blessing of spiritual shielding the whiteflower temple south of Thais.", 1)
    talk_state = 0
  
end  
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Can you share with me 5 npc?

Sure, choose my answer as best answer for check SOLVED on the topic.
Here you are, the Five NPC Blessings.
NOTE THAT, the price of the blessings on this script are 10k each blessings, and not (200gp x level), this is a constant cost, 10k each bless ever.
NPC Norf I have posted, following the other NPCs.
The blessing Phoenix have 2 NPCs, Kawill and Pydar (Check the storage on NPC Kawill, and Pydar, you cant use this storage on other quests.)
 
Solution
Humphrey (Embrace):
Lua:
dofile(getDataDir() .. 'global/greeting.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

function greetCallback(cid)
if getCreatureHealth(cid) <= 39 then
    npcHandler:setMessage(MESSAGE_GREET, "You are looking really bad, ".. getPlayerName(cid) ..". Let me heal your wounds.")
    doCreatureAddHealth(cid, -getCreatureHealth(cid)+40)
    doSendMagicEffect(getPlayerPosition(cid), 12)
    talk_state = 0
    return true
    else
    npcHandler:setMessage(MESSAGE_GREET, "Welcome, child of nature.")
    return true
    end
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)

keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am a guardian of nature. Also I am the keeper of the embrace of tibia, one of the five blessings."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My name is Humphrey."})
keywordHandler:addKeyword({'time'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Now, it is |TIME|. Ask Gorn for a watch, if you need one."})

function creatureSayCallback(cid, type, msg)
    if(npcHandler.focus ~= cid) then
        return false
    end

if msgcontains(msg, 'heal') then
if getCreatureHealth(cid) <= 39 then
    npcHandler:say("You are looking really bad. Let me heal your wounds.", 1)
    doCreatureAddHealth(cid, -getCreatureHealth(cid)+40)
    doSendMagicEffect(getPlayerPosition(cid), 12)
    talk_state = 0
    return true
    else
    npcHandler:say("You aren't looking really bad. Sorry, I can't help you.", 1)
    return true
    end
    talk_state = 0
end       
    if(npcHandler.focus ~= cid) then
        return false
    end   
   
if msgcontains(msg, 'bless') then
    npcHandler:say("There are five different blessings available in five sacred places. These blessings are: the spiritual shielding, the spark of the phoenix, the embrace of tibia, the fire of the suns and the wisdom of solitude.", 1)
    talk_state = 0

elseif msgcontains(msg, 'embrace') or msgcontains(msg, 'of tibia') then
    npcHandler:say("I will give to you the embrace of tibia, but you will have to make a sacrifice. Are you prepared to pay 10.000 gold for the blessing?", 1)
    talk_state = 1394


elseif talk_state == 1394 and msgcontains(msg, 'yes') then
    if doPlayerRemoveMoney(cid, 10000) == TRUE then
        if AddPlayerBlessing(cid, 2) == true then
        npcHandler:say("So receive the embrace of tibia, pilgrim.", 1)
        doSendMagicEffect(getPlayerPosition(cid), 13)
        setPlayerStorageValue(cid, 30006, 1)
        talk_state = 0       
        else
        doPlayerAddMoney(cid, 10000)
        npcHandler:say("You already possess this blessing.", 1)
        talk_state = 0           
        end
    else
    npcHandler:say("Oh. You do not have enough money.", 1)
    talk_state = 0   
    end
   
elseif talk_state == 1394 and msgcontains(msg, '') then
    npcHandler:say("Ok. Suits me.", 1)
    talk_state = 0   
   
elseif msgcontains(msg, 'phoenix') then
    npcHandler:say("The spark of the phoenix is given by the dwarven priests of earth and fire in Kazordoon.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'embrace') then
    npcHandler:say("The druids north of Carlin will provide you with the embrace of tibia.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'suns') then
    npcHandler:say("You can ask for the blessing of the two suns in the suntower near Ab'Dendriel.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'wisdom') then
    npcHandler:say("Talk to the hermit Eremo on the isle of Cormaya about this blessing.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'spiritual') then
    npcHandler:say("You can ask for the blessing of spiritual shielding the whiteflower temple south of Thais.", 1)
    talk_state = 0
end   
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Edala (Suns):
Lua:
dofile(getDataDir() .. 'global/greeting.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

keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am a mystic of the suns. I provide protective blessings for those in need."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My name is Edala, pilgrim."})
keywordHandler:addKeyword({'mystic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We mystics are philosophers and healers."})
keywordHandler:addKeyword({'cenath'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't consider me a member of any caste, and I don't want to talk about this matter."})
keywordHandler:addKeyword({'kuridai'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't consider me a member of any caste, and I don't want to talk about this matter."})
keywordHandler:addKeyword({'deraisim'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't consider me a member of any caste, and I don't want to talk about this matter."})
keywordHandler:addKeyword({'abdaisim'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't consider me a member of any caste, and I don't want to talk about this matter."})
keywordHandler:addKeyword({'teshial'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't consider me a member of any caste, and I don't want to talk about this matter."})
keywordHandler:addKeyword({'crunor'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Crunor is great in his beauty."})
keywordHandler:addKeyword({'priyla'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The daughter of the stars is my patron."})
keywordHandler:addKeyword({'excalibug'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It is true that this weapon brings great power. But you should not look for power. It is wisdom you really need."})
keywordHandler:addKeyword({'new'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "News? I don't care about news."})

function creatureSayCallback(cid, type, msg)
    if(npcHandler.focus ~= cid) then
        return false
    end

if msgcontains(msg, 'heal') then
if getCreatureHealth(cid) <= 39 then
    npcHandler:say("You are looking really bad. Let me heal your wounds.", 1)
    doCreatureAddHealth(cid, -getCreatureHealth(cid)+40)
    doSendMagicEffect(getPlayerPosition(cid), 12)
    talk_state = 0
    return true
    else
    npcHandler:say("You aren't looking really bad. Sorry, I can't help you.", 1)
    return true
    end
    talk_state = 0
end       
    if(npcHandler.focus ~= cid) then
        return false
    end   
   
if msgcontains(msg, 'bless') then
    npcHandler:say("There are five different blessings available in five sacred places. These blessings are: the spiritual shielding, the spark of the phoenix, the embrace of tibia, the fire of the suns and the wisdom of solitude.", 1)
    talk_state = 0

elseif msgcontains(msg, 'fire') or msgcontains(msg, 'sun') then
    npcHandler:say("Do you wish to receive the blessing of the two suns? It will cost you 10.000 gold, pilgrim.", 1)
    talk_state = 1394


elseif talk_state == 1394 and msgcontains(msg, 'yes') then
    if doPlayerRemoveMoney(cid, 10000) == TRUE then
        if AddPlayerBlessing(cid, 3) == true then
        npcHandler:say("Kneel down and receive the warmth of sunfire, pilgrim.", 1)
        doSendMagicEffect(getPlayerPosition(cid), 13)
        setPlayerStorageValue(cid, 30006, 1)
        talk_state = 0       
        else
        doPlayerAddMoney(cid, 10000)
        npcHandler:say("You already possess this blessing.", 1)
        talk_state = 0           
        end
    else
    npcHandler:say("Oh. You do not have enough money.", 1)
    talk_state = 0   
    end
   
elseif talk_state == 1394 and msgcontains(msg, '') then
    npcHandler:say("Ok. Suits me.", 1)
    talk_state = 0   
   
elseif msgcontains(msg, 'phoenix') then
    npcHandler:say("The spark of the phoenix is given by the dwarven priests of earth and fire in Kazordoon.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'embrace') then
    npcHandler:say("The druids north of Carlin will provide you with the embrace of tibia.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'suns') then
    npcHandler:say("You can ask for the blessing of the two suns in the suntower near Ab'Dendriel.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'wisdom') then
    npcHandler:say("Talk to the hermit Eremo on the isle of Cormaya about this blessing.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'spiritual') then
    npcHandler:say("You can ask for the blessing of spiritual shielding the whiteflower temple south of Thais.", 1)
    talk_state = 0
end   
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Eremo (Solitude):
Lua:
dofile(getDataDir() .. 'global/greeting.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

function greetCallback(cid)
    if getPlayerVocation(cid) >= 5 and getPlayerVocation(cid) <= 8 then
    npcHandler:setMessage(MESSAGE_GREET, "Welcome to my little garden, humble ".. getPlayerName(cid) .."!")
    return true
    else
    npcHandler:setMessage(MESSAGE_GREET, "Welcome to my little garden, adventurer ".. getPlayerName(cid) .."!")
    return true
    end   
end   

npcHandler:setCallback(CALLBACK_GREET, greetCallback)

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'amulet of loss'},                         ID_amuletofloss, 50000)
shopModule:addBuyableItem({'protection amulet'},                     ID_protectionamulet, 700, 250)

keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am Eremo, an old man who has seen many things."})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I teach some spells, provide one of the five blessings, and sell some amulets."})
keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I teach some spells, provide one of the five blessings, and sell some amulets."})
keywordHandler:addKeyword({'magic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I teach some spells, provide one of the five blessings, and sell some amulets."})
keywordHandler:addKeyword({'island'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I have retired from my adventures to this place"})
keywordHandler:addKeyword({'isle'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I have retired from my adventures to this place"})
keywordHandler:addKeyword({'garden'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I have retired from my adventures to this place"})
keywordHandler:addKeyword({'adventure'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I explored dungeons, I walked through deserts, I sailed on the seas and climbed up on many a mountain."})
keywordHandler:addKeyword({'thing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I explored dungeons, I walked through deserts, I sailed on the seas and climbed up on many a mountain."})
keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "A great world full of magic and wonder."})
keywordHandler:addKeyword({'amulet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I've collected quite a few protection amulets, and some amulets of loss as well. Also, I'm interested in buying broken amulets."})

function creatureSayCallback(cid, type, msg)
    if(npcHandler.focus ~= cid) then
        return false
    end
   
if msgcontains(msg, 'spell') then
    if getPlayerVocation(cid) >= 5 and getPlayerVocation(cid) <= 8 then
    npcHandler:say("I can teach 'Enchant Staff' to sorcerers, 'Challenge' to knights, 'Wild Growth' to druids, and 'Power Bolt' to paladins.", 1)
    else
    npcHandler:say("I am sorry, but you are not promoted yet.", 1)
    end
    talk_state = 0
   
elseif msgcontains(msg, 'enchant staff') or msgcontains(msg, 'Enchant Staff') then
    spellprice = 2000
    spellvoc = {5}
    spellname = "Enchant Staff"
    spellmagiclevel = 22
        if isInArray(spellvoc, getPlayerVocation(cid)) == 1 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 master sorcerers", 1)
        talk_state = 0
        end
       
elseif msgcontains(msg, 'challenge') or msgcontains(msg, 'Challenge') then
    spellprice = 2000
    spellvoc = {8}
    spellname = "challenge"
    spellmagiclevel = 4
        if isInArray(spellvoc, getPlayerVocation(cid)) == 1 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 elite knights", 1)
        talk_state = 0
        end
       
elseif msgcontains(msg, 'wild growth') or msgcontains(msg, 'Wild growth') then
    spellprice = 2000
    spellvoc = {6}
    spellname = "wild growth"
    spellmagiclevel = 13
        if isInArray(spellvoc, getPlayerVocation(cid)) == 1 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 elder druids", 1)
        talk_state = 0
        end
       
elseif msgcontains(msg, 'power bolt') or msgcontains(msg, 'Power bolt') then
    spellprice = 2000
    spellvoc = {7}
    spellname = "conjure power bolt"
    spellmagiclevel = 14
        if isInArray(spellvoc, getPlayerVocation(cid)) == 1 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
--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)) == 1 then
        if getPlayerMagLevel(cid) >= spellmagiclevel then
            if getPlayerLearnedInstantSpell(cid, spellname) < 1 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--

--Teleport---
    elseif msgcontains(msg, 'teleport') or msgcontains(msg, 'pemaret') or msgcontains(msg, 'back') or msgcontains(msg, 'cormaya') or msgcontains(msg, 'edron') then
    npcHandler:say('Should I teleport you back to Pemaret?')
    talk_state = 2
   
    elseif msgcontains(msg, 'yes') and talk_state == 2 then
    selfSay('Here you go!')
    doTeleportThing(cid, {x=33288,y=31956,z=6})
    doSendMagicEffect(getCreaturePosition(cid), 10)
    elseif msgcontains(msg, 'no') and talk_state == 2 then
    npcHandler:say('Maybe later.')
    talk_state = 0
    end
   
    return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Kawill (Phoenix):
Lua:
dofile(getDataDir() .. 'global/greeting.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

function greetCallback(cid)
if getCreatureHealth(cid) <= 39 then
    npcHandler:setMessage(MESSAGE_GREET, "You are looking really bad, ".. getPlayerName(cid) ..". Let me heal your wounds.")
    doCreatureAddHealth(cid, -getCreatureHealth(cid)+40)
    doSendMagicEffect(getPlayerPosition(cid), 12)
    talk_state = 0
    return true
    else
    npcHandler:setMessage(MESSAGE_GREET, "Welcome ".. getPlayerName(cid) .."! May earth protect you!")
    return true
    end
end   
npcHandler:setCallback(CALLBACK_GREET, greetCallback)


keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am the great geomancer of dwarvenkind."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am Kawill Marbleeye, Son of Earth, from the Molten Rock."})
keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Nice world in general. It's a shame there is so much water ruining the general impression."})
keywordHandler:addKeyword({'kazordoon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "By using the powers of fire and earth we forced the river that once wound its way through the big old one in other directions, and created our home."})
keywordHandler:addKeyword({'old'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The mountain we live in is called the big old one. It's the mountain of mountains, and it isand like a friend and protector to our race."})
keywordHandler:addKeyword({'elves'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Who cares for that silly people."})
keywordHandler:addKeyword({'human'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We are allied with this young race, though they seldom have the wisdom to listen to us."})
keywordHandler:addKeyword({'orc'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Stupid beasts. Their savagery is only rivalled by their smell."})
keywordHandler:addKeyword({'minotaur'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They lost their way long ago. Now they are lost and doomed. It should be a warning to all of us."})
keywordHandler:addKeyword({'geomancer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We investigate the will of the earth. It is our duty to make sure things to work in their natural way."})
keywordHandler:addKeyword({'god'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The gods are treacherous and vain. They want to use us like they did in the past. Only the elements can be trusted, because all they want is for nature to run its set course."})
keywordHandler:addKeyword({'earth'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The lifegiving earth protects us, feeds us and takes us home after death."})
keywordHandler:addKeyword({'fire'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Where earth is giving, fire is taking. That is the way of the elements."})
keywordHandler:addKeyword({'life'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Life is born by earth and fed by earth."})
keywordHandler:addKeyword({'plant'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Plants are minor messengers of earth. If you understand the soil you understand the plants."})
keywordHandler:addKeyword({'citizen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Many people are living in the embracement of earth in Kazordoon."})
keywordHandler:addKeyword({'kroox'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a fine smith and his armour may save your neck one day."})
keywordHandler:addKeyword({'jimbin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a jolly fellow and one of the oldest dwarves alive."})
keywordHandler:addKeyword({'maryza'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "She is a fine cook, jawoll."})
keywordHandler:addKeyword({'bezil'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Bezil and Nezil have pawn and equpiment shop with an amazing stock."})
keywordHandler:addKeyword({'nezil'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Bezil and Nezil have pawn and equpiment shop with an amazing stock."})
keywordHandler:addKeyword({'uzgod'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Uzgod is a blacksmith and understands the ways of his element well."})
keywordHandler:addKeyword({'etzel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I fear the sorcerers focus on the destructive forces of fire. They forget about the protection earth could provide."})
keywordHandler:addKeyword({'motos'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The scars in this dwarf's face tell the tale of many a great battle."})
keywordHandler:addKeyword({'durin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The celestial paladin, the protector of our race. The only divine being we care for and the only one who still cares for dwarfs."})
keywordHandler:addKeyword({'duria'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The first knight of dwarvenkind is a fine woman."})
keywordHandler:addKeyword({'emperor'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The emperor has rarely visited the temple district in the last years. He should care more about spirituality then about politics. Jawoll."})
keywordHandler:addKeyword({'kruzak'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The emperor has rarely visited the temple district in the last years. He should care more about spirituality then about politics. Jawoll."})
keywordHandler:addKeyword({'pyromancer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They are the followers of the great flame."})
keywordHandler:addKeyword({'technomancer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "FOOLS! FOOLS! ALL OF THEM! MAY EARTH SWALLOW THEM ALL!"})
keywordHandler:addKeyword({'motos'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He finally made his peace with his own heart."})
keywordHandler:addKeyword({'general'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He finally made his peace with his own heart."})
keywordHandler:addKeyword({'army'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our fortresses are strong and easy to defend. Any aggressor will be smashed by our armies. Most intruders will not get manage to pass the colossus."})
keywordHandler:addKeyword({'colossus'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The big fortress that guards our realm is shaped like a dwarf."})
keywordHandler:addKeyword({'ferumbras'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The day will come when he finally bites the dust."})
keywordHandler:addKeyword({'excalibug'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ah, a weapon to be feared by man, beast and god alike, jawoll. He who wields it will be both blessed and cursed at the same time."})
keywordHandler:addKeyword({'new'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There will be nothing new, but every pain and every pleasure will return to you, and all in the same order. The eternal hour glass of existence will be turned again and again, and you will be turned with it, little speck of dust."})
keywordHandler:addKeyword({'Nietzsche'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "In his mind he might have been a giant, but in his heart he was a dwarf."})
keywordHandler:addKeyword({'monster'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "May the earth swallow them all!"})
keywordHandler:addKeyword({'stone golem'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "These beings are filled with the power of earth. Therefore they, too, are sacred in a way."})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am a mere diviner of earth's will and not allowed to help you."})
keywordHandler:addKeyword({'quest'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There's nothing I need, better ask others."})
keywordHandler:addKeyword({'task'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There's nothing I need, better ask others."})
keywordHandler:addKeyword({'what'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There's nothing I need, better ask others."})
keywordHandler:addKeyword({'gold'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "gold is one of earth's treasures. To have gold is to be blessed by earth. To be rich is to be favoured by earth."})
keywordHandler:addKeyword({'money'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "gold is one of earth's treasures. To have gold is to be blessed by earth. To be rich is to be favoured by earth."})
keywordHandler:addKeyword({'equipment'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You can buy equiment in Bezil's and Nezil's little shop."})
keywordHandler:addKeyword({'fight'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Never forget your defence when fighting."})
keywordHandler:addKeyword({'time'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Time is not of importance."})


function creatureSayCallback(cid, type, msg) msg = string.lower(msg)

if msgcontains(msg, 'heal') then
if getCreatureHealth(cid) <= 64 then
    npcHandler:say("You are looking really bad. Let me heal your wounds.", 1)
    doCreatureAddHealth(cid, -getCreatureHealth(cid)+65)
    doSendMagicEffect(getPlayerPosition(cid), 12)
    talk_state = 0
    return true
    else
    npcHandler:say("You aren't looking really bad. Sorry, I can't help you.", 1)
    return true
    end
    talk_state = 0
end       
    if(npcHandler.focus ~= cid) then
        return false
    end   
   
if msgcontains(msg, 'bless') then
    npcHandler:say("There are five different blessings available in five sacred places. These blessings are: the spiritual shielding, the spark of the phoenix, the embrace of tibia, the fire of the suns and the wisdom of solitude.", 1)
    talk_state = 0

elseif msgcontains(msg, 'spark') or msgcontains(msg, 'phoenix') then
    npcHandler:say("The spark of the phoenix is given by me and by the great pyromancer in the nearby firetemple. Do you wish to receive my part of the blessing of the phoenix?", 1)
    talk_state = 1394


elseif talk_state == 1394 and msgcontains(msg, 'yes') then
    if getPlayerStorageValue(cid, 1339) <= 0 then
    setPlayerStorageValue(cid, 1339, 1)
    npcHandler:say("So receive the blessing of the live-giving earth, pilgrim.", 1)
    doSendMagicEffect(getPlayerPosition(cid), 13)
    talk_state = 0       
    else
    npcHandler:say("You already possess my blessing.", 1)
    talk_state = 0           
    end
   
elseif talk_state == 1394 and msgcontains(msg, '') then
    npcHandler:say("Ok. If you don't want it ... .", 1)
    talk_state = 0   
   
elseif msgcontains(msg, 'phoenix') then
    npcHandler:say("The spark of the phoenix is given by the dwarven priests of earth and fire in Kazordoon.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'embrace') then
    npcHandler:say("The druids north of Carlin will provide you with the embrace of tibia.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'suns') then
    npcHandler:say("You can ask for the blessing of the two suns in the suntower near Ab'Dendriel.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'wisdom') then
    npcHandler:say("Talk to the hermit Eremo on the isle of Cormaya about this blessing.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'spiritual') then
    npcHandler:say("You can ask for the blessing of spiritual shielding the whiteflower temple south of Thais.", 1)
    talk_state = 0
end   
end


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Pydar (second part of Phoenix):
Lua:
dofile(getDataDir() .. 'global/greeting.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

function greetCallback(cid)
if getCreatureHealth(cid) <= 39 then
    npcHandler:setMessage(MESSAGE_GREET, "You are looking really bad, ".. getPlayerName(cid) ..". Let me heal your wounds.")
    doCreatureAddHealth(cid, -getCreatureHealth(cid)+40)
    doSendMagicEffect(getPlayerPosition(cid), 12)
    talk_state = 0
    return true
    else
    npcHandler:setMessage(MESSAGE_GREET, "Welcome ".. getPlayerName(cid) .."! May earth protect you!")
    return true
    end
end   
npcHandler:setCallback(CALLBACK_GREET, greetCallback)

keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am the head pyromancer of Kazordoon."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My name is Pydar Firefist, Son of Fire, from the Savage Axes."})
keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "That is our world."})
keywordHandler:addKeyword({'kazordoon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our city was founded in ancient times. Abandoned by the gods we once fought for, we created a secure haven for our people."})
keywordHandler:addKeyword({'old'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "This mountain is said to be the oldest in the world. It is the place where fire and earth meet and separate at the same time."})
keywordHandler:addKeyword({'elves'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Stupid race. They have no understanding of the ways of the world."})
keywordHandler:addKeyword({'human'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They took the place dwarves once held in the world. They don't see that they are destined to fall just like we did."})
keywordHandler:addKeyword({'orc'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The arch enemy. We could have destroyed them long ago, but this would have meant doing a favour to the gods which betrayed us."})
keywordHandler:addKeyword({'minotaur'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Another pawn the gods do not care for any longer. A discarded toy like all of the elder races."})
keywordHandler:addKeyword({'pyromanacer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We are the keepers and shepherds of the elemental force of fire."})
keywordHandler:addKeyword({'god'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The ways of the gods are imprehensible to mortals. On the other hand, the elements are raw forces and can be understood and tamed."})
keywordHandler:addKeyword({'fire'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Unlike the gods, the elements don't use mortals as toys, A skilled mind can understand and even control them to some extent."})
keywordHandler:addKeyword({'flame'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Unlike the gods, the elements don't use mortals as toys, A skilled mind can understand and even control them to some extent."})
keywordHandler:addKeyword({'durin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Though we are through with the so-called gods, Durin, the first dwarf to aquire divine powers of his own, is considered a protector of our race."})
keywordHandler:addKeyword({'life'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Life feeds on fire and ultimately fire will feed on life."})
keywordHandler:addKeyword({'plant'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't care much about plants."})
keywordHandler:addKeyword({'citizen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Many brave people are citizens of our town."})
keywordHandler:addKeyword({'kroox'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a smith. If you are looking for exquisite weapons and armour just talk to him."})
keywordHandler:addKeyword({'jimbin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He and his wife are running the Jolly Axeman tavern."})
keywordHandler:addKeyword({'maryza'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "She and her husband are running the Jolly Axeman tavern."})
keywordHandler:addKeyword({'bezil'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Bezil and Nezil are buying and selling equipment of all kinds."})
keywordHandler:addKeyword({'nezil'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Bezil and Nezil are buying and selling equipment of all kinds."})
keywordHandler:addKeyword({'uzgod'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Uzgod is a weaponsmith just like those in the old legends."})
keywordHandler:addKeyword({'etzel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Etzel is a true master of the elements. He is a role-model for our youngsters, jawoll."})
keywordHandler:addKeyword({'gregor'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The leader of the Thaian Knights' guild is a man of few words."})
keywordHandler:addKeyword({'duria'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "She is the first knight of Kazordoon. She is responsible for teaching our young warriors how to handle an axe."})
keywordHandler:addKeyword({'emperor'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our emperor has his halls in the upper caves."})
keywordHandler:addKeyword({'kruzak'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our emperor has his halls in the upper caves."})
keywordHandler:addKeyword({'geomancer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They are followers of the path of earth."})
keywordHandler:addKeyword({'technomancer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Those heretics believe they have discovered a new elemental force they can control easily. These fools, they'll bring doom on us all!"})
keywordHandler:addKeyword({'motos'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is the fiercest axefighter of our times and a fine strategist."})
keywordHandler:addKeyword({'general'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is the fiercest axefighter of our times and a fine strategist."})
keywordHandler:addKeyword({'army'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our armies can defend Kazordoon against any threat by means of its strong  fortifications."})
keywordHandler:addKeyword({'ferumbras'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "If he ever dares enter Kazordoon I will gladly dump him into the lava. Tthe sacred flame shall bring justice upon him."})
keywordHandler:addKeyword({'excalibug'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "A weapon too powerful to be wielded by mortals. It has to be returned to the fire which gave birth to it."})
keywordHandler:addKeyword({'news'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am a busy man. I have no time for idle chitchat."})
keywordHandler:addKeyword({'monster'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "May the great flame devour them all!"})
keywordHandler:addKeyword({'devil'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They mock the great flame by their existence. BLAST THEM ALL! Jawoll!"})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I an not here to help; you have to help yourself."})
keywordHandler:addKeyword({'quest'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ask around. There's a lot to do, jawoll."})
keywordHandler:addKeyword({'gold'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Gold has been given birth to by the great flame. So it is wise to give some back to the fire now and then."})
keywordHandler:addKeyword({'money'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Gold has been given birth to by the great flame. So it is wise to give some back to the fire now and then."})
keywordHandler:addKeyword({'equipment'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Bezil and Nezil are runing a shop where you can buy all the stuff you need."})
keywordHandler:addKeyword({'fight'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You should fight like fire, fearless and without mercy."})


function creatureSayCallback(cid, type, msg) msg = string.lower(msg)

if msgcontains(msg, 'heal') then
if getCreatureHealth(cid) <= 64 then
    npcHandler:say("You are looking really bad. Let me heal your wounds.", 1)
    doCreatureAddHealth(cid, -getCreatureHealth(cid)+65)
    doSendMagicEffect(getPlayerPosition(cid), 12)
    talk_state = 0
    return true
    else
    npcHandler:say("You aren't looking really bad. Sorry, I can't help you.", 1)
    return true
    end
    talk_state = 0
end       
    if(npcHandler.focus ~= cid) then
        return false
    end   
   
if msgcontains(msg, 'bless') then
    npcHandler:say("There are five different blessings available in five sacred places. These blessings are: the spiritual shielding, the spark of the phoenix, the embrace of tibia, the fire of the suns and the wisdom of solitude.", 1)
    talk_state = 0

elseif msgcontains(msg, 'spark') or msgcontains(msg, 'phoenix') then
    npcHandler:say("The spark of the phoenix is given by me and by the great geomancer of the local earthtemple. Do you wish to receive my part of blessing of the phoenix for 10.000 gold?", 1)
    talk_state = 1394


elseif talk_state == 1394 and msgcontains(msg, 'yes') then
    if getPlayerStorageValue(cid, 1339) >= 1 then
        if doPlayerRemoveMoney(cid, 10000) == TRUE then
            if AddPlayerBlessing(cid, 5) == true then
            npcHandler:say("So receive the mark of the flame and be blessed by the phoenix, pilgrim.", 1)
            doSendMagicEffect(getPlayerPosition(cid), 13)
            setPlayerStorageValue(cid, 30006, 1)
            setPlayerStorageValue(cid, 1339, 0) -- Bless storage (kazordoon bless check)
            talk_state = 0       
            else
            doPlayerAddMoney(cid, 10000)
            npcHandler:say("You already possess this blessing.", 1)
            talk_state = 0           
            end
        else
        npcHandler:say("Oh. You do not have enough money.", 1)
        talk_state = 0           
        end
    else
    npcHandler:say("You need the blessing of the great geomancer first.", 1)
    talk_state = 0   
    end
   
elseif talk_state == 1394 and msgcontains(msg, '') then
    npcHandler:say("Ok. Suits me.", 1)
    talk_state = 0   
   
elseif msgcontains(msg, 'phoenix') then
    npcHandler:say("The spark of the phoenix is given by the dwarven priests of earth and fire in Kazordoon.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'embrace') then
    npcHandler:say("The druids north of Carlin will provide you with the embrace of tibia.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'suns') then
    npcHandler:say("You can ask for the blessing of the two suns in the suntower near Ab'Dendriel.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'wisdom') then
    npcHandler:say("Talk to the hermit Eremo on the isle of Cormaya about this blessing.", 1)
    talk_state = 0
   
elseif msgcontains(msg, 'spiritual') then
    npcHandler:say("You can ask for the blessing of spiritual shielding the whiteflower temple south of Thais.", 1)
    talk_state = 0
end   
    return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top