• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • movement from navigation within a coroutine task

    Discussion in 'Community Developer Forum' started by iyake, Apr 20, 2015.

    1. iyake

      iyake Member

      Joined:
      Oct 19, 2014
      Messages:
      143
      Likes Received:
      5
      Trophy Points:
      18
      I'm using:

      Code:
                  while (await CommonTasks.ExecuteCoroutine(CommonBehaviors.MoveAndStop(ret => Location, 5f, true, null, RunStatus.Failure))) {
                      await (Coroutine.Sleep(100));
                  }
      
      and it more or less works but it feels clunky and I'm a bit worried about the 100 ms sleep hitting the nav server too often.

      Is there a better way?
       
    2. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      383
      Trophy Points:
      83
      You wanna call that as often as possible. Nav requests are only sent out when the path target changes otherwise its in control of rotating your character and making sure your moving onto the next spot.

      I'm not even sure that needs to be in a while loop.
       
    3. iyake

      iyake Member

      Joined:
      Oct 19, 2014
      Messages:
      143
      Likes Received:
      5
      Trophy Points:
      18
      I tried it without the sleep and it locked up my ffxiv client.

      I tried it with a longer delay and it caused pathing issues. I've settled on 50 after what you said and it's working fine now.

      Also, wrapping a the moveandstop behavior into a task with executecoroutine and then wrapping that into a behavior with a runactioncoroutine so we can insert that behavior into the tree is correct? It feels like too many layers of abstraction to me, and I'm a java developer.
       
    4. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      383
      Trophy Points:
      83
      Use a yield not a sleep then.
       

    Share This Page