Page 3 of 3

Re: Finding and looting dead bodies

Posted: Tue Dec 14, 2010 1:20 am
by Petzzz
its the only way to get this working :)
because if someone enter your framspot kill some mobs but dont loot them you get stucked anyway what your settings says.
i tryed max fight distance = 50 (only mage aoe skills) max loot distance = 60 (sometimes we move a bit so the extra distance is needed) result = bot loots fine in my aoe range, but if a lootable mob is near (somthing betwen 150-225 range) bot says "start looting" but dont move.

i test it with skellet farm spot by boddypull. set the waypoints to travel at bombspot i changed them back to normal. works like a charm but if some other player enter the spot bot get stucked by his dead bodies.

workaround must be a timer. sure the bot will try to loot the same bodie again and again but only after the next lootbodies call. and this only happend if we kill the next mob result = we kill mobs and loot them, one mob is to far away, bot try to loot, get stucked for ?5 sec, skip looting, move to next position, kill next mob wave and now the dead bodie we cant loot last time is now in range so he still get the loot.
sorry for my very bad english but i realy try my best :)
Petz

Re: Finding and looting dead bodies

Posted: Sat Dec 18, 2010 7:54 am
by wizzyslo
I'm testing this function and have little problem with full inventory :lol: Wonderful can be function to check inventory space befoure lootBodies() else skip lootBodies().

Re: Finding and looting dead bodies

Posted: Sat Dec 18, 2010 11:11 am
by jduartedj
atm inventory is a little broken specially on detecting empty spaces but the code should be...

Code: Select all

inventory:itemTotalCount(0)
this gives you the number of empty spaces on your bag and allows you to check for that yourself.

Re: Finding and looting dead bodies

Posted: Sat Dec 18, 2010 12:01 pm
by wizzyslo
Wich function is to move to next waypoint?
Tested as:
player:moveTo( CWaypoint(waypoint.X, waypoint.Z), true ); rly not works
and
player:moveTo( CWaypoint(nX, nZ), true ); works somehow but dont go to next waypoint.

help pls :roll:

Re: Finding and looting dead bodies

Posted: Sat Dec 18, 2010 2:02 pm
by jduartedj
That is meant to move to a specific location point.

But going to the next waypoint is default! So you should do this:

If "more than X empty spaces" then
"loot bodies"
end

So it only loots if you have empty spaces.

Re: Finding and looting dead bodies

Posted: Sun Dec 19, 2010 3:59 am
by wizzyslo
Tested next code but dont works

Code: Select all

function lootBodies()
	repeat
	player:update()
		if inventory:itemTotalCount(1) then
			local Lootable = player:findEnemy(false, nil, evalTargetLootable)
			if Lootable and player.Battling == false then
				player:target(Lootable)
				player.TargetPtr = Lootable.Address
				player:loot()
			end
		end
	until not Lootable or player.Battling
end
Is bot detect inventory:itemTotalCount(1) as item ID in inventory?

Re: Finding and looting dead bodies

Posted: Sun Dec 19, 2010 12:50 pm
by jduartedj
the code is 0 not 1, try this instead

Code: Select all

inventory:itemTotalCount(0) > 1
Given that you need more than 1 Empty bag slot to loot. If you want to sure at least 2 use "> 2" and so on.

Re: Finding and looting dead bodies

Posted: Sun Dec 19, 2010 1:25 pm
by rock5
jduartedj wrote:Given that you need more than 1 Empty bag slot to loot. If you want to sure at least 2 use "> 2" and so on.
Why do you need more than 1 empty to loot? If you have 1 empty can't you loot? Maybe you mean

Code: Select all

inventory:itemTotalCount(0) > 0
Meaning if you have at least 1 empty.
wizzyslo wrote:Tested next code but dont works
I'm not sure the 'local Lootable' variable will make it out of the if statement. i think you need to declare it first. try,

Code: Select all

function lootBodies()
	repeat
		local Lootable
		player:update()
		if inventory:itemTotalCount(0) > 0 then
			Lootable = player:findEnemy(false, nil, evalTargetLootable)
			if Lootable and player.Battling == false then
				player:target(Lootable)
				player.TargetPtr = Lootable.Address
				player:loot()
			end
		end
	until not Lootable or player.Battling
end
And now that I've released rev 548 of the rombot, itemTotalCount should work again. :)

Re: Finding and looting dead bodies

