Bot untargets as soon as player is at range

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
YetAnotherUser
Posts: 7
Joined: Sat Nov 12, 2022 6:18 am

Bot untargets as soon as player is at range

#1 Post by YetAnotherUser » Sun Nov 13, 2022 7:25 am

I have a waypoint that works quite nicely, but sometimes the bot starts messing up, and when player gets close to target, it logs:

Code: Select all

Target lost.
Clearing target.
and just moves on instead of attacking. Sometimes it only logs "Clearing target." (no "Target lost."), but either way it just skips current mob.

What is curious is that some days it works just fine, without any change to either profile .xml or waypoint...

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

Re: Bot untargets as soon as player is at range

#2 Post by Administrator » Sun Nov 13, 2022 8:51 am

Any additional information you could provide would be helpful. Does it only happen in a certain zone? On a certain character? Under certain circumstances?

Please enable target debugging in your profile:

Code: Select all

<option name="DEBUG_TARGET" value="true" />
This should then give the failure reason when it clears the target, which would greatly help in fixing the issue.

YetAnotherUser
Posts: 7
Joined: Sat Nov 12, 2022 6:18 am

Re: Bot untargets as soon as player is at range

#3 Post by YetAnotherUser » Sun Nov 13, 2022 9:55 am

I didn't try another zone or character, so can't really answer your questions.
As per the circumstances, as far as I am aware, nothing changes, sometimes it works, sometimes it doesn't.

I wasn't aware of that option, so I'll enable it and tell you as soon as I have more data :) thank you

Edit:
Below are the two different yellow messages with debug option:

Code: Select all

[DEBUG] 880992512 mob limitation is set, mob is not a valid target

Code: Select all

[DEBUG] 880991232 target lvl above/below profile settings without battling
Though I don't get it because the mob ID is in my mobs list, mob is 16 lvl below my lvl, and I have:

Code: Select all

<option name="TARGET_LEVELDIF_ABOVE" value="3" />
<option name="TARGET_LEVELDIF_BELOW" value="20" />
Edit2:

So I changed that line of code:

Code: Select all

debug_target("target lvl above/below profile settings without battling)
to:

Code: Select all

debug_target("target lvl above/below profile settings without battling : "..target.Level.." vs "..player.Level)
And found out that sometimes player.Level has a seemingly random negative value, so I added a player:updateLevel() right before target:updateLevel(), and so far so good.

I am still trying to figure out why sometimes the bot thinks that the target is not in my mobs list, but I think it's a matter of time

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

Re: Bot untargets as soon as player is at range

#4 Post by Administrator » Thu Nov 17, 2022 3:28 pm

Are you doing anything that would perhaps cause you to enter a loading screen, such as entering a portal?

YetAnotherUser
Posts: 7
Joined: Sat Nov 12, 2022 6:18 am

Re: Bot untargets as soon as player is at range

#5 Post by YetAnotherUser » Fri Nov 18, 2022 12:13 am

Nope. Thinking of it, it may be because I am changing classes (in order to be able to take dailies), so I could probably use player:updateLevel() after changing class instead

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

Re: Bot untargets as soon as player is at range

#6 Post by Administrator » Fri Nov 18, 2022 1:10 pm

Keep me updated as to whether or not that works for you.

Alternatively, this might be worth trying: line 218 of classes/player.lua is this:

Code: Select all

	if( self.Level == nil or self.Level < 1 or self.Level > 300 ) then
		self.Level = memoryReadInt(getProc(), self.Address + addresses.game_root.pawn.level) or self.Level;
	end
Change to:

Code: Select all

	if( self.Level == nil or self.Level < 1 or self.Level > 300 ) then
		local tmpLevel = memoryReadInt(getProc(), self.Address + addresses.game_root.pawn.level);
		if( tmpLevel ~= nil and tmpLevel > 0 ) then
			self.Level =  tmpLevel;
		end
	end

YetAnotherUser
Posts: 7
Joined: Sat Nov 12, 2022 6:18 am

Re: Bot untargets as soon as player is at range

#7 Post by YetAnotherUser » Sat Nov 19, 2022 1:51 am

Using

Code: Select all

player:updateLevel()
after changing classes seems to be enough to fix my problem (so far).
Regarding the other message, I added more debug info to it (

Code: Select all

debug_target("mob limitation is set, mob is not a valid target (Id:"..target.Id.." / Name: "..target.Name..")")
) and it appears it was just ambiance mobs being targetted/untargetted.

So far so good ;)

Now the only thing that still bugs my bot is that sometimes the character goes running into the wild, so maybe the location gets wrongly updated at some point. Is there a debug option for this as well?

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

Re: Bot untargets as soon as player is at range

#8 Post by Administrator » Sat Nov 19, 2022 5:22 pm

Not really. It could be caused by anything. Would help to get more detail. Like, does it happen only with certain waypoints? Do you just run endlessly in one direction, or character change direction and seem to go all over? Does it target and fight things still? And so on. The more detail, the better.

YetAnotherUser
Posts: 7
Joined: Sat Nov 12, 2022 6:18 am

Re: Bot untargets as soon as player is at range

#9 Post by YetAnotherUser » Sun Nov 20, 2022 3:45 am

I just run endlessly in one direction (no random wandering). I don't know if it still targets and fight, as when I saw that, it was in mob-free environment. I wrote "running into the wild" because on several occurences, the direction wasn't even the one needed to reach next waypoint. Also no specific waypoint

YetAnotherUser
Posts: 7
Joined: Sat Nov 12, 2022 6:18 am

Re: Bot untargets as soon as player is at range

#10 Post by YetAnotherUser » Wed Nov 23, 2022 4:33 am

Issue with level occurred again yesterday for some reason.
I tried your fix with no success (I would still get random negative values), I even tried to bruteforce player.Level = 100 in my waypoint, but it kept being replaced with wrong values, so I ended up changing:

Code: Select all

target:updateLevel()
if( ( target.Level - player.Level ) > tonumber(settings.profile.options.TARGET_LEVELDIF_ABOVE)  or
    ( player.Level - target.Level ) > tonumber(settings.profile.options.TARGET_LEVELDIF_BELOW)  ) then
  debug_target("target lvl above/below profile settings without battling")
  return false;	-- he is not a valid target
end;
for:

Code: Select all

target:updateLevel()
if( target.Level < 2) then
  debug_target("target lvl below 2: "..target.Level)
  return false;
end
as I don't really care about lvl restriction for this waypoint.
Would it be possible to add an option, say TARGET_LEVELDIF_CHECK and set it to false when we don't need it?

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

Re: Bot untargets as soon as player is at range

#11 Post by Administrator » Sun Nov 27, 2022 10:08 am

You could just set both TARGET_LEVELDIF_ABOVE and TARGET_LEVELDIF_BELOW to high levels in your waypoint's onload.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 19 guests