Log in

View Full Version : Move Potions to Potion BP



Whiplash
12-30-2015, 05:44 AM
I hate to create a new post if someone has already made it but i can't find it for the life of me.


I need to be shown how to move my potions from my main bp, to the potion bp when i restock?

Any help appreciated,

grave18
12-30-2015, 06:18 PM
Script by Rif

local potion = 'strong mana potion' -- name of potion
local bp = 'backpack' -- container where u want put all potions
--------------------
-- Engine --
--------------------
Module.New('Shove-pots', function(mod)
for i = 0, #Container.GetAll() do -- let's find bps
search = Container.New(i)
cont = Container.New(bp)
for spot = 0, cont:ItemCount() do
local item = search:GetItemData(spot)
if cont:isOpen() and search:Name() ~= cont:Name() then
if (item.id == Item.GetID(potion)) and not cont:isFull() then
search:MoveItemToContainer(spot, cont:Index(), 0, 100) -- just shove to selected bp
end
end
end
end
if cont:isOpen() and (cont:CountItemsOfID(Item.GetID(potion)) == 0) then -- check, that bp no contains potions,
for spot = 0, cont:ItemCount() do
local bpnext = cont:GetItemData(spot)
if (bpnext.id == Item.GetID(bp)) and cont:isOpen() then
cont:UseItem(spot, true) -- open next bp with potions
end
end
end
mod:Delay(300, 1200) -- time between actions in miliseconds/remove if its OTS
end)