my bot gets his first reputation points :-)
my bot gets his first reputation points :-)
it is nice to see, that my bot was the winner against one other player. And I not really want to be engaged in such trouble with my bot. Is there a way to detect the target type = 'Player' and skit that from targeting? It is okay to fight them, if the aggro me, but I dont want to do the first strike.
The RoM Bot Online Wiki needs your help!
- 3cmSailorfuku
- Posts: 354
- Joined: Mon Jan 21, 2008 6:25 pm
Re: my bot gets his first reputation points :-)
You could create another section like the friend detection and name it blacklist instead, if targetname ~= profilename[] and make it skip the target (Check for inbattle?).d003232 wrote:it is nice to see, that my bot was the winner against one other player. And I not really want to be engaged in such trouble with my bot. Is there a way to detect the target type = 'Player' and skit that from targeting? It is okay to fight them, if the aggro me, but I dont want to do the first strike.
You would have to insert all Monsters that appear in your reach, if you suddenly start targetting a Player it will then skip it and wait till you are in battle with that person.
Flawed Idea of mine though.
- Administrator
- Site Admin
- Posts: 5313
- Joined: Sat Jan 05, 2008 4:21 pm
Re: my bot gets his first reputation points :-)
It can be done. CPlayer:haveTarget() can be modified to check for this, I suppose. It won't necessarily be 100% effective, but it should be pretty close. You'll have to check if target.Type is PT_PLAYER and self.Battling, then that person is a valid target. If it is a player, and you are not in battle, then it is not a valid target.
Re: my bot gets his first reputation points :-)
I did it with the check in CPlayer:haveTarget()Administrator wrote:It can be done. CPlayer:haveTarget() can be modified to check for this
Code: Select all
if( target.Type == PT_PLAYER and -- Player are type == 1
self.Battling == false ) then -- if he dont fight us, then
return false; -- he is not a valid target
end;
The RoM Bot Online Wiki needs your help!
- Administrator
- Site Admin
- Posts: 5313
- Joined: Sat Jan 05, 2008 4:21 pm
Re: my bot gets his first reputation points :-)
You can check the PKers target and see if it is you. This is done like this:
Code: Select all
if( target.TargetPtr == self.TargetPtr ) then
-- he is targeting us
end
Re: my bot gets his first reputation points :-)
That's my additional code now within 'function CPlayer:haveTarget()'. Seems to work very wellI placed it directly after
Code: Select all
if( target.Type == PT_PLAYER ) then -- Player are type == 1
if ( self.Battling == false ) then -- if we don't have aggro then
return false; -- he is not a valid target
end;
if( self.Battling == true and -- we have aggro
target.TargetPtr ~= self.Address ) then -- but not from the PK player
return false;
end;
end;
Code: Select all
if( target == nil ) then
return false;
end;
The RoM Bot Online Wiki needs your help!
Who is online
Users browsing this forum: No registered users and 3 guests