Bigharry1991
New Member
- Joined
- Jun 29, 2009
- Messages
- 17
- Reaction score
- 1
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Loot Buyer" script="loot.lua" talkradius="3" walkradius="3" walkinterval="1500" floorchange="0">
<health now="100" max="100"/>
<look type="140" head="39" body="122" legs="125" feet="57" addons="0"/>
</npc>
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local TopicState = {}
-- 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 onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end
function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
-- Buy
-- Sell
shopModule:addSellableItem({"Amazon Armor"}, 2500, 7500)
function creatureSayCallback(cid, type, msg)
if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
npcHandler:say("Hi you have come to sell me some cool items?", cid)
npcHandler:addFocus(cid)
TopicState[cid] = 0
elseif(not npcHandler:isFocused(cid)) then
return false
elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
npcHandler:say("later dude", cid, TRUE)
npcHandler:releaseFocus(cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "rude message")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Thank you")
npcHandler:setMessage(MESSAGE_ONCLOSESHOP, "bye")
Whats wrong with this script i keep getting I am using The Forgotten Server - Edited By Cyko V8, version 0.3.6
[05/06/2013 13:40:51] [Error - Npc interface]
[05/06/2013 13:40:51] (Unknown script file)
[05/06/2013 13:40:51] Description:
[05/06/2013 13:40:51] data/npc/lib/npcsystem/modules.lua:1229: bad argument #2 to 'error' (number expected, got string)
[05/06/2013 13:40:51] stack traceback:
[05/06/2013 13:40:51] [C]: in function 'error'
[05/06/2013 13:40:51] data/npc/lib/npcsystem/modules.lua:1229: in function 'callbackOnSell'
[05/06/2013 13:40:51] data/npc/lib/npcsystem/npchandler.lua:265: in function 'processModuleCallback'
[05/06/2013 13:40:51] data/npc/lib/npcsystem/npchandler.lua:450: in function 'onSell'
[05/06/2013 13:40:51] data/npc/lib/npcsystem/modules.lua:1296: in function <data/npc/lib/npcsystem/modules.lua:1295>