looting even if you are under attack? dont like that
looting even if you are under attack? dont like that
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!
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: looting even if you are under attack? dont like that
Line 303 of classes/player.lua, look for this:
Right under self:update(), insert this:
Code: Select all
-- Monster is dead (0 HP) but still targeted.
-- Loot and clear target.
self:update();
if( self.TargetPtr ~= 0 ) then
Code: Select all
if( self.Battling ) then break; end;
Re: looting even if you are under attack? dont like that
Thx for your fast reply. I really like you and your bot!
The RoM Bot Online Wiki needs your help!
Re: looting even if you are under attack? dont like that
Ups. I get an error:
player.lua308: no loop to break near ';'
player.lua308: no loop to break near ';'
The RoM Bot Online Wiki needs your help!
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: looting even if you are under attack? dont like that
Try this instead, then:
Code: Select all
if( self.Battling ) then
self.Fighting = false;
return;
end;
Re: looting even if you are under attack? dont like that
Now the bot seems not to loot anymore at all.
edit: seem I need to test more. Not really sure what he is doing. Just wait a little.
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!
Re: looting even if you are under attack? dont like that
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.
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!
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: looting even if you are under attack? dont like that
Ok, then remove the previous change(s), and change the if statement from
To:
Code: Select all
if( self.TargetPtr ~= 0 ) then
Code: Select all
if( self.Battling == false and self.TargetPtr ~= 0 ) then
Re: looting even if you are under attack? dont like that
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:
What I'm wondering is, that in the protocoll, first stands 'still aggro, skip looting' and after that 'Target dead/lost'.
- 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
- Attachments
-
- Screenshot.gif (4.86 KiB) Viewed 3156 times
The RoM Bot Online Wiki needs your help!
Re: looting even if you are under attack? dont like that
I'm now working with:
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.
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
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!
Re: looting even if you are under attack? dont like that
Here now my final version for player.lua at line 304. Hope all isues seems to work now:
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()'.
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
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!
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: looting even if you are under attack? dont like that
'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).
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).
Who is online
Users browsing this forum: No registered users and 8 guests