Venn
Member
- Joined
- Aug 16, 2009
- Messages
- 547
- Reaction score
- 20
i got this error when try to buy something from npc
and it make me cant buying ;/
do u know how i can fix it ?
for example npc look like this:
Perac:
distance.lua:
and it make me cant buying ;/
Code:
[07/10/2010 12:59:49] [Error - Npc interface]
[07/10/2010 12:59:49] (Unknown script file)
[07/10/2010 12:59:49] Description:
[07/10/2010 12:59:49] data/npc/lib/npcsystem/modules.lua:1151: bad argument #2 to 'error' (number expected, got string)
[07/10/2010 12:59:49] stack traceback:
[07/10/2010 12:59:49] [C]: in function 'error'
[07/10/2010 12:59:49] data/npc/lib/npcsystem/modules.lua:1151: in function 'callbackOnBuy'
[07/10/2010 12:59:50] data/npc/lib/npcsystem/npchandler.lua:263: in function 'processModuleCallback'
[07/10/2010 12:59:50] data/npc/lib/npcsystem/npchandler.lua:440: in function 'onBuy'
[07/10/2010 12:59:50] data/npc/lib/npcsystem/modules.lua:1292: in function <data/npc/lib/npcsystem/modules.lua:1291>
do u know how i can fix it ?
for example npc look like this:
Perac:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Perac" script="data/npc/scripts/Sell/Distance.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="78" body="52" legs="68" feet="114" addons="0"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|."/>
<parameter key="message_farewell" value="Good bye."/>
<parameter key="message_walkaway" value="Farewell then.." />
</parameters>
</npc>
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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'bow'}, 2456, 400, 'bow')
shopModule:addBuyableItem({'crossbow'}, 2455, 500, 'crossbow')
shopModule:addBuyableItem({'royal spear'}, 7378, 15, 'royal spear')
shopModule:addBuyableItem({'spear'}, 2389, 10, 'spear')
shopModule:addBuyableItem({'arrow'}, 2544, 3, 'arrow')
shopModule:addBuyableItem({'sniper arrow'}, 7364, 5, 'sniper arrow')
shopModule:addBuyableItem({'bolt'}, 2543, 4, 'bolt')
shopModule:addBuyableItem({'earth arrow'}, 7850, 5, 'earth arrow')
shopModule:addBuyableItem({'flaming arrow'}, 7840, 5, 'flaming arrow')
shopModule:addBuyableItem({'flash arrow'}, 7838, 5, 'flash arrow')
shopModule:addBuyableItem({'onyx arrow'}, 7365, 7, 'onyx arrow')
shopModule:addBuyableItem({'power bolt'}, 2547, 7, 'power bolt')
shopModule:addBuyableItem({'throwing star'}, 2399, 42, 'throwing star')
shopModule:addBuyableItem({'shiver arrow'}, 7839, 5, 'shiver arrow')
shopModule:addBuyableItem({'piercing bolt'}, 7363, 5, 'piercing bolt')
shopModule:addBuyableItem({'assassin star'}, 7368, 100, 'assassin star')
shopModule:addBuyableItem({'infernal bolt'}, 6529, 30, 'infernal bolt')
shopModule:addBuyableItem({'throwing knife'}, 2410, 25, 'throwing knife')
shopModule:addBuyableItem({'small stone'}, 1294, 1, 'small stone')
shopModule:addSellableItem({'bow'}, 2456, 130, 'bow')
shopModule:addSellableItem({'crossbow'}, 2455, 160, 'crossbow')
shopModule:addSellableItem({'spear'}, 2389, 3, 'spear')
npcHandler:addModule(FocusModule:new())
Last edited: