looting even if you are under attack? dont like that

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

looting even if you are under attack? dont like that

#1 Post by d003232 » Sun Jun 07, 2009 11:22 pm

I discover that the bot first try to loot after leave of combat even if he is still under attack from a additional mob. It is possible to change that? I dont like to die becaus of that and it not so common for a human user to do that. I would even like to skip the loot completly instead if under attack.
The RoM Bot Online Wiki needs your help!

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: looting even if you are under attack? dont like that

#2 Post by Administrator » Sun Jun 07, 2009 11:36 pm

Line 303 of classes/player.lua, look for this:

Code: Select all

	-- Monster is dead (0 HP) but still targeted.
	-- Loot and clear target.
	self:update();
	if( self.TargetPtr ~= 0 ) then
Right under self:update(), insert this:

Code: Select all

if( self.Battling ) then break; end;

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: looting even if you are under attack? dont like that

#3 Post by d003232 » Sun Jun 07, 2009 11:40 pm

Thx for your fast reply. I really like you and your bot! :-)
The RoM Bot Online Wiki needs your help!

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: looting even if you are under attack? dont like that

#4 Post by d003232 » Sun Jun 07, 2009 11:48 pm

Ups. I get an error:

player.lua308: no loop to break near ';'
The RoM Bot Online Wiki needs your help!

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: looting even if you are under attack? dont like that

#5 Post by Administrator » Mon Jun 08, 2009 12:03 am

Try this instead, then:

Code: Select all

if( self.Battling ) then
    self.Fighting = false;
    return;
end;

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: looting even if you are under attack? dont like that

#6 Post by d003232 » Mon Jun 08, 2009 12:17 am

Now the bot seems not to loot anymore at all. :roll:


edit: seem I need to test more. Not really sure what he is doing. Just wait a little.
The RoM Bot Online Wiki needs your help!

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: looting even if you are under attack? dont like that

#7 Post by d003232 » Mon Jun 08, 2009 12:34 am

Puh. Its not so easy to describe.

It seems if you get aggroed from an additional mob in an early stage of the fight, then after the first mob is death, the char is just standing still and doing nothing. If I than targeting the mob manual he fights the second mob.

If I get aggro in a later stage of the fight, he fights the mob by itselfe.

And sometimes he engage a mob normaly but dont run to the mob to loot it. And also in the protokoll there is no 'looting target' entry.

I will look further.
The RoM Bot Online Wiki needs your help!

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: looting even if you are under attack? dont like that

#8 Post by Administrator » Mon Jun 08, 2009 12:55 am

Ok, then remove the previous change(s), and change the if statement from

Code: Select all

if( self.TargetPtr ~= 0 ) then
To:

Code: Select all

if( self.Battling == false and self.TargetPtr ~= 0 ) then

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: looting even if you are under attack? dont like that

#9 Post by d003232 » Mon Jun 08, 2009 2:17 am

different isues:

- sometimes the mobs seems die to fast (?). He skips looting because self.Battling = true although there are no more aggroing mobs.

- we get aggro in the middle of a fight. And after the first mob, he stands still, targeting the death mob and in the protokoll is 'waiting on aggressive enemies" but he dont target that mob who is hitting us. He skips looting, that seems to be ok. I did a protokoll entry at the point of:

Code: Select all

 if( self.Battling ) then
    cprintf(cli.green, "still aggro, skip looting\n");
 end;

if( self.Battling == false and self.TargetPtr ~= 0 ) then	
What I'm wondering is, that in the protocoll, first stands 'still aggro, skip looting' and after that 'Target dead/lost'.
Attachments
Screenshot.gif
Screenshot.gif (4.86 KiB) Viewed 3156 times
The RoM Bot Online Wiki needs your help!

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: looting even if you are under attack? dont like that

#10 Post by d003232 » Mon Jun 08, 2009 6:27 am

I'm now working with:

Code: Select all

	if( self.Battling ) then
	   cprintf(cli.green, "still aggro, skip looting\n");
	   self:clearTarget();                                     -- get rid of the death mob
	end;

 	if( self.Battling == false and self.TargetPtr ~= 0 ) then	
at player.lua line 308.

Means I add an 'self:clearTarget();' to get rid of the death mob and made place for the aggroing mob. That solves the second issue.

But he still skip sometimes looting because of 'self.Battling' though there is no additional mob. At the moment I dont understand 'self.Battling' and 'self.Fighting' enough. I will try to look and search a little deeper.
The RoM Bot Online Wiki needs your help!

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: looting even if you are under attack? dont like that

#11 Post by d003232 » Mon Jun 08, 2009 8:45 am

Here now my final version for player.lua at line 304. Hope all isues seems to work now:

Code: Select all

		yrest(500);                         -- wait a little for battling flag update in client

	-- Monster is dead (0 HP) but still targeted.
	-- Loot and clear target.
	self:update();
	
	if( self.Battling ) then
	   cprintf(cli.green, "still aggro, skip looting\n");
	   self:clearTarget();                    -- get rid of the death mob
	end;

 	if( self.Battling == false and self.TargetPtr ~= 0 ) then	
--	if( self.TargetPtr ~= 0 ) then         -- old code, replaced with line before
I added a 'yrest(500)' before the 'self:update'. Now there aren't anymore missed loots.

btw: What I not really understand is the connection between 'self:update();' and 'CPlayer:update()'. I dont understand or find where 'self:update()' is defined and where 'self:update()' calls 'CPlayer:update()'.
Last edited by d003232 on Mon Jun 08, 2009 4:01 pm, edited 1 time in total.
The RoM Bot Online Wiki needs your help!

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: looting even if you are under attack? dont like that

#12 Post by Administrator » Mon Jun 08, 2009 2:19 pm

'player' is an instance of the object CPlayer. CPlayer has a function named update(). Code inside CPlayer can use self:functionName() to call functions within the object. That is, you call player:update() from outside the object, and use self:update() from inside of it. 'self' is just a representation of the calling object.

So, then your second question is between player:update() and CPlayer:update(). Well, CPlayer is a base object. We don't actually use it directly. It's more like a blueprint. We create an instance of CPlayer named player that we actually use. This is the difference. When we want to call a function from the base object and not from the instance, we could use CPlayer:function() instead, or even CPawn:function() (CPawn is the base of CPlayer).

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests