Peonso
Godly Member
- Joined
- Jan 14, 2008
- Messages
- 1,749
- Solutions
- 30
- Reaction score
- 1,534
You restarted the server? I don't know if it reloads lib files. Try those:
Code:
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
function creatureSayCallback(cid, type, msg) msg = string.lower(msg)
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg, 'vial') then
NPCSay("I will give you 5 gold for every empty vial of yours, accept?", 1)
npc01_talk_state = 857
elseif npc01_talk_state == 857 and msgcontains(msg, 'yes') then
if SellPlayerEmptyVials(cid) == true then
NPCSay("Here's your money!", 1)
npc01_talk_state = 0
else
NPCSay("You don't have any empty vials!", 1)
npc01_talk_state = 0
end
end
end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
-- Spell Book
shopModule:addBuyableItem({'spellbook'}, 2175, 150, 'spellbook')
-- Fluids
shopModule:addBuyableItem({'life fluid','lifefluid','health potion','healthpotion','health'}, 2006, 60,10,'life fluid')
shopModule:addBuyableItem({'mana fluid','manafluid','mana potion','manapotion','mana'},2006,55,7,'mana fluid')
-- Runes
shopModule:addBuyableItem({'blank', 'rune'},2260, 10,'blank rune')
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Code:
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
function creatureSayCallback(cid, type, msg) msg = string.lower(msg)
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg, 'vial') then
NPCSay("I will give you 5 gold for every empty vial of yours, accept?", 1)
npc01_talk_state = 857
elseif npc01_talk_state == 857 and msgcontains(msg, 'yes') then
if SellPlayerEmptyVials(cid) == true then
NPCSay("Here's your money!", 1)
npc01_talk_state = 0
else
NPCSay("You don't have any empty vials!", 1)
npc01_talk_state = 0
end
end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
-- Spell Book
shopModule:addBuyableItem({'spellbook'}, 2175, 150, 'spellbook')
-- Fluids
shopModule:addBuyableItem({'life fluid','lifefluid','health potion','healthpotion','health'}, 2006, 60,10,'life fluid')
shopModule:addBuyableItem({'mana fluid','manafluid','mana potion','manapotion','mana'},2006,55,7,'mana fluid')
-- Runes
shopModule:addBuyableItem({'blank', 'rune'},2260, 10,'blank rune')
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())