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

Seller NPC (buy with backpack)

Rudixx

New Member
Joined
Aug 3, 2007
Messages
246
Reaction score
0
Location
England
Is it possible on The Forgotten Server v0.3 beta 1 to make seller/buyer NPC, for example rune seller npc, which will sell runes in trade window and if you check 'buy with backpack' it will sell in backpack? If yes, how?
If it is not possible can someone combine for me trade window sale list with "buy bp sd"?


Signed,
Rudixx
 
Example.
Code:
shopModule:addBuyableItemContainer({'keyword'}, backpackid, itemid, priceforall, 1, 'full keyword')

Example with sd.
Code:
shopModule:addBuyableItemContainer({'bp sd'}, 1988, 2268, 5000, 1, 'backpack of sudden death runes')
 
That what you wrote is for trade window? Because my script looks like this:

Code:
local focuses = {}
local function isFocused(cid)
	for i, v in pairs(focuses) do
		if(v == cid) then
			return true
		end
	end
	return false
end

local function addFocus(cid)
	if(not isFocused(cid)) then
		table.insert(focuses, cid)
	end
end
local function removeFocus(cid)
	for i, v in pairs(focuses) do
		if(v == cid) then
			table.remove(focuses, i)
			break
		end
	end
end
local function lookAtFocus()
	for i, v in pairs(focuses) do
		if(isPlayer(v) == TRUE) then
			doNpcSetCreatureFocus(v)
			return
		end
	end
	doNpcSetCreatureFocus(0)
end

local itemWindow = {
	{id=2266, subType=1, buy=65, sell=0, name="antidote rune"},
	{id=2274, subType=4, buy=180, sell=0, name="avalanche rune"},
	{id=2260, subType=0, buy=10, sell=0, name="blank rune"},
	{id=2291, subType=1, buy=210, sell=0, name="chameleon rune"},
	{id=2290, subType=1, buy=80, sell=0, name="convince creature rune"},
	{id=2261, subType=3, buy=45, sell=0, name="destroy field rune"},
	{id=7634, subType=0, buy=0, sell=5, name="empty potion flask"},
	{id=7635, subType=0, buy=0, sell=5, name="empty potion flask"},
	{id=7636, subType=0, buy=0, sell=5, name="empty potion flask"},
	{id=2277, subType=3, buy=115, sell=0, name="energy field rune"},
	{id=2279, subType=4, buy=340, sell=0, name="energy wall rune"},
	{id=2313, subType=6, buy=190, sell=0, name="explosion rune"},
	{id=2305, subType=2, buy=235, sell=0, name="fire bomb rune"},
	{id=2301, subType=3, buy=85, sell=0, name="fire field rune"},
	{id=2303, subType=4, buy=245, sell=0, name="fire wall rune"},
	{id=2304, subType=4, buy=180, sell=0, name="great fireball rune"},
	{id=7591, subType=0, buy=190, sell=0, name="great health potion"},
	{id=7590, subType=0, buy=120, sell=0, name="great mana potion"},
	{id=8472, subType=0, buy=190, sell=0, name="great spirit potion"},
	{id=7618, subType=0, buy=45, sell=0, name="health potion"},
	{id=2311, subType=10, buy=120, sell=0, name="heavy magic missile rune"},
	{id=2265, subType=1, buy=95, sell=0, name="intense healing rune"},
	{id=2287, subType=10, buy=40, sell=0, name="light magic missile rune"},
	{id=7620, subType=0, buy=50, sell=0, name="mana potion"},
	{id=2186, subType=0, buy=1000, sell=0, name="moonlight rod"},
	{id=2185, subType=0, buy=5000, sell=0, name="necrotic rod"},
	{id=2285, subType=3, buy=65, sell=0, name="poison field rune"},
	{id=2289, subType=4, buy=210, sell=0, name="poison wall rune"},
	{id=2182, subType=0, buy=500, sell=0, name="snakebite rod"},
	{id=2175, subType=0, buy=150, sell=0, name="spellbook"},
	{id=2292, subType=10, buy=120, sell=0, name="stalagmite rune"},
	{id=7588, subType=0, buy=100, sell=0, name="strong health potion"},
	{id=2268, subType=3, buy=325, sell=0, name="sudden death rune"},
	{id=2151, subType=0, buy=0, sell=320, name="talon"},
	{id=2181, subType=0, buy=10000, sell=0, name="terra rod"},
	{id=2273, subType=1, buy=175, sell=0, name="ultimate healing rune"},
	{id=8473, subType=0, buy=310, sell=0, name="ultimate health potion"},
	{id=2006, subType=0, buy=0, sell=5, name="vial"},
	{id=2189, subType=0, buy=10000, sell=0, name="wand of cosmic energy"},
	{id=2188, subType=0, buy=5000, sell=0, name="wand of decay"},
	{id=2191, subType=0, buy=1000, sell=0, name="wand of dragonbreath"},
	{id=2190, subType=0, buy=500, sell=0, name="wand of vortex"}
}

