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

2 bugs

ruda

Member
Joined
Jul 4, 2008
Messages
164
Reaction score
15
Location
Brazil
1º: promotion not being saved when the player dies

2º: dunno if its a bug, cos i dont play tibia global anymore, but the only way to buy stuff from npcs is saying 'trade' and buying from the menu. if you say the name item, nothing happens. so you cant buy the 'addBuyableItemContainer' items, cos they dont appear in the list.

excellent ot
;)
 
0.3 beta1

So... how can I make the 'addBuyableItemContainer' works?
 
0.3 beta1

So... how can I make the 'addBuyableItemContainer' works?

I'm using TFS 0.2.20, but;
Here's that part from my data/npc/lib/npcsystem/modules.lua

Code:
	-- Adds a new buyable container of items.
	--	names = A table containing one or more strings of alternative names to this item.
	--	container = Backpack, bag or any other itemid of container where bought items will be stored
	--	itemid = The itemid of the buyable item
	--	cost = The price of one single item
	--	subType - The subType of each rune or fluidcontainer item. Can be left out if it is not a rune/fluidcontainer. Default value is 0.
	--	realName - The real, full name for the item. Will be used as ITEMNAME in MESSAGE_ONBUY and MESSAGE_ONSELL if defined. Default value is nil (getItemName will be used)
	function ShopModule:addBuyableItemContainer(names, container, itemid, cost, subType, realName)
		if(names ~= nil) then
			for i, name in pairs(names) do
				local parameters = {
						container = container,
						itemid = itemid,
						cost = cost,
						eventType = SHOPMODULE_BUY_ITEM_CONTAINER,
						module = self,
						realName = realName or getItemName(itemid),
						subType = subType or 1
					}

				keywords = {}
				table.insert(keywords, 'buy')
				table.insert(keywords, name)
				local node = self.npcHandler.keywordHandler:addKeyword(keywords, ShopModule.tradeItem, parameters)
				node:addChildKeywordNode(self.yesNode)
				node:addChildKeywordNode(self.noNode)
			end
		end
	end

Here are some LUA examples:
Code:
shopModule:addBuyableItemContainer({'bp sd'}, 2003, 2268, 7000, 3, 'backpack of sudden death runes')
Code:
shopModule:addBuyableItemContainer({'bp ghp'}, 2000, 7591, 3800, 1, 'backpack of great health potions')
 
works fine for you?
i've got
shopModule:addBuyableItemContainer({'bpgm'},1988,7590,2400,1,'bp great mana potion')

but nothing happens ='[
 
Add this to data/npc/lib/npcsystem/modules.lua

Code:
	-- Adds a new buyable container of items.
	--	names = A table containing one or more strings of alternative names to this item.
	--	container = Backpack, bag or any other itemid of container where bought items will be stored
	--	itemid = The itemid of the buyable item
	--	cost = The price of one single item
	--	subType - The subType of each rune or fluidcontainer item. Can be left out if it is not a rune/fluidcontainer. Default value is 0.
	--	realName - The real, full name for the item. Will be used as ITEMNAME in MESSAGE_ONBUY and MESSAGE_ONSELL if defined. Default value is nil (getItemName will be used)
	function ShopModule:addBuyableItemContainer(names, container, itemid, cost, subType, realName)
		if(names ~= nil) then
			for i, name in pairs(names) do
				local parameters = {
						container = container,
						itemid = itemid,
						cost = cost,
						eventType = SHOPMODULE_BUY_ITEM_CONTAINER,
						module = self,
						realName = realName or getItemName(itemid),
						subType = subType or 1
					}

				keywords = {}
				table.insert(keywords, 'buy')
				table.insert(keywords, name)
				local node = self.npcHandler.keywordHandler:addKeyword(keywords, ShopModule.tradeItem, parameters)
				node:addChildKeywordNode(self.yesNode)
				node:addChildKeywordNode(self.noNode)
			end
		end
	end

and note that u cant use this with NPC trade window, only with old trade system (buy bp sd)
 
Last edited:
Back
Top