my bot gets his first reputation points :-)

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

my bot gets his first reputation points :-)

#1 Post by d003232 » Fri Jun 19, 2009 9:07 am

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!

User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: my bot gets his first reputation points :-)

#2 Post by 3cmSailorfuku » Fri Jun 19, 2009 9:46 am

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 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?).
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.

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

Re: my bot gets his first reputation points :-)

#3 Post by Administrator » Fri Jun 19, 2009 7:12 pm

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.

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

Re: my bot gets his first reputation points :-)

#4 Post by d003232 » Mon Jun 22, 2009 2:12 pm

Administrator wrote:It can be done. CPlayer:haveTarget() can be modified to check for this
I did it with the check in CPlayer:haveTarget()

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;
and it seems to work find. thx. I think on check more if we are in battle, could be to check if we also are the target of the PK player. But the more importent part is, that we dont select the PK player and attack it first.
The RoM Bot Online Wiki needs your help!

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

Re: my bot gets his first reputation points :-)

#5 Post by Administrator » Mon Jun 22, 2009 5:34 pm

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

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

Re: my bot gets his first reputation points :-)

#6 Post by d003232 » Mon Jun 22, 2009 8:30 pm

That's my additional code now within 'function CPlayer:haveTarget()'. Seems to work very well

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;
I placed it directly after

Code: Select all

		if( target == nil ) then
			return false;
		end;
The RoM Bot Online Wiki needs your help!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests