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

Lua Script npc backpack fluid tfs 1.5 7.72

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
881
Solutions
7
Reaction score
122
Location
Brazil
YouTube
caruniawikibr
shopModule:addBuyableItemContainer({'backpack of manafluid'}, 2001, 2006, 2020, 7, 'backpack of manafluid')

shopModule:addBuyableItem({'manafluid'}, 2006, 100, 7, 'manafluid')

how do i buy manafluid and backpack manafluid? whenever i try to use backpack manaluid it pulls 1 lifefluid only
 
Last edited:
Solution
Lua:
shopModule:addBuyableItemContainer({'bp lf', 'bp life fluid', 'bp lifefluid'}, 2000, 2006, 1200, 10, 'backpack of life fluids')
shopModule:addBuyableItem({'lf', 'life fluid', 'lifefluid'}, 2006, 60, 10, 'life fluid')
shopModule:addBuyableItemContainer({'bp mf', 'bp mana fluid', 'bp manafluid'}, 2001, 2006, 1100, 7, 'backpack of mana fluids')
shopModule:addBuyableItem({'mf', 'mana fluid', 'manafluid'}, 2006, 55, 7, 'mana fluid')
shopModule:addBuyableItemContainer({'bp life ring', 'bp life', 'bp lr'}, 1998, 2168, 18000, 1, 'backpack of life rings')
shopModule:addBuyableItem({'lr', 'life ring', 'life'}, 2168, 900, 1, 'life ring')
shopModule:addBuyableItemContainer({'bp blank', 'bp blank rune', 'bp blanks'}, 2003, 2260, 200, 1...
sup bpm!


i believe u can found a solution for this just editing the .npc files of all npcs who sells mana/life fluids.. you can add something like this in them so they gonna get able to sell to you backpacks of mana/life fluids keeping other sales like units of mana/life fluids normally.

example:

in /data/npc/name.npc

Lua:
"bp life fluid"  -> Price=1200, Amount=1, "Do you want to buy backpack full of life fluid for %P gold?", Topic=10

%1,1<%1,"bp life fluid"  -> Type=2874, Data=11, Amount=%1, Price=1100*%1,  "Do you want to buy %A bps of life fluid for %P gold?", Topic=10

Topic=10,"yes",CountMoney>=Price -> "Thank you. Here it is.", DeleteMoney, CreateContainer(2867,2874,11)
Topic=10,"yes"                   -> "Sorry, you do not have enough gold."
Topic=10                         -> "Maybe you will buy it another time."

note: pay attention for the "Topics" value to them dont get declared twice in the npcs.

do the same thing to mana fluid replacing the id, price and etcs...
 
my script works, the problem is that for example if I put manafluid in one line and in the other sales line I put backpack of mana fluid, then the npc only understands manafluid and doesn't sell me the backpack, the only way I found was put vial of manafluid and backpack of manafluid, but I wanted it to be manafluid and backpack of manafluid because then the player wouldn't need to say vial of
 
sup bpm!


i believe u can found a solution for this just editing the .npc files of all npcs who sells mana/life fluids.. you can add something like this in them so they gonna get able to sell to you backpacks of mana/life fluids keeping other sales like units of mana/life fluids normally.

example:

in /data/npc/name.npc

Lua:
"bp life fluid"  -> Price=1200, Amount=1, "Do you want to buy backpack full of life fluid for %P gold?", Topic=10

%1,1<%1,"bp life fluid"  -> Type=2874, Data=11, Amount=%1, Price=1100*%1,  "Do you want to buy %A bps of life fluid for %P gold?", Topic=10

Topic=10,"yes",CountMoney>=Price -> "Thank you. Here it is.", DeleteMoney, CreateContainer(2867,2874,11)
Topic=10,"yes"                   -> "Sorry, you do not have enough gold."
Topic=10                         -> "Maybe you will buy it another time."

note: pay attention for the "Topics" value to them dont get declared twice in the npcs.

do the same thing to mana fluid replacing the id, price and etcs...
He is not using my server Nostalrius, he is using Nekiro's 7.7 downgrade and his script is from NpcHandler class (lua) of TFS
 
shopModule:addBuyableItemContainer({'backpack of manafluid'}, 2001, 2006, 2020, 7, 'backpack of manafluid')

shopModule:addBuyableItem({'manafluid'}, 2006, 100, 7, 'manafluid')

how do i buy manafluid and backpack manafluid? whenever i try to use backpack manaluid it pulls 1 lifefluid only
From the addBuyableItemContainer method definition:
Lua:
    -- 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 1.
    --    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 (ItemType(itemId):getName() will be used)
function ShopModule:addBuyableItemContainer(names, container, itemid, cost, subType, realName)

So the code below is going to create a container blue backpack (id 2002) of vials (itemid 2006) which the costs 2000 gold coins, with subType of manafluid (subType 7) and the NPC will reply as "backpack of manafluid"
Lua:
shopModule:addBuyableItemContainer({'backpack of manafluid'}, 2002, 2006, 2000, 7, 'backpack of manafluid')
Edit: I notice now that your code looks right. I tested mine and it works too... maybe it is something wrong on NPC scripts? did you changed something?
 
Last edited:
Lua:
shopModule:addBuyableItemContainer({'bp lf', 'bp life fluid', 'bp lifefluid'}, 2000, 2006, 1200, 10, 'backpack of life fluids')
shopModule:addBuyableItem({'lf', 'life fluid', 'lifefluid'}, 2006, 60, 10, 'life fluid')
shopModule:addBuyableItemContainer({'bp mf', 'bp mana fluid', 'bp manafluid'}, 2001, 2006, 1100, 7, 'backpack of mana fluids')
shopModule:addBuyableItem({'mf', 'mana fluid', 'manafluid'}, 2006, 55, 7, 'mana fluid')
shopModule:addBuyableItemContainer({'bp life ring', 'bp life', 'bp lr'}, 1998, 2168, 18000, 1, 'backpack of life rings')
shopModule:addBuyableItem({'lr', 'life ring', 'life'}, 2168, 900, 1, 'life ring')
shopModule:addBuyableItemContainer({'bp blank', 'bp blank rune', 'bp blanks'}, 2003, 2260, 200, 1, 'backpack of blank runes')
shopModule:addBuyableItem({'blank', 'blank rune'}, 2260, 10, 1, 'blank rune')
--shopModule:addBuyableItemContainer({'bp exp'}, 2000, 2304, 3600, 3, 'backpack of explosion rune')
--shopModule:addBuyableItem({'exp', 'explo', 'explosion'}, 2313, 190, 3, 'explosion rune')
shopModule:addBuyableItemContainer({'bp gfb'}, 7612, 2304, 3600, 2, 'backpack of great fireball rune')
--shopModule:addBuyableItem({'gfb', 'great fire ball', 'great fireball'}, 2304, 180, 2, 'great fireball rune')
--shopModule:addBuyableItemContainer({'bp ih'}, 2000, 2265, 1900, 1, 'backpack of intense healing rune')
--hopModule:addBuyableItem({'ih', 'intense healing'}, 2265, 95, 1, 'intense healing rune')
--shopModule:addBuyableItemContainer({'bp lmm'}, 2000, 2287, 800, 10, 'backpack of light magic missile rune')
--shopModule:addBuyableItem({'lmm', 'light magic missile'}, 2287, 40, 10, 'light magic missile rune')
shopModule:addBuyableItemContainer({'bp hmm'}, 7616, 2311, 2400, 5, 'backpack of heavy magic missile rune')
--shopModule:addBuyableItem({'hmm', 'heavy magic missile'}, 2311, 120, 5, 'heavy magic missile rune')
shopModule:addBuyableItemContainer({'bp sd'}, 7615, 2268, 6500, 1, 'backpack of sudden death rune')
--shopModule:addBuyableItem({'sd', 'sudden death'}, 2268, 325, 1, 'sudden death rune')
shopModule:addBuyableItemContainer({'bp uh'}, 7611, 2273, 3500, 1, 'backpack of ultimate healing rune')
--shopModule:addBuyableItem({'uh', 'ultimate healing'}, 2273, 175, 1, 'ultimate healing rune')
 
Solution
Back
Top