Whats wrong with this pathfinding setup?

  • Hi everyone,

    Shouldn't this work?

    It's a simple patrol using pathfinding through a number of waypoints, each point holding a reference to the next one accordingly.

    It seems to break when picking the next waypoint in line, the units get stuck when reaching their first waypoint.

  • Your first "On collision with waypoint" event picks one waypoint. You can't just pick another waypoint in the same event or its sub-events.

    Try adding "System -> Pick All waypoint" before "Waypoint pick instance with UID" sub-event.

    If this doesn't help, then move this sub-event to a function.

    Something like this:

    ... Call Function MoveToWaypoint(Enemy.UID, Enemy.MyNextWaypoint)
    
    On Function MoveToWaypoint
      Enemy pick instance with UID= Function.Param(0)
        Waypoint pick instance with UID = Function.Param(1)
             Enemy Find path to (waypoint.x, waypoint.y)
    [/code:1twtbp6e]
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Huh, that makes a lot of sense! Seems I never fully grasped the picking happening besides the explicit picking nodes, quite a few things click in for me now, thanks dop2000 !

    Side note: it did take the seperate function for it to work

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)