PDA

View Full Version : Quick help.



ctn2mb
01-16-2016, 09:45 PM
I'm trying to figure out how to make a line in this script to where if item count of item 268 is less then 1 then open next backpack.

function AutoUH()
local Afriend = Creature.New("")
local AfriendHealth = Afriend:HealthPercent()
local AfriendPos = Afriend:Position()
local UHid = 268 -- ID OF HEALING RUNES
local backpack = Container.GetByName("red backpack") -- Open backpack containing healing runes
if (AfriendHealth <= 100) and (Self.DistanceFromPosition(AfriendPos.x, AfriendPos.y, AfriendPos.z) <= 7) and (Self.Position().z == AfriendPos.z) then
for spots = 0, backpack:ItemCount() do
local item = backpack:GetItemData(spots)
if (item.id == UHid) then
backpack:UseItemWithCreature(spots, Afriend:ID())
break
end
end
end
end

while true do
AutoUH()
wait(1000,1500)
end

ctn2mb
01-17-2016, 08:12 AM
no one?