• Visit Rebornbuddy
  • Which is proper player mover?

    Discussion in 'Community Developer Forum' started by Twist, Mar 1, 2014.

    1. Twist

      Twist Community Developer

      Joined:
      Oct 15, 2010
      Messages:
      643
      Likes Received:
      31
      Trophy Points:
      28
      Navigator.MoveTo throws navigationprovider is null
      Navigator.NavigationProvider.MoveTo throws error.
      Navigator.PlayerMover.MoveTowards thows an error also.

      Which is the proper way to navigate to a Vector3 location?
      Thanks.
       
    2. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,232
      Likes Received:
      364
      Trophy Points:
      83
      Need to init them before use.

      Code:
      Navigator.PlayerMover = new SlideMover();
      Navigator.NavigationProvider = new AStarNavigator(ProfileManager.CurrentProfile.graph);
      
      Right now you need to provide a graph object containing all the viable nodes that it can move between. We just entered closed alpha using the new mesh system.
       
    3. Twist

      Twist Community Developer

      Joined:
      Oct 15, 2010
      Messages:
      643
      Likes Received:
      31
      Trophy Points:
      28
      Ok I see - Thanks for that. So I assume it creates the strongly typed nodes from the XML profiles. Thus we can programmatically create nodes and add them to the graph?
      ProfileManager.CurrentProfile.graph.AddNode(Me.x, Me.y, Me.z); (i know your not gonna add your own position, just for demonstration)

      SliderMover is not a recognized object- not in the RebornBuddy assembly? Not in the static navigator either... thoughts?

      Navigator.PlayerMover = new SlideMover();
      Navigator.NavigationProvider = new AStarNavigator(ProfileManager.CurrentProfile.graph);

      Thank you for your assistance!
      Twist
       
    4. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,232
      Likes Received:
      364
      Trophy Points:
      83
      Looks like its not set to public.

      Code:
          class SlideMover : IPlayerMover
          {
              public void MoveStop()
              {
                  MovementManager.MoveForwardStop();
              }
      
              public void MoveTowards(Vector3 location)
              {
      			GameObjectManager.LocalPlayer.Face(location);
                  MovementManager.MoveForwardStart();
              }
          }
      
       
    5. kazaak

      kazaak New Member

      Joined:
      Feb 1, 2014
      Messages:
      8
      Likes Received:
      0
      Trophy Points:
      0
    6. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,232
      Likes Received:
      364
      Trophy Points:
      83
    7. Twist

      Twist Community Developer

      Joined:
      Oct 15, 2010
      Messages:
      643
      Likes Received:
      31
      Trophy Points:
      28
      Excellent Sir. I will try this now. Thank you for sharing!
       
    8. Twist

      Twist Community Developer

      Joined:
      Oct 15, 2010
      Messages:
      643
      Likes Received:
      31
      Trophy Points:
      28
      Error 4 No overload for method 'Face' takes 1 arguments


      Code:
          public class SlideMover : IPlayerMover
          {
              public void MoveStop()
              {
                  MovementManager.MoveForwardStop();
              }
      
              public void MoveTowards(Vector3 location)
              {
                  GameObjectManager.LocalPlayer.Face(location);
                  MovementManager.MoveForwardStart();
              }
          }
      Looks like there is no overload to face...
       
    9. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,232
      Likes Received:
      364
      Trophy Points:
      83
      Sorry, was in the wrong branch when I coped the code.

      Code:
          class SlideMover : IPlayerMover
          {
              public void MoveStop()
              {
                  MovementManager.MoveForwardStop();
              }
      
              public void MoveTowards(Vector3 location)
              {
                  location.Face();
                  MovementManager.MoveForwardStart();
              }
          }
      
       
    10. Twist

      Twist Community Developer

      Joined:
      Oct 15, 2010
      Messages:
      643
      Likes Received:
      31
      Trophy Points:
      28
      Im thinking this...
      public void MoveTowards(Vector3 location)
      {
      Vector3 pixelpos = location;
      float rotation = (float)(Math.Atan2(pixelpos.Y, pixelpos.X) / (2 * Math.PI));
      GameObjectManager.LocalPlayer.SetFacing(rotation);

      MovementManager.MoveForwardStart();
      }
       
    11. Twist

      Twist Community Developer

      Joined:
      Oct 15, 2010
      Messages:
      643
      Likes Received:
      31
      Trophy Points:
      28
      Oh thats much better. And doesnt require me to do math. Thank you sir.
       
    12. Twist

      Twist Community Developer

      Joined:
      Oct 15, 2010
      Messages:
      643
      Likes Received:
      31
      Trophy Points:
      28
      Ok got it all working!
      For the record Location.Face and MovementManager.SetFacing(floatvector); doesn't work when your mounted.
      Thank you for your help though! This project can now MoveTowards forward... hehe.
       
    13. Exmortem

      Exmortem Community Developer

      Joined:
      Mar 28, 2010
      Messages:
      799
      Likes Received:
      16
      Trophy Points:
      18
      I'm really interested in what you're making. :p
       
    14. Twist

      Twist Community Developer

      Joined:
      Oct 15, 2010
      Messages:
      643
      Likes Received:
      31
      Trophy Points:
      28
      Well first up i have a patrol bot. That will wander around and kill mobs in an area. Without the use of profiles or anything else at all. You just start run the bot and press start.
      That one is already done - just waiting for a botbase category on the forums.

      Next up we have the HealBot which heals a group of people and follows the leader. Useful for dungeons leves/guildhests and whatnot or Heal-Slaving.
      This is the one i'm working on right now.
       
    15. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,232
      Likes Received:
      364
      Trophy Points:
      83
      Post it in the plugin sections.
       
    16. Twist

      Twist Community Developer

      Joined:
      Oct 15, 2010
      Messages:
      643
      Likes Received:
      31
      Trophy Points:
      28
      There aren't any plugins in the plugins section..
       
    17. Twist

      Twist Community Developer

      Joined:
      Oct 15, 2010
      Messages:
      643
      Likes Received:
      31
      Trophy Points:
      28
      Ok its posted.
       

    Share This Page