Getting stuck while fighting

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Getting stuck while fighting

#1 Post by rock5 » Fri Apr 09, 2010 12:20 am

I've noticed a situation where the bot can get stuck and not be able to continue.

It's when you start a fight with a mob and it moves into a position where you are unable to attack it.

In this situation the mob will continuously attack you. After awhile the bot notices that it has stopped damaging the mob so it clears the target but immediately notices that it is in combat so waits for aggro. It then tries to attack the mob again starting the loop all over again.

At no point does the character move.

I think a simple fix for this is when the bot stops damaging the mob and clears the target, the first thing it should do is take a step or 2 forward before waiting for aggro again.

Or maybe, before clearing the target, it could try moving a bit to see if it is now able to damage the mob.

This has happened with at least 2 of my waypoint files so I hope it can be fixed.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

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

Re: Getting stuck while fighting

#2 Post by Administrator » Fri Apr 09, 2010 4:12 am

Open rom/classes/player.lua, go to (CTRL+G) line 404.

Directly under this line:

Code: Select all

				self:clearTarget();
Add this:

Code: Select all

self:unstick();
self:update();
Save and let me know if this fixes the problem or if it causes any other issues.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Getting stuck while fighting

#3 Post by rock5 » Fri Apr 09, 2010 5:31 am

Of the 4 times I tried it, it only worked 2 times. The 2 times it didn't work it still just stood there.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Getting stuck while fighting

#4 Post by rock5 » Fri Apr 09, 2010 12:36 pm

Also, it should only do the unstick if in combat. But I've noticed that if you target a mob and can't attack it, but haven't attracted aggro yet, you still do the unstick move before continuing to the next waypoint.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Garrison
Posts: 11
Joined: Thu Mar 25, 2010 8:59 am

Re: Getting stuck while fighting

#5 Post by Garrison » Fri Apr 09, 2010 5:12 pm

Is there a way to make bot use games own stuck report feature? It would be nice.

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

Re: Getting stuck while fighting

#6 Post by Administrator » Fri Apr 09, 2010 7:38 pm

You could change it to:

Code: Select all

if( self.Battling ) then
     yrest(1000);
     self:unstick();
     self:update();
     yrest(500);
