How do I make a partner system similar to earthbound/mother
I want the NPC to follow the player I got a system that kinda works but it glitches when I go diagonally and the player stops and freezes for a random??? amount of time then it remembers that it follows the player and moves
My initial though is to put a point on the player somewhere behind or beside him. Use that point for the target. Points rotate with the object, so it would always be in the same orientation. Unless, the object doesn’t rotate then you can position a point on each animation and target it. You could pair it with distance. Only move the npc when it’s a certain distance away.
If you’re r using the Pathfinder it’s possible the target position is in a place that’s unreachable. The entire npc needs to fit that location. You can try to reducing the Pathfinder grid size (maybe 10,10) or make the NPCs hit box a little smaller.
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
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
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
id send my game but there’s kinda unique circumstances so i wont be able to till around 1? tmrw
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.
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
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”
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
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.