function ifLooting(address) local target = CPawn(address); if not ( target.Lootable ) then return false; end if( math.abs(target.Y - player.Y) > 45 ) then return false; end return true end function lootAll() local tele = 0 while (player:findEnemy(false, nil,ifLooting) and player.HP > 0 and not (1 > inventory:getItemCount(0))) do --- and not player.Battling repeat local Lootable = player:findEnemy(false, nil,ifLooting) if Lootable then player:target(Lootable) player.TargetPtr = Lootable.Address player:loot() end until ((not Lootable) or (1 > inventory:getItemCount(0)) or player.Battling) end; if (1 > inventory:getItemCount(0)) then printf("Full the backpack\n") if RoMScript("UnitExists('party1')") then sendMacro("LeaveParty()") waitForLoadingScreen(14) player:update() end; __WPL:setWaypointIndex(__WPL:findWaypointTag("Ress")) end end