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

chaosb

www.originaltibia.com
Joined
Sep 14, 2008
Messages
267
Reaction score
0
Location
Poland
Hello


I am hoting avesta 7.6 with tfs npc
look:

me: Hi
Npc: Xodet: Hello Chaosb. What can i do for you?.
me: buy sd
Npc: Xodet: Do you want to buy 1 sudden death rune for 300 gold coins?
me: yes
and npc i nothing says i got error in console:

Lua Script Error: [Npc inferface]
data/npc/scripts/runes.lua:eek:nCreatureSay

data/npc/scripts/lib/npcsystem/modules.lua:720: attempt to call global 'doPlayerBuyitem' <a nil value>
stack traceback
data/npc/scripts/lib/npcsystem/modules.lua:720: in function 'callback' ssMessage'
data/npc/scripts/lib/npcsystem/keywordhandler.lua:47: in function processMessage'

and npc handler.lua in function 'onCreatureSay'



my runes.lua:

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



-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end
-- OTServ event handling functions end

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

shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 2187, 5000, 'wand of inferno')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic'}, 2189, 3000, 'wand of cosmic energy')
shopModule:addBuyableItem({'wand of plague', 'plague'}, 2188, 2000, 'wand of plague')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 500, 'wand of dragonbreath')
shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 2190, 10, 'wand of vortex')

shopModule:addBuyableItem({'tempest rod', 'tempest'}, 2183, 5000, 'tempest rod')
shopModule:addBuyableItem({'quagmire rod', 'quagmire'}, 2189, 3000, 'quagmire rod')
shopModule:addBuyableItem({'volcanic rod', 'volcanic'}, 2185, 2000, 'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 2186, 100, 'moonlight rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 2182, 10, 'snakebite rod')

shopModule:addBuyableItem({'light wand', 'lightwand'}, 2163, 500, 'magic light wand')
shopModule:addBuyableItem({'mana fluid', 'manafluid'}, 2006, 50, 7, 'mana fluid')
shopModule:addBuyableItem({'life fluid', 'lifefluid'}, 2006, 80, 10, 'life fluid')
shopModule:addBuyableItem({'heavy magic missile', 'hmm'}, 2311, 100, 5, 'heavy magic missile rune')
shopModule:addBuyableItem({'fire bomb', 'f b'}, 2305, 100, 3, 'fire bomb rune')
shopModule:addBuyableItem({'destroy field', 'df'}, 2261, 50, 3, 'destroy field rune')
shopModule:addBuyableItem({'great fireball', 'gfb'}, 2304, 150, 4, 'great fireball rune')
shopModule:addBuyableItem({'explo', 'xpl'}, 2313, 200, 3, 'explosion rune')
shopModule:addBuyableItem({'ultimate healing', 'uh'}, 2274, 150, 1, 'ultimate healing rune')
shopModule:addBuyableItem({'sudden death', 'sd'}, 2263, 300, 1, 'sudden death rune')
shopModule:addBuyableItem({'blank', 'rune'}, 2260, 10, 'blank rune')


npcHandler:addModule(FocusModule:new())



If someone help me i will give reput!!
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)



-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
-- OTServ event handling functions end

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

shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 2187, 5000, 'wand of inferno')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic'}, 2189, 3000, 'wand of cosmic energy')
shopModule:addBuyableItem({'wand of plague', 'plague'}, 2188, 2000, 'wand of plague')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 500, 'wand of dragonbreath')
shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 2190, 10, 'wand of vortex')

shopModule:addBuyableItem({'tempest rod', 'tempest'}, 2183, 5000, 'tempest rod')
shopModule:addBuyableItem({'quagmire rod', 'quagmire'}, 2189, 3000, 'quagmire rod')
shopModule:addBuyableItem({'volcanic rod', 'volcanic'}, 2185, 2000, 'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 2186, 100, 'moonlight rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 2182, 10, 'snakebite rod')

shopModule:addBuyableItem({'light wand', 'lightwand'}, 2163, 500, 'magic light wand')
shopModule:addBuyableItem({'mana fluid', 'manafluid'}, 2006, 50, 7, 'mana fluid')
shopModule:addBuyableItem({'life fluid', 'lifefluid'}, 2006, 80, 10, 'life fluid')
shopModule:addBuyableItem({'heavy magic missile', 'hmm'}, 2311, 100, 5, 'heavy magic missile rune')
shopModule:addBuyableItem({'fire bomb', 'f b'}, 2305, 100, 3, 'fire bomb rune')
shopModule:addBuyableItem({'destroy field', 'df'}, 2261, 50, 3, 'destroy field rune')
shopModule:addBuyableItem({'great fireball', 'gfb'}, 2304, 150, 4, 'great fireball rune')
shopModule:addBuyableItem({'explo', 'xpl'}, 2313, 200, 3, 'explosion rune')
shopModule:addBuyableItem({'ultimate healing', 'uh'}, 2274, 150, 1, 'ultimate healing rune')
shopModule:addBuyableItem({'sudden death', 'sd'}, 2263, 300, 1, 'sudden death rune')
shopModule:addBuyableItem({'blank', 'rune'}, 2260, 10, 'blank rune')
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

local items = {[1] = 2190, [2] = 2182, [5] = 2190, [6] = 2182}
if(msgcontains(msg, 'first rod') or msgcontains(msg, 'first wand')) then
if(isSorcerer(cid) or isDruid(cid)) then
if(getPlayerStorageValue(cid, 30002) == -1) then
selfSay('So you ask me for a {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '} to begin your advanture?', cid)
talkState[talkUser] = 1
else
selfSay('What? I have already gave you one {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '}!', cid)
end
else
selfSay('Sorry, you aren\'t a druid either a sorcerer.', cid)
end
elseif(msgcontains(msg, 'yes')) then
if(talkState[talkUser] == 1) then
doPlayerAddItem(cid, items[getPlayerVocation(cid)], 1)
selfSay('Here you are young adept, take care yourself.', cid)
setPlayerStorageValue(cid, 30002, 1)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
selfSay('Ok then.', cid)
talkState[talkUser] = 0


end

return true
end


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
<<< change it ;)
 
Back
Top