PDA

View Full Version : [Code] Moving stuff from one bp to another [HELP]



nmmoore
06-18-2016, 01:31 AM
Hello,

As the title says, I need help on how to code moving stuff from my main backpack to their perspective backpacks. Like moving manas to the mana bp and moving crystalline arrows to the ammo bp.

Any help is appreciated, thank you.

Trykon
06-18-2016, 12:42 PM
ManaBp = "Yellow Backpack"
AmmoBp = "Dragon Backpack"

ManaPotID = Item.GetID("Strong Mana Potion")
HealthPotId = Item.GetID("Great Spirit Potion")
AmmoID = Item.GetID("Crystalline Arrow")


while true do
local MainBp = Container.GetFirst()
if (Self.ItemCount(ManaPotID, MainBp) >= 1) or (Self.ItemCount(HealthPotId, MainBp) >=1) then

local DestinationBp = Container.GetByName(ManaBp)
for spot = 0, MainBp:ItemCount() do
local item = MainBp:GetItemData(spot)
if (item.id == ManaPotID) or (item.id == HealthPotId) then
MainBp:MoveItemToContainer(spot, DestinationBp:Index(), 0)
wait(500)
break
end
end
end
wait(200)
if (Self.ItemCount(AmmoID, MainBp) >= 1) then
local DestinationBp = Container.GetByName(AmmoBp)
for spot = 0, MainBp:ItemCount() do
local item = MainBp:GetItemData(spot)
if (item.id == ManaPotID) then
MainBp:MoveItemToContainer(spot, DestinationBp:Index(), 0)
wait(500)
break
end
end
end
wait(200)
end


Enjoy :)
I know this could be optimized, but I am lazy

nmmoore
06-18-2016, 09:58 PM
Thank you soooo much!!!

Trykon
06-19-2016, 06:28 PM
Well, no problem
I hope it is working cuz I haven't checked it