local items = {}
for _, item in ipairs(itemWindow) do
	items[item.id] = {buyPrice = item.buy, sellPrice = item.sell, subType = item.subType, realName = item.name}
end


Signed,
Rudixx
 
@up
What da hell is this?!

Try mine:
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)

shopModule:addBuyableItem({'spellbook'}, 2175, 150, 'spellbook')

shopModule:addBuyableItem({'small health'}, 8704, 20, 1, 'small health potion')
shopModule:addBuyableItem({'health potion'}, 7618, 45, 1, 'health potion')
shopModule:addBuyableItem({'mana potion'}, 7620, 50, 1, 'mana potion')
shopModule:addBuyableItem({'strong health'}, 7588, 100, 1, 'strong health potion')
shopModule:addBuyableItem({'strong mana'}, 7589, 80, 1, 'strong mana potion')
shopModule:addBuyableItem({'great health'}, 7591, 190, 1, 'great health potion')
shopModule:addBuyableItem({'great mana'}, 7590, 120, 1, 'great mana potion')
shopModule:addBuyableItem({'great spirit'}, 8472, 190, 1, 'great spirit potion')
shopModule:addBuyableItem({'ultimate health'}, 8473, 310, 1, 'ultimate health potion')
shopModule:addBuyableItem({'antidote potion'}, 8474, 50, 1, 'antidote potion')

shopModule:addBuyableItem({'intense healing'}, 2265, 95, 1, 'intense healing rune')
shopModule:addBuyableItem({'ultimate healing'}, 2273, 175, 1, 'ultimate healing rune')
shopModule:addBuyableItem({'magic wall'}, 2293, 350, 3, 'magic wall rune')
shopModule:addBuyableItem({'destroy field'}, 2261, 45, 3, 'destroy field rune')
shopModule:addBuyableItem({'light magic missile'}, 2287, 40, 10, 'light magic missile rune')
shopModule:addBuyableItem({'heavy magic missile'}, 2311, 120, 10, 'heavy magic missile rune')
shopModule:addBuyableItem({'great fireball'}, 2304, 180, 4, 'great fireball rune')
shopModule:addBuyableItem({'explosion'}, 2313, 250, 6, 'explosion rune')
shopModule:addBuyableItem({'sudden death'}, 2268, 350, 3, 'sudden death rune')
shopModule:addBuyableItem({'paralyze'}, 2278, 700, 1, 'paralyze rune')
shopModule:addBuyableItem({'convince creature'}, 2290, 80, 1, 'convince creature rune')
shopModule:addBuyableItem({'chameleon'}, 2291, 210, 1, 'chameleon rune')
shopModule:addBuyableItem({'desintegrate'}, 2310, 80,  3, 'desintegrate rune')

shopModule:addBuyableItemContainer({'bp slhp'}, 2000, 8704, 400, 1, 'backpack of small health potions')
shopModule:addBuyableItemContainer({'bp hp'}, 2000, 7618, 900, 1, 'backpack of health potions')
shopModule:addBuyableItemContainer({'bp mp'}, 2001, 7620, 1000, 1, 'backpack of mana potions')
shopModule:addBuyableItemContainer({'bp shp'}, 2000, 7588, 2000, 1, 'backpack of strong health potions')
shopModule:addBuyableItemContainer({'bp smp'}, 2001, 7589, 1600, 1, 'backpack of strong mana potions')
shopModule:addBuyableItemContainer({'bp ghp'}, 2000, 7591, 3800, 1, 'backpack of great health potions')
shopModule:addBuyableItemContainer({'bp gmp'}, 2001, 7590, 2400, 1, 'backpack of great mana potions')
shopModule:addBuyableItemContainer({'bp gsp'}, 1999, 8472, 3800, 1, 'backpack of great spirit potions')
shopModule:addBuyableItemContainer({'bp uhp'}, 2000, 8473, 6200, 1, 'backpack of ultimate health potions')
shopModule:addBuyableItemContainer({'bp ap'}, 2002, 8474, 2000, 1, 'backpack of antidote potions')

shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 2190, 500, 'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 1000, 'wand of dragonbreath')
shopModule:addBuyableItem({'wand of decay', 'decay'}, 2188, 5000, 'wand of decay')
shopModule:addBuyableItem({'wand of draconia', 'draconia'}, 8921, 7500, 'wand of draconia')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 10000, 'wand of cosmic energy')
shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 2187, 15000, 'wand of inferno')
shopModule:addBuyableItem({'wand of starstorm', 'starstorm'}, 8920, 18000, 'wand of starstorm')
shopModule:addBuyableItem({'wand of voodoo', 'voodoo'}, 8922, 22000, 'wand of voodoo')

shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 2182, 500, 'snakebite rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 2186, 1000, 'moonlight rod')
shopModule:addBuyableItem({'necrotic rod', 'necrotic'}, 2185, 5000, 'necrotic rod')
shopModule:addBuyableItem({'northwind rod', 'northwind'}, 8911, 7500, 'northwind rod')
shopModule:addBuyableItem({'terra rod', 'terra'}, 2181, 10000, 'terra rod')
shopModule:addBuyableItem({'hailstorm rod', 'hailstorm'}, 2183, 15000, 'hailstorm rod')
shopModule:addBuyableItem({'springsprout rod', 'springsprout'}, 8912, 18000, 'springsprout rod')
shopModule:addBuyableItem({'underworld rod', 'underworld'}, 8910, 22000, 'underworld rod')

shopModule:addSellableItem({'wand of vortex', 'vortex'}, 2190, 250, 'wand of vortex')
shopModule:addSellableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 500, 'wand of dragonbreath')
shopModule:addSellableItem({'wand of decay', 'decay'}, 2188, 2500, 'wand of decay')
shopModule:addSellableItem({'wand of draconia', 'draconia'}, 8921, 3750, 'wand of draconia')
shopModule:addSellableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 5000, 'wand of cosmic energy')
shopModule:addSellableItem({'wand of inferno', 'inferno'},2187, 7500, 'wand of inferno')
shopModule:addSellableItem({'wand of starstorm', 'starstorm'}, 8920, 9000, 'wand of starstorm')
shopModule:addSellableItem({'wand of voodoo', 'voodoo'}, 8922, 11000, 'wand of voodoo')

shopModule:addSellableItem({'snakebite rod', 'snakebite'}, 2182, 250,'snakebite rod')
shopModule:addSellableItem({'moonlight rod', 'moonlight'}, 2186, 500,   'moonlight rod')
shopModule:addSellableItem({'necrotic rod', 'necrotic'}, 2185, 2500, 'necrotic rod')
shopModule:addSellableItem({'northwind rod', 'northwind'}, 8911, 3750, 'northwind rod')
shopModule:addSellableItem({'terra rod', 'terra'}, 2181, 5000, 'terra rod')
shopModule:addSellableItem({'hailstorm rod', 'hailstorm'}, 2183, 7500, 'hailstorm rod')
shopModule:addSellableItem({'springsprout rod', 'springsprout'}, 8912, 9000, 'springsprout rod')
shopModule:addSellableItem({'underworld rod', 'underworld'}, 8910, 11000, 'underworld rod')

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Isellru Nes" script="data/npc/scripts/runes.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="130" head="39" body="122" legs="125" feet="57" addons="0"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell runes, potions, wands and rods."/>
	</parameters>
</npc>
 
@Empty
eh.. you are right. Anyways that "new" system sucks :/, it doesn't make such a difference with which system you make it.
 
@Empty
eh.. you are right. Anyways that "new" system sucks :/, it doesn't make such a difference with which system you make it.

Well, I like the new system a lot more than Jiddo's. But that's my oppinion.. ^^


@up
Yes, it will work. But it doesn't use the NPC channel-feature.
 
If you mean that to all NPCs so find those lines in /npc/lib/npcsystem/modules.lua:

Code:
	-- The words for requesting trade window.
	SHOP_TRADEREQUEST = {'offer', 'trade'}

you can freely add more keywords, for example:

Code:
	SHOP_TRADEREQUEST = {'offer', 'trade', 'imgay', 'marijuana', 'showmethestuff'}

If you meant to do this this to one NPC, hm, I don't know now, but I will check. If I find something, I will message you.
 
Mate are you able to buy backpack with runes through the trade window? if not i'll make a new system for it when i have time. I dont have time to test if it supports buy backpack runes :p
 
Back
Top