NPC follow Player Earthbound Style "i will make a video demonstatration bfr next year"

Thank You “sorry if its a bit rambly im trying to do something”
I tried your grid size and it worked a little better I have done most of what you said already I am only having problems with diagonal movement

The diagonal movement Just decides not to work I’ve done a bit of playing around and with the grid size it works better but still after about 10+ seconds it breaks and decides not to follow in the picture he just isnt following anymore after like 5 to 20 secs he follows again randomly idk why it breaks or why he remebers to follow
Screenshot 2023-11-09 7.31.17 AM

Can you post a screenshot of your relevant events?


I also have a run button that changes speeds I think speed might be the problem I will check when I’m free “sorry cant rn”

if you have any more questions I will try to answer as fast as I can


Was thinking of making a speed system based on distance or animation I’m not sure if this would work but figured I’d try it
Although I can’t try this for a few more hours I’m not not definitely sure if I’ll be busy or

Im using The idle animations rn because im lazy but when this is figured out ill change it :stuck_out_tongue:

What type of game is this? Are there a lot of tight places or obstacles?

The first 3 events all seem to be doing the same movement. IDK if it was part of the debugging process but the first 2 are opposites, so it’s trying to move either way.

You could try replacing the first 3 events with one move action and either no condition or a timer condition. There’s probably no need to try to move 60 times per second. It uses a lot of resources.

The Pathfinder has a path found condition. You can invert it so it becomes a not found. That way if the target position isn’t reachable due to an obstacle then maybe you can try to move it to another point. You can put it as a sub event of the move action so it only runs after the move attempt.

You could actually use several **no path ** events for several backup locations. The Pathfinder would return to the first position once it’s reachable.

You can use the **path found ** condition to debug it. I like to do things like using a sound to help let me know if an action is at least being triggered. You can either have it beep when there’s a path or inverted so it beeps when there’s not a path.

That would narrow down the issue. I like using the sound because no matter what the condition, it tells you if an action is ateast being triggered.

Rn I’m just trying to clone Earthbound just so I have a template for a RPG
Yeah it was part of debugging I was just throwing stuff at the wall to see if it would work

nothing is really working correctly rn L

idrk what im doin wrong

it works but as soon as i go diagonally it breaks
if i go up and hit left a bunch it still breaks

I tried the timer thing and I dont think I did it correctly
I also tried the other paths and it helps I think but not really

ty anyways if u could make an example or tell me other things that might work thatd be cool :slight_smile:

id send my game but there’s kinda unique circumstances so i wont be able to till around 1? tmrw

I’ll see if I can throw something together.

Feel free to browse my github projects. They’re not really organized but the title should explain what it is.

(click the green [code] button and download the zip, open the json file with gdevelop)

I’ve also commented on a lot of threads some with projects. The playable link might not work anymore but the github should.

https://forum.gdevelop.io/search?context=topic&context_id=51699&q=Pathfinder&skip_context=true

IDK if you made any progress. Have a look at my examples. I’ll try to make a quick example tomorrow if you still need help and I have the free time. Be well.

hello :slight_smile:

I can only see ur msgs from 7:25 to around 2:20 on most days

weekends I usually can’t, sorry abt this

Im gonna check out ur projects :stuck_out_tongue:

sorry for not replying sooner

Thank you fr the help also

1 Like

I don’t know if this solves your issue but it should help you understand how the pathfinder works.
The path uses a grid. It then calculates a path using the grid.

Try it, it uses the arrow keys or drag player, show or hide grid, draw path

project (click the green [code] button, [download zip], extract on open json file with Gdevelop

1 Like

Thank you sm

this might work

Do you think you could make the camera follow the arrow guy cuz i wanna see if u have the same glitch or not

thank you again

sorry I can’t reply often btw

What are you using for the camera? Where you put the camera also matters. I believe you want it near the end otherwise it’s a frame behind.

I dont really understand camera stuff

I just want to see if u have the same diagonal glitch

im just trying to make smtn like this

thank you again :slight_smile:

3786a8f6c5d410e32241349d75d2006e
camera follows this guy
the other guy follows a point on him same with the line
Screenshot 2023-11-13 7.39.19 AM

gd.games game build I think this is how I share games? z is the run and select button also my glitch is when u go diagonally

Thank you again :slight_smile:

It seems like “record player position in the childs of an array every frame and change the npc position to the children of that array with certin delay after the player starts moving”

hello Im gonna try to use your thing to see if it works

I added a camera and you do not have the diagonal glitch :smiley:
you do have a bouncing thing but its fine because I think ik how to fix?

Anyways tysm I will send when done :slight_smile:

might take awhile cuz my schedule sucks

thanks youuuuu

1 Like

I wish you well. It’s was erratic but that was just trial and error and a possible solution.

Tried to make another thread guess it was to similar? anyways thats why its worded weird?

Does anybody understand arrays please help thank you

simple drawing ig idk if this helps
Players XY and Animation direction are stored
Partner would follow lets say the 50th stored point
I need To delete data though so it doesnt like overflow??? and the point for the partner changes
idk i dont have experience with arrays


I know how to store it

How do i access this like lets say i wanted to access like number 10 to make a character go there


This is for a partner system like earthbound I watched Totorials for other game engines and im trying to recreate it in GD

This uses a structure. It also checks the last player location so it’s not placing too many points. I had it add a breadcrumb object for visuals. They serve no purpose. The problem is it follows the array whether it’s the shortest route to the player. I liked the challenge and you can learn from this but I don’t know if this is the best approach. It’s a simple concept, add to the end, take the first (or 0 since arrays start at 0) and remove the child. You might be able to rework the concept or maybe your concept was different than mine. I guess if you increase the follower’s speed and maybe the spacing. IDK.

Speed is 0 is probably a bad trigger. Maybe distance or something. IDK. My test is too jerky. Starting and stopping.

try me: The player uses the cursor keys with top-down movement, the follower uses the pathfinder.

source (click the green [code] button and download the zip

There’s only 1 scene structure variable and the rest are player variables.

player variables

events

Hello, Frgot to reply I have figured it out thanks for the help with arrays as soon as I figured it out i saw ur msg? reply?

Anyways I was thinking of making a video explaining how to make this Idk yet but ye


I hope this Helps if anyone wants to do smtn like this in the future :stuck_out_tongue:

The sub conditions Are for PlayerAnim If hes going a direction the number changes for Idles

I Want to make a video But ive never made a tutorial type of video so i might not

2 Likes

Okay I probably will not make a video
BUT…
I used this video to Understand the system
I hope this helps somewhat