• 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 selling some items after have a storage

kacpersky

Mr. Brightside
Joined
Jan 25, 2009
Messages
499
Reaction score
3
hi !
sorry for my dumb question, but im learning :P
how i can set a npc who will be sell a bonus item, after doing a quest with storageid = xx ?
 
modules.lua

Code:
	-- tradeItem callback function. Makes the npc say the message defined by MESSAGE_BUY or MESSAGE_SELL
	function ShopModule.tradeItem(cid, message, keywords, parameters, node)

return (?)
 
I do not understand :/
Works great, but only in the window trade. If you type "sell / buy itemblabla" then it works only with the function "onTradeRequest. As above, how to disable command sell/buy item for this npc?

Code:
if(Modules == nil) then
	-- Constants used to separate buying from selling.
	SHOPMODULE_SELL_ITEM = 1
	SHOPMODULE_BUY_ITEM = 2
	SHOPMODULE_BUY_ITEM_CONTAINER = 3

	-- Constants used for shop mode. Notice: addBuyableItemContainer is working on all modes
	SHOPMODULE_MODE_TALK = 1 -- Old system used before Tibia 8.2: sell/buy item name
	SHOPMODULE_MODE_TRADE = 2 -- Trade window system introduced in Tibia 8.2
	SHOPMODULE_MODE_BOTH = 3 -- Both working at one time

This is modules.lua.
But how to turn only "SHOPMODULE_MODE_TRADE" in the npcdf.lua code?

-------
my npc:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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)

-- Huntsman rank:1
shopModule:addSellableItem({'antlers'}, 11208, 50, 'antlers')
shopModule:addSellableItem({'bloody pincer'}, 10549, 100, 'bloody pincer')
shopModule:addSellableItem({'crab pincers'}, 11183, 35, 'crab pincers')
shopModule:addSellableItem({'cyclops toe'}, 10573, 55, 'cyclops toe')
shopModule:addSellableItem({'frosty ear of a troll'}, 10564, 30, 'frosty ear of a troll')
shopModule:addSellableItem({'hydra head'}, 11193, 600, 'hydra head')
shopModule:addSellableItem({'lancer beetle shell'}, 11366, 80, 'lancer beetle shell')
shopModule:addSellableItem({'mutated bat ear'}, 10578, 420, 'mutated bat ear')
shopModule:addSellableItem({'sabretooth'}, 11222, 400, 'sabretooth')
shopModule:addSellableItem({'sandcrawler shell'}, 11367, 20, 'sandcrawler shell')
shopModule:addSellableItem({'scarab pincers'}, 10547, 280, 'scarab pincers')
shopModule:addSellableItem({'terramite legs'}, 11365, 60, 'terramite legs')
shopModule:addSellableItem({'terramite shell'}, 11363, 170, 'terramite shell')
shopModule:addSellableItem({'terrorbird beak'}, 11184, 95, 'terrorbird beak')

function onTradeRequest(cid)
	return getPlayerStorageValue(cid, 10000) >= 1
end

function storageSell(cid, itemid, ...)
	local sellItems2 = {11208, 11205, 10549}
	local sotrage = getPlayerStorageValue(cid, 10000)
	if isInArray(sellItems2, itemid) and (sotrage < 2) then 
		-- check storages part
		selfSay("You can not sell this item.", cid)
		return false
	end
	return true
end

npcHandler:setCallback(CALLBACK_ONSELL, storageSell)
npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

---
@up rep 10x! Jano rocks :D
 
Last edited:
Back
Top