end
That should help some. I'm not sure what would cause it to 'not work'. You'll have to describe what you mean. Does it not move (ie. the unsticking isn't doing anything at all)? Is the player actually stuck and unable to move? Did it not move far enough to draw the monster out where it can be attacked? The more detail you give, the better.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Getting stuck while fighting

#7 Post by rock5 » Fri Apr 09, 2010 9:13 pm

Administrator wrote:You could change it to:

Code: Select all

if( self.Battling ) then
     yrest(1000);
     self:unstick();
     self:update();
     yrest(500);
end
That should help some. I'm not sure what would cause it to 'not work'. You'll have to describe what you mean. Does it not move (ie. the unsticking isn't doing anything at all)? Is the player actually stuck and unable to move? Did it not move far enough to draw the monster out where it can be attacked? The more detail you give, the better.
What I meant by 'not work' is it doesn't do the unstick. It clears the target, then waits for aggro without moving. I tried putting a print statement before it to see if it actually gets to that code. I didn't see the print statement so it never got to that code. Maybe there are certain circumstances where that code doesn't execute?

I noticed there is another "Taking too long to damage target" loop around line 630. Maybe that's the one getting executed. What's the difference between the 2 loops?

As to whether the above code fixes unsticking when not in combat, I can't test that right now. Maybe tonight.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Getting stuck while fighting

#8 Post by rock5 » Mon Apr 12, 2010 5:20 am

Administrator wrote:You could change it to:

Code: Select all

if( self.Battling ) then
     yrest(1000);
     self:unstick();
     self:update();
     yrest(500);
end
That should help some. I'm not sure what would cause it to 'not work'. You'll have to describe what you mean. Does it not move (ie. the unsticking isn't doing anything at all)? Is the player actually stuck and unable to move? Did it not move far enough to draw the monster out where it can be attacked? The more detail you give, the better.
I'm not sure what the difference is between the "Taking too long to damage target" loop in checkSkills and fight functions but I copied this code to both line 404 and around 630. Now it unsticks every time.

I also tested to see if the "if self.battling" condition has stopped it from unsticking when not in battle. It has.

So it looks like that is all working. The only comment I would make is it moves too much.

When you are too close to the target it takes a couple of steps back. Is it possible to use that function instead?

I believe it is something along the lines of;

Code: Select all

keyboardHold( settings.hotkeys.MOVE_BACKWARD.key);
yrest(200);
keyboardRelease( settings.hotkeys.MOVE_BACKWARD.key);
I just tried this but when he steps back he steps forward again to stand in exactly the same spot. Is there any way to avoid it moving forward again?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

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

Re: Getting stuck while fighting

#9 Post by Administrator » Mon Apr 12, 2010 5:56 am

I think that your character is moving forward again because it is attempting to use a melee skill (which causes your character to run towards the target with click-to-move turned on) or because the bot notices it is too far away from the target. Try resting for 1 second ( yrest(1000) should do the trick) after moving backwards. Let me know if you can get this to work sufficiently and I'll include it.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Getting stuck while fighting

#10 Post by rock5 » Mon Apr 12, 2010 7:52 am

Administrator wrote:I think that your character is moving forward again because it is attempting to use a melee skill (which causes your character to run towards the target with click-to-move turned on) or because the bot notices it is too far away from the target. Try resting for 1 second ( yrest(1000) should do the trick) after moving backwards. Let me know if you can get this to work sufficiently and I'll include it.
I added a 1 second pause after moving back and before the player:update(). It paused for 1 second after moving back but still moved forward. I even used a longer pause but it seems that before my priest castes any spells he moves forward first.

I think I figured it out. On closer inspection of the MM window I notice it's trying to loot after clearing the target. Looting uses the attack action correct?

That should give you something to follow up.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

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

Re: Getting stuck while fighting

#11 Post by Administrator » Mon Apr 12, 2010 5:22 pm

Try this. On line 840 of rom/classes/player.lua, you'll see this:

Code: Select all

	if( settings.profile.options.LOOT == true  and
Change to:

Code: Select all

	if( not break_fight and settings.profile.options.LOOT == true  and
Let me know how that works for you.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Getting stuck while fighting

#12 Post by rock5 » Mon Apr 12, 2010 11:57 pm

No change. Still looted.

I noticed, though, the only thing in that if statement was inventory:updateSlotsByTime(800);. How is not running this supposed to stop me looting?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

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

Re: Getting stuck while fighting

#13 Post by Administrator » Tue Apr 13, 2010 5:59 am

My mistake. I posted that quite hastily. Look a few lines down and you'll have to wrap the loot call in an if statement.

Code: Select all

	self:update();
	if( not break_fight ) then
		self:loot();
	end

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Getting stuck while fighting

#14 Post by rock5 » Tue Apr 13, 2010 9:46 am

Administrator wrote:My mistake. I posted that quite hastily. Look a few lines down and you'll have to wrap the loot call in an if statement.

Code: Select all

	self:update();
	if( not break_fight ) then
		self:loot();
	end
Ok, that works. So everything works now.

So to summarize, I've added this code to around line 405 and 634;

Code: Select all

if( self.Battling ) then
    yrest(1000);
	keyboardHold( settings.hotkeys.MOVE_BACKWARD.key);
	yrest(1000);
	keyboardRelease( settings.hotkeys.MOVE_BACKWARD.key);
	self:update();
end
Although I suspect that it is not needed at line 405 as every time I got stuck while in combat, it has executed the code at line 634. The only time it executed the code at line 405 was when I got stuck but didn't get aggro.

And I've changed self:loot(); around line 863 to;

Code: Select all

	if( not break_fight ) then
		self:loot();
	end
I guess now you can implement it.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

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

Re: Getting stuck while fighting

#15 Post by Administrator » Tue Apr 13, 2010 5:15 pm

Ok, just committed this with r432. It should also resolve some more waypoint issues.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Getting stuck while fighting

#16 Post by rock5 » Tue Apr 13, 2010 9:05 pm

Administrator wrote:OK, just committed this with r432. It should also resolve some more waypoint issues.
There were a couple of errors;
Line 858 of player.lua has an extra 'and';

Code: Select all

if( and settings.profile.options.LOOT == true  and
And line 797 of bot.lua is missing a bracket;

Code: Select all

__RPL:setCurrentWaypoint __RPL:getNearestWaypoint(player.X, player.Z ) );
Also this revision still takes you to the point before the closest waypoint when first starting the bot.

Obviously when starting the bot and loading the first waypoint file it's doing something different than when just using the loadPaths function. Hope you can resolve this because to start a waypoint file from the right place(l1t_start.xml for example) I have to move to waypoint 2 before starting it. It then goes to waypoint 1 then back to 2. If I don't do this it tries to take me to the last point first. LOL
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

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

Re: Getting stuck while fighting

#17 Post by Administrator » Wed Apr 14, 2010 7:28 am

Ok, I think I've finally got it all figured out. It should be working properly now. I've also removed setCurrentWaypoint (use setWaypointIndex() again).

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Getting stuck while fighting

#18 Post by rock5 » Wed Apr 14, 2010 9:00 am

Administrator wrote:Ok, I think I've finally got it all figured out. It should be working properly now. I've also removed setCurrentWaypoint (use setWaypointIndex() again).
Yep, tested all 3 and they seem to work.
  • Starting a new file goes to the nearest waypoint first.
  • Loadpaths() takes you to the nearest waypoint.
  • setWaypointIndex takes you to the correct waypoint.
All I have to do now is find and change all the places I've already used seCurrentWaypoint.

Thanks for all your efforts.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests