So, In my game, I made an npc named “bobby”. You talk to them, and a dialoge box pops up. All that works perfectly.
But when I try to get the npc to move somewhere, I doesen’t work.
I have npc events in my “overworld logic” external events. these deal with NPCs as a group.
And then I have events in the scene that are supposed to have specific npcs say a certain branch depending on who you’re talking to. I’m also trying to set up Bobby to walk towards an object when the <> comand is called.
Here are my external events (updated):
And these are my scene events specifically for bobby:
Bobby uses the “move toward an object” action for movement. But he doesn’t move.
How do I fix this?
Because I don’t know to much about Gdevelop probably I can’t completely solve your problem, but I think I can give to you good tips by analyzing your code.
You are using “Repeat for each instance of…” with the “Trigger Once” condition on your events (in fact, you’re using the trigger once in pretty much everything, including events you don’t need). So when you do this the event will occur only once in a single instance, because after that, the condition will be true and as the condition said: it can happen only once. Does not work for each instance once. It’s work only once and never again as long as it’s true. So, you need “limit” your conditions of “repeat for each instance of…” to happen just once with another condition (don’t use trigger once for this). Lets take some examples of your code that you can change:
Here after the change it will happen just one time for each instance because in the action you change your variable talkable of NPC to 1 making the condition false.
Here you can do the same thing, but using your variables “move” and “moved” and deleting the “Trigger once”.
And now talking about just “Trigger once” without “Repeat for each instance” here is a example of condition that you don’t need it:
You don’t need because the layer need be visible to be true. And when it happens and all the conditions are true in the action you change it for “hide” making it false for the second time.
As I said I do not know if only these changes will be enough to make the NPC move, but I believe that if it is not, it will still help you in the project.
It didn’t help with movement, but it’s great tips! I changed it to have it be like what you said.
I see you uploaded the images of your code with my tips. But it still have an event with Trigger once in “Repeat for each instance”. You don’t need trigger once here anymore:
Oh, thanks. I didn’t notice that. I just fixed it.
but how do I fix the movement?
Ya know, I’m REALLY starting to feel invisible. I just want help on fixing the movement…
I finally fixed it. I figured it out on my own. Thanks for the tips, they were really helpful!