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

[NPC] Sell an item

Epic

Banned User
Joined
Mar 30, 2009
Messages
1,142
Reaction score
1
Location
Barcelona (Spain)
How can i make my Food npc sell a "green flask" ( ItemID 2009 ) for 10000gp ( 1cc ) ???

Here is the XML i use:
Code:
<npc name="Food" script="data/npc/scripts/food.lua" walkinterval="25" floorchange="0" access="3" level="1" maglevel="1">
	<health now="150" max="150"/>
	<look type="128" head="20" body="100" legs="50" feet="99" corpse="2212" addons="3"/>
	<parameters>
		<parameter key="module_shop" value="1" />
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell brown bread(4gp), ham(8gp), meat(5gp), cheese(6gp) and cookies(5gp)!" />
		<parameter key="shop_buyable" value="brown bread,2691,4;ham,2671,8;;meat,2666,5;;cheese,2696,6;;cookie,2687,5;;" />
	</parameters>
</npc>

and here is the Script:
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

npcHandler:addModule(FocusModule:new())

I really need it :p
Rep++ if works! :D
 
Code:
	<parameter key="shop_buyable" value="[b]green flask,2009,10000;[/b]brown bread,2691,4;ham,2671,8;;meat,2666,5;;cheese,2696,6;;cookie,2687,5;;" />
 
I think your using an updated TFS so that system doesnt work anymore.

Heres an example of a seller.

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({'Green Flask'}, 2009, 10000, 'green flask')

npcHandler:addModule(FocusModule:new())
 
I think your using an updated TFS so that system doesnt work anymore.

Heres an example of a seller.

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({'Green Flask'}, 2009, 10000, 'green flask')

npcHandler:addModule(FocusModule:new())

Thanks, now it sells on the trade window! :D
+rep
 

Similar threads

Back
Top