--==<< Rock5's lootBodies function >>==-- --==<< By Rock5 Version 1.1 >>==-- --==<< --==<< Requirements: A loot addon that loots all. >>==-- --==<< >>==-- --==<< www.solarstrike.net/phpBB3/viewtopic.php?p=16844 >>==-- local ignoreList = {} local noToIgnore = 10 local pos = 0 function evalTargetLootable(address) local target = CPawn(address); -- Check if lootable if not ( target.Lootable ) then return false; end -- Check if in ignoreList for __, addr in pairs(ignoreList) do if target.Address == addr then return false end end -- Check height difference if( math.abs(target.Y - player.Y) > 45 ) then return false; end -- check distance to target local dist = distance(player.X, player.Z, target.X, target.Z); local lootdist = 100; -- Set to combat distance; update later if loot distance is set if( settings.profile.options.COMBAT_TYPE == "ranged" ) then lootdist = settings.profile.options.COMBAT_DISTANCE; end if( settings.profile.options.LOOT_DISTANCE ) then lootdist = settings.profile.options.LOOT_DISTANCE; end if( dist > lootdist ) then -- only loot when close by return false end return true end function lootBodies() -- Check if inventory is full. We don't loot if inventory is full. if inventory:itemTotalCount(0) == 0 then return end while true do player:update() if( player.Battling and player:findEnemy(true,nil,evalTargetDefault)) then break end local Lootable = player:findEnemy(false, nil, evalTargetLootable) if Lootable == nil then break end --player:moveInRange(Lootable, 10, true) player:target(Lootable) player:update() if player.TargetPtr ~= 0 then -- Target's still there. player:loot() yrest(50) Lootable:update(); if Lootable.Lootable == true then -- Failed to loot. Add to ignore list pos = pos + 1 if pos > noToIgnore then pos = 1 end ignoreList[pos] = Lootable.Address end end end end