Darqneez
ShaC-Ohhhh
I'd like to make my own npc, which would buy some items, and I made a script for this, but it doesnt work. Can someone help me to solve it? here's script:
and Lua:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Kowal" script="kowal.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="131" head="0" body="114" legs="114" feet="0" addons="3"/>
<parameters>
<parameter key="message_greet" value="Witaj |PLAYERNAME|, Masz moze towary, ktore mnie interesuja?" />
</parameters>
</npc>
and Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addSellableItem({''}, 2463, 1000, 'devil helmet')
shopModule:addSellableItem({''}, 2491, 2500, 'crown helmet')
shopModule:addSellableItem({''}, 2497, 6000, 'crusader helmet')
shopModule:addSellableItem({''}, 2475, 5000, 'warrior helmet')
shopModule:addSellableItem({''}, 2498, 30000, 'royal helmet')
shopModule:addSellableItem({''}, 2656, 10000, 'blue robe')
shopModule:addSellableItem({''}, 2476, 5000, 'knight armor')
shopModule:addSellableItem({''}, 2487, 12000, 'crown armor')
shopModule:addSellableItem({''}, 8891, 15000, 'paladin armor')
shopModule:addSellableItem({''}, 2492, 40000, 'dragon scale mail')
shopModule:addSellableItem({''}, 2466, 20000, 'golden armor')
shopModule:addSellableItem({''}, 2472, 200000, 'magic plate armor')
shopModule:addSellableItem({''}, 2488, 12000, 'crown legs')
shopModule:addSellableItem({''}, 2477, 5000, 'knight legs')
shopModule:addSellableItem({''}, 2470, 80000, 'golden legs')
shopModule:addSellableItem({''}, 2195, 30000, 'boots of haste')
shopModule:addSellableItem({''}, 2645, 30000, 'steel boots')
shopModule:addSellableItem({''}, 2515, 2000, 'guardian shield')
shopModule:addSellableItem({''}, 2516, 4000, 'dragon shield')
shopModule:addSellableItem({''}, 2519, 8000, 'crown shield')
shopModule:addSellableItem({''}, 2528, 8000, 'tower shield')
shopModule:addSellableItem({''}, 2536, 9000, 'medusa shield')
shopModule:addSellableItem({''}, 2534, 15000, 'vampire shield')
shopModule:addSellableItem({''}, 2520, 30000, 'demon shield')
shopModule:addSellableItem({''}, 2514, 70000, 'mastermind shield')
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())