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