How to turn and face direction to next waypoint

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Rickster
Posts: 291
Joined: Sun Oct 24, 2010 4:23 pm

How to turn and face direction to next waypoint

#1 Post by Rickster » Wed Feb 06, 2013 10:41 pm

Hi there,

how can i get my char to turn direction to the naxt WP?

When reaching one waypoint, I want to change char direction and camera view to the next waypoint, without movint to the next WP.

Thanx
Ric

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

Re: How to turn and face direction to next waypoint

#2 Post by rock5 » Thu Feb 07, 2013 1:10 am

Code: Select all

player:aimAt(__WPL:getNextWaypoint())
I think that should work.
  • 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

Mer-Ki-Vah
Posts: 35
Joined: Sat Feb 04, 2012 6:53 am

Re: How to turn and face direction to next waypoint

#3 Post by Mer-Ki-Vah » Thu Feb 07, 2013 1:14 am

Call this function:

Code: Select all

function lookatTarget(X,Z,Y)   
   local angle  = math.atan2(Z - player.Z, X - player.X);
   local yangle = math.atan2(Y - player.Y, ((X - player.X)^2 + (Z - player.Z)^2)^.5 );                  
   player:faceDirection(angle, yangle);
   camera:setRotation(angle);
end

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

Re: How to turn and face direction to next waypoint

#4 Post by rock5 » Thu Feb 07, 2013 1:32 am

Ah yes, my command only turns the camera
  • 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

Rickster
Posts: 291
Joined: Sun Oct 24, 2010 4:23 pm

Re: How to turn and face direction to next waypoint

#5 Post by Rickster » Thu Feb 07, 2013 5:22 am

thanx!

i call the function this way

Code: Select all

lookatTarget(__WPL:getNextWaypoint().X,__WPL:getNextWaypoint().Z,__WPL:getNextWaypoint().Y)
and it works fine :)

btw, how can i get accass to the actual WP info? i could not find this info in the wiki - Waypoint File Functions

i would like to get the actual WP index. i am using this as a workaround

Code: Select all

wp_index = __WPL:getNextWaypoint().wpnum - 1 
:D but i would also like to get access to the rest of the actual wp´s table.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: How to turn and face direction to next waypoint

#6 Post by lisa » Thu Feb 07, 2013 5:42 am

you mean this?

Code: Select all

__WPL.CurrentWaypoint
basically use __WPL instead of self for this stuff

Code: Select all

		self.Waypoints = {};
		self.CurrentWaypoint = 1;
		self.LastWaypoint = 1;
		self.Direction = WPT_FORWARD;
		self.OrigX = player.X;
		self.OrigZ = player.Z;
		self.Radius = 500;
		self.FileName = nil;
		self.Mode = "waypoints";
		self.KillZone = {};
		self.ExcludeZones = {}
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

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

Re: How to turn and face direction to next waypoint

#7 Post by rock5 » Thu Feb 07, 2013 5:49 am

All the waypoints are stored in a table in __WPL.Waypoints. __WPL:getNextWaypoint() returns the 'currentwaypoint' which is one of those waypoints. When moving between waypoints the 'currentwaypoint' is the one you are heading towards. When you reach a waypoint and it is executing the code there, the 'currentwaypoint' is the next waypoint. If you want information about the waypoint you are at you can get it like this

Code: Select all

thiswp = __WPL:getNextWaypoint(-1)
thiswp will include X, Z, Y, Action, Type, Tag and wpnum (wpnum is not normally part of the __WPL table but is added in that function). You can also get the wp number you are at with __WPL.CurrentWaypoint-1.

Hope that wasn't too confusing.
  • 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

Rickster
Posts: 291
Joined: Sun Oct 24, 2010 4:23 pm

Re: How to turn and face direction to next waypoint

#8 Post by Rickster » Thu Feb 07, 2013 6:54 am

nope, not confusing. that was exactly what i needed! :) thank you all!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests