Page 1 of 1

Using jumper while moving

Posted: Sun Jul 10, 2016 10:45 pm
by rdaleg3
Hi all, I know this can be avoided by storing a start and end position in some way or another but I can't for the life of me figure it out, so here it goes.
I am trying to use jumper to have an enemy or NPC travel towards the player. However if the player moves, which the player is almost always free to do, the path would recalculate from the position of the enemy and the player. Because the path is constantly recalculating If there is anything between the enemy and the player it stops working correctly.

tl;dr how do I use jumper if my start and end positions are always changing

Thanks a ton
The idiot who can't figure this out.

Re: Using jumper while moving

Posted: Mon Jul 11, 2016 3:06 am
by airstruck
Haven't used Jumper, but if the path is often blocked for just a short time, couldn't you store the last good path and keep using it if no new path is found, and only update it when a new path is found? In other words, recalculate the path whenever you need to, but store the result in a temporary local variable first, and don't update the path your guy is following with that value unless it's valid. Clear the path out when he hits an obstruction and until then let him follow it. Maybe if an old path gets too stale, clear it and let the guy wander around or whatever he normally does when he has no path to follow.

If that's not useful, it might help to post some code ;)