Boting in "small" places

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Steinmeier
Posts: 10
Joined: Tue Sep 15, 2009 6:41 pm

Boting in "small" places

#1 Post by Steinmeier » Mon Oct 12, 2009 1:24 pm

Please can anyone tell me how to not target enemys behind walls.
Zilvermoon wrote some time ago:
I just created some custom code for all those "small" places where you accidently target things behind wall's and stuff ... so your character end up running into the wall's ... with this piece of code you'll just clearTarget() if they are further away than you set up in your profile ... anyone interested?

"Normal" code in player.lua (around line 184 ... might be a line other that this got a few pieces of custom code in my files)

Code: Select all

local dist = distance(self.X, self.Z, target.X, target.Z);




Change it to this:

Code: Select all

local dist = distance(self.X, self.Z, target.X, target.Z);


if (settings.profile.options.WAYPOINTSMAXDISTANCE) then
local MaxDist = settings.profile.options.WAYPOINTSMAXDISTANCE;
if ( MaxDist < dist ) then
printf("Too far away\n");
player:clearTarget();
break;
end
end



and in your profile add this:

Code: Select all

   <option name="WAYPOINTSMAXDISTANCE" value="200" />
you can set the value to what ever you want it to be, and you mmight have to experiment a bit to get the value right depending of the place you are in...
but since then player.lua changed and there are 3 lines with

Code: Select all

 local dist = distance(self.X, self.Z, target.X, target.Z);
TIA
Steinmeier

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

Re: Boting in "small" places

#2 Post by d003232 » Mon Oct 12, 2009 1:39 pm

That's a good idea. We could do something in the standard bot. I suppose it could be added to the player:haveTarget() function. I'm out of house for some days and will look for that after being back home.
The RoM Bot Online Wiki needs your help!

Zilvermoon
Posts: 104
Joined: Mon Jan 05, 2009 8:19 am

Re: Boting in "small" places

#3 Post by Zilvermoon » Mon Oct 12, 2009 1:53 pm

Steinmeier wrote:Please can anyone tell me how to not target enemys behind walls.
Zilvermoon wrote some time ago:
I just created some custom code for all those "small" places where you accidently target things behind wall's and stuff ... so your character end up running into the wall's ... with this piece of code you'll just clearTarget() if they are further away than you set up in your profile ... anyone interested?

"Normal" code in player.lua (around line 184 ... might be a line other that this got a few pieces of custom code in my files)

Code: Select all

local dist = distance(self.X, self.Z, target.X, target.Z);




Change it to this:

Code: Select all

local dist = distance(self.X, self.Z, target.X, target.Z);


if (settings.profile.options.WAYPOINTSMAXDISTANCE) then
local MaxDist = settings.profile.options.WAYPOINTSMAXDISTANCE;
if ( MaxDist < dist ) then
printf("Too far away\n");
player:clearTarget();
break;
end
end



and in your profile add this:

Code: Select all

   <option name="WAYPOINTSMAXDISTANCE" value="200" />
you can set the value to what ever you want it to be, and you mmight have to experiment a bit to get the value right depending of the place you are in...
but since then player.lua changed and there are 3 lines with

Code: Select all

 local dist = distance(self.X, self.Z, target.X, target.Z);
TIA
Steinmeier
I personally don't play RoM anymore, but did a quick glance and this code should do the trick:
..\rom\classes\player.lua ... line 562 --> line 573

Code: Select all

		local dist = distance(self.X, self.Z, target.X, target.Z);
		if( settings.profile.options.WAYPOINTSMAXDISTANCE ) then
			local MaxDist = settings.profile.options.WAYPOINTSMAXDISTANCE;
			if ( MaxDist < dist ) then
				printf("Too far away\n");
				player:clearTarget();
				break;
			end
		end
		if( hf_start_dist == 0 ) then		-- remember distance we start the fight
			hf_start_dist = dist;
		end
The original code looks like this:
..\rom\classes\player.lua ... line 562 --> line 565

Code: Select all

		local dist = distance(self.X, self.Z, target.X, target.Z);
		if( hf_start_dist == 0 ) then		-- remember distance we start the fight
			hf_start_dist = dist;
		end
Remember you need this in your profile, and the value (in this case "200" is the max distance you'll engage a target, so if the target is longer than this value away from you you'll clear target, and move on):

Code: Select all

<option name="WAYPOINTSMAXDISTANCE" value="200" />
I also added a patch file for those that might need that. (remember to manually add the Profile part, it's not included in the patch file.)

Zilvermoon
Attachments
MaxDistanceEngageTarget.zip
(466 Bytes) Downloaded 109 times

Steinmeier
Posts: 10
Joined: Tue Sep 15, 2009 6:41 pm

Re: Boting in "small" places

#4 Post by Steinmeier » Mon Oct 12, 2009 3:24 pm

Many thanks for the fast answers.
I've had a few glasses of wine in the meanwhile and will try it out tomorrow.

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

Re: Boting in "small" places

#5 Post by d003232 » Wed Oct 14, 2009 3:49 pm

I put that new option into the standard bot. The name of the profile option is

Code: Select all

<option name="MAX_TARGET_DIST"		value="999" />
See SVN 352.
The RoM Bot Online Wiki needs your help!

Steinmeier
Posts: 10
Joined: Tue Sep 15, 2009 6:41 pm

Re: Boting in "small" places

#6 Post by Steinmeier » Thu Oct 15, 2009 7:53 am

Great!
Keep up the good work!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests