PDA

View Full Version : [Help] Need help with script. Moving bolts to ammo bp



Hars
11-15-2015, 07:17 AM
Hello,

I need some your help in script. I'm using script for moving bolts to ammo bp, working very well but when Im out of bolts that script made freezes and I must kill script and everything back to normal.


ArrowBp = "Brocade Backpack"

ArrowID = Item.GetID("prismatic bolt")

while true do

if (Self.ItemCount(ArrowID) >= 1) then
local MainBp = Container.GetFirst()
local DestinationBp = Container.GetByName(ArrowBp)
for spot = 0, MainBp:ItemCount() do
local item = MainBp:GetItemData(spot)
if (item.id == ArrowID) then
MainBp:MoveItemToContainer(spot, DestinationBp:Index(), 0)
wait(500)
break
end
wait(200)
end
end
end

What is wrong with it?

Rif
11-15-2015, 10:50 AM
ArrowBp = "Brocade Backpack"
ArrowID = Item.GetID("prismatic bolt")

Module.New('...', function(object)
local MainBp = Container.GetFirst()
if (cont:CountItemsOfID(ArrowID) >= 1) then
local DestinationBp = Container.GetByName(ArrowBp)
for spot = 0, MainBp:ItemCount() do
local item = MainBp:GetItemData(spot)
if (item.id == ArrowID) then
MainBp:MoveItemToContainer(spot, DestinationBp:Index(), 0)
wait(600, 1000)
end
end
end
object:Dealy(2000)
end)