Posted: Sun Dec 19, 2010 1:39 pm
by jduartedj
Yes, ofc Rock5. the thing is he might want to secure 2 or more free slots in case the loots has more than 1 item. But that is just my take, >0 is perfectly ok.
I, for one, have a check at the end of my waypoint file. that if I have 3 or less empty slots I load a merchant path to go sell stuff. So I guarantee that the bag isn't full most of the time.

Re: Finding and looting dead bodies

Posted: Thu Dec 23, 2010 4:38 am
by checkii
As you all know sometimes the bot get stuck looting something it can't reach. I had this idea to put in the number of times the bot loots. Once it loots over a certain times it will stop looting and continue on its way. Assuming no one is going to kill over 10 mobs at a time, I have modified it to break the cycle after looting 10 times.

Code: Select all

function lootBodies()
   repeat
      local Lootable
      local count
      player:update()
      if inventory:itemTotalCount(0) > 0 then
         Lootable = player:findEnemy(false, nil, evalTargetLootable)
         if Lootable and player.Battling == false then
            player:target(Lootable)
            player.TargetPtr = Lootable.Address
            player:loot()
            count = count + 1
         end
      end
   until not Lootable or player.Battling or count == 10
end
Can anyone tell me if this works?

Re: Finding and looting dead bodies

Posted: Thu Dec 23, 2010 8:41 am
by rock5
checkii wrote:As you all know sometimes the bot get stuck looting something it can't reach. I had this idea to put in the number of times the bot loots. Once it loots over a certain times it will stop looting and continue on its way. Assuming no one is going to kill over 10 mobs at a time, I have modified it to break the cycle after looting 10 times.

Code: Select all

function lootBodies()
   repeat
      local Lootable
      local count
      player:update()
      if inventory:itemTotalCount(0) > 0 then
         Lootable = player:findEnemy(false, nil, evalTargetLootable)
         if Lootable and player.Battling == false then
            player:target(Lootable)
            player.TargetPtr = Lootable.Address
            player:loot()
            count = count + 1
         end
      end
   until not Lootable or player.Battling or count == 10
end
Can anyone tell me if this works?
The code looks fine but do you realize, if it gets stuck, it will try to loot the same mob 10 times ignoring other bodies? And when it finally gives up it wont loot the other bodies? What's probably needed, as well as a counter, is an 'ignore address'. So if it gets stuck it will move on to the next body. It might go back to the first body but, if it gets stuck again, will move on to the next body. The problem is if you have more than 1 body you can't reach and it goes back and forth trying to loot them. That's where a counter would help to stop the cycle.

I intend to release an updated version which will include suggestions from users. Hopefully it won't be much longer.

Re: Finding and looting dead bodies

Posted: Thu Dec 23, 2010 8:46 am
by botje
dont want to be a ungratefull bitch or whatever, but what about fixing the damn stuck at 67% bug first? xd

seems more important then other addons to the bot if ya ask me :)

Botje

Re: Finding and looting dead bodies

Posted: Thu Dec 23, 2010 12:32 pm
by checkii
botje wrote:dont want to be a ungratefull bitch or whatever, but what about fixing the damn stuck at 67% bug first? xd

seems more important then other addons to the bot if ya ask me :)

Botje
There already multiple threads about this. It very bad form to hijack/off topic another thread, please don't do it.

Rock5, its no biggie. I am just trying to find an intermediate solution. Its better than the bot getting stuck there for 10mins (or however long it takes for the dead mob to leave).

Re: Finding and looting dead bodies

Posted: Thu Dec 23, 2010 6:20 pm
by botje
im in no way hyjacking a thread, just pointing out there should be things done first before adding to the bot as is.

O.o

Botje

Re: Finding and looting dead bodies

Posted: Fri Dec 24, 2010 12:16 am
by Administrator
botje wrote:im in no way hyjacking a thread, just pointing out there should be things done first before adding to the bot as is.

O.o

Botje
How do you propose we fix something when we don't even know what the problem is and do not have the time in our lives to devote to fixing it? I have *still* never been able to reproduce the problem, so I absolutely cannot debug it at all, nor can I even attempt to fix it (as I would be unable to test any changes).

Re: Finding and looting dead bodies

Posted: Fri Dec 24, 2010 5:23 am
by botje
yeah, thats a problem indeed >.<

"luckely" Rock has it, so not all is lost though :)

and yeah, time is short around these days, trust me i know.

Botje

Re: Finding and looting dead bodies

Posted: Sun Jan 09, 2011 9:05 pm
by rock5
I've updated my lootBodies function and created a dedicated thread for it here.
http://www.solarstrike.net/phpBB3/viewt ... =27&t=2018