dami1310
◄ Unidentified ►
As in the title. I want to make npc sell potions and runes in backpacks possible.
Im using tfs 0.4, to be specific:
this one.
Here is my npc.lua:
Npc:
Npc script:
I tried different kind of solutions and files, but couldnt find the right one.
I somehow managed to get the right amounts of stackable and nonstackable items, but it's "fake" and for stackable items the price for bp is the same as for 100 :v
Im using tfs 0.4, to be specific:
[8.60] The Forgotten Server 0.4
Report any bug. - Changelog: Yellow skull fixed Fixed monsters walking through corpses War system fixed Advertising block otimized Cast system fixed Crash bugs fixeds Added exhaust on buy/sell items Account manager with options for town /ghost stacking fixed !disband fixed Linux bugs fixed...
otland.net
Here is my npc.lua:
function selfIdle() following = false attacking = false selfAttackCreatu - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
pastebin.com
<?xml version="1.0" encoding="UTF-8"?><npc name="Eryn" nameDescription="Eryn, - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
pastebin.com
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(k - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
pastebin.com
I tried different kind of solutions and files, but couldnt find the right one.
I somehow managed to get the right amounts of stackable and nonstackable items, but it's "fake" and for stackable items the price for bp is the same as for 100 :v
PHP:
function doNpcSellItem(cid, itemid, amount, subType, ignoreCap, inBackpacks, backpack)
local amount = amount or 1
local subType = subType or 1
local ignoreCap = ignoreCap and true or false
local a = 0
if(inBackpacks) then
if(isItemStackable(itemid)) then
amount = amount * 20
end
local container = doCreateItemEx(backpack, 1)
local b = 1
for i = 1, amount do
item = doAddContainerItem(container, itemid, subType)
if(itemid == ITEM_PARCEL) then
doAddContainerItem(item, ITEM_LABEL)
end
if(isInArray({(getContainerCapById(backpack) * b), amount}, i)) then
if(doPlayerAddItemEx(cid, container, ignoreCap) ~= RETURNVALUE_NOERROR) then
b = b - 1
break
end
if(isItemStackable(itemid)) then
i = i * 100
end
a = i
if(amount > i) then
container = doCreateItemEx(backpack, 1)
b = b + 1
end
end
end
return a, b
end
for i = 1, amount do
item = doCreateItemEx(itemid, subType)
if(itemid == ITEM_PARCEL) then
doAddContainerItem(item, ITEM_LABEL)
end
if(doPlayerAddItemEx(cid, item, ignoreCap) ~= RETURNVALUE_NOERROR) then
break
end
a = i
end
return a, 0
end
Last edited: