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

Problem with npc

Snoker

New Member
Joined
Apr 6, 2009
Messages
131
Reaction score
0
My npc of paladins, sell everything twice, if i buy spear, i get spear, and more spear, another sqm
 
tfs 0.3.2
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

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

shopModule:addBuyableItem({'bow'}, 2456, 400, 'bow')
shopModule:addBuyableItem({'crossbow'}, 2455, 500, 'crossbow')

shopModule:addSellableItem({'bow'}, 2456, 130, 'bow')
shopModule:addSellableItem({'crossbow'}, 2455, 160, 'crossbow')

shopModule:addBuyableItem({'spear'}, 2389, 10, 'spear')
shopModule:addBuyableItem({'royal spear'}, 7378, 25, 'royal spear')
shopModule:addBuyableItem({'assassin star'}, 7368, 200, 'assassin star')
shopModule:addSellableItem({'hunting spear'}, 3965, 15, 'hunting spear')

shopModule:addBuyableItem({'arrow'}, 2544, 3, 'arrow')
shopModule:addBuyableItem({'sniper arrow'}, 7364, 5, 'sniper arrow')
shopModule:addBuyableItem({'onyx arrow'}, 7365, 7, 'onyx arrow')

shopModule:addBuyableItem({'flaming arrow'}, 7840, 5, 'flaming arrow')
shopModule:addBuyableItem({'shiver arrow'}, 7839, 5, 'shiver arrow')
shopModule:addBuyableItem({'flash arrow'}, 7838, 5, 'flash arrow')
shopModule:addBuyableItem({'earth arrow'}, 7850, 5, 'earth arrow')

shopModule:addBuyableItem({'bolt'}, 2543, 4, 'bolt')
shopModule:addBuyableItem({'piercing bolt'}, 7363, 5, 'piercing bolt')
shopModule:addBuyableItem({'power bolt'}, 2547, 7, 'power bolt')


npcHandler:addModule(FocusModule:new())
 
Try this:

scripts/bows.lua
Lua:
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

npcHandler:addModule(FocusModule:new())

NPC Bowman.xml
Code:
<npc name="Bowman" script="data/npc/scripts/bows.lua" walkinterval="2000" floorchange="0" access="5" level="1" maglevel="1">
	<health now="150" max="150"/>
	<look type="142" head="79" body="118" legs="115" feet="114" addons="3" corpse="2212"/>
	<parameters>
		<parameter key="module_shop" value="1" />
		<parameter key="shop_buyable" value="crossbow,2455,160;enchanted spear,7367,100;assassin star,7368,100;bow,2456,130;spear,2389,1;royal,7378,50;bolt,2543,2;arrow,2544,1;power,2547,6" />
	</parameters>
</npc>


Hope it works for you.

Eeeh... Sorry! That was Hunter Addon! >.< My bad...




Zer0xe.
 
"My npc of paladins, sell everything twice, if i buy spear, i get spear, and more spear, another sqm "

That doesn't tell me anything, explain your problem and maybe someone will help you, instead of being rude to someone because they can't read your shit English :)
 
Back
Top