How do I make players able to talk to 3 NPCs that are walking together?

Hi everybody
I'd like to ask
How can players talk to 3 NPCs that are walking together? Because when I talk to one of them, the other two will leave, I want them to stay together.
You could make the action trigger on all three of them freeze the movement of the other two either by direct reference of their event id or by distance, i.e. freezing any event in a 3 square radius. You would either declare an empty move route command on those events or a wait command.
Below is an incredibly helpful script that I learned a while ago and I use it in a lot of my tutorials. It allows you to turn a self-switch on or off from anywhere. So you can use this in one event to turn self-switches on or off in other events. Even on different maps. This is VERY useful.

As @AquaEcho was saying, when you engage with any of the 3 Events, that Event could immediately use self-switches to change the page of the other events (set to parallel) that stops their movement. When you exit the Event you engaged with, you can turn off those self-switches to change the page of the other events back to normal.

And all 3 Events can be set up so you are "talking" with all 3 NPCs via the Show Text dialog.

$gameSelfSwitches.setValue([47, 1, ‘A’], true);

47 = Map ID

1 = Event Number on the Map

A = Which Self Switch

True = On

False = Off

Scripts are case sensitive.

I hope this helps.
Hi, thanks for helping

I've tried using the switch to get all three to stop together when I talk to one, but when I turn off the switch to go back to the original custom movement, they get messed up. I set the initial custom movement so that they arrive at a destination.

The picture is like this:
Players are freely moving in a map, at that time there will be 3 NPCs that will pass the player to a destination. I want players to be able to talk to them, without messing up their path.

Maybe I still don't really understand, can you help in more detail? :blush:
Sorry, my mistake. I didn't realize that you wanted the Events/NPCs to be walking to a specific destination. That makes a difference.

I will have to think about that since I have never tried what you are asking about.

In the meantime, maybe someone else will have a simple answer right off the bat.
Yes, I think I have to use a script like pathfinder or move route extra script, so that the 3 NPCs keep going until the destination coordinates.
If they are walking together, couldn't you just make them into one big sprite?
Here's how you do it. In the example the map is 3 and the events are 4, 5, and 6. They're pathing to 1,2. Just change those numbers on all 3 events.

Script calls to copy/paste:
this.moveStraight(this.findDirectionTo(1, 2));
$gameSelfSwitches.setValue([3, 4, 'A'], true);
!($gameMessage.isBusy())
Here's how you do it. In the example the map is 3 and the events are 4, 5, and 6. They're pathing to 1,2. Just change those numbers on all 3 events.

Script calls to copy/paste:
this.moveStraight(this.findDirectionTo(1, 2));
$gameSelfSwitches.setValue([3, 4, 'A'], true);
!($gameMessage.isBusy())
Awesome, thanks for your help 👍👍
But it still seems a little messy,
I want them to stick to each other.
They'll split up if I get in the way of one of them.
I'll show you the video, so these guys are lifting an injured person (Sorry I didn't explain in more detail before)

Spoiler: Video


If they are walking together, couldn't you just make them into one big sprite?

Yes, I think this might be the best option
Awesome, thanks for your help 👍👍
But it still seems a little messy,
I want them to stick to each other.
They'll split up if I get in the way of one of them.
Then you'll have to do something like have one guy be the leader that checks once every x frames that the other two are within y tiles distance. If not, wait z frames. The leader paths to the destination, the other two path to the leader.
Oh, I'll give it a try. I'll come back again for the results. Thanks again 🙂
Your video didn't seem to be available. Just an FYI.

Reading back through your posts to try to get a clearer picture of what you are trying to do, I have a couple questions.

How important is it that the player chooses to talk to these 3 NPCs? Are you expecting most players to talk to them? Is the player told or is it inferred that the player should talk to them? What happens if the player chooses NOT to talk to them?

The reason I am asking is that @AquaEcho is trying to help you implement this, but it could get increasing complex the more details you add. Like they are going to a specific destination and they are carrying someone.

Sometimes we forget to try more simpler solutions.

You responded to @pawsplay that creating one big sprite might be the best option and I agree that might be something worth trying.

Another option would be to make this a Cut Scene.

If you expect the player to interact with this/these Event(s) as part of the story, then maybe it shouldn't be optional and left up to the player when/where they try to talk to the NPCs. Maybe it would be better to just do a quick Cut Scene where you control the movement of the NPCs and the player for a very brief time.

But not knowing all the details of what you really want, maybe a Cut Scene isn't practical. Personally, I don't really like Cut Scenes, but this seems like a scenario when it might be useful.

Just a thought.
Your video didn't seem to be available. Just an FYI.

Reading back through your posts to try to get a clearer picture of what you are trying to do, I have a couple questions.

How important is it that the player chooses to talk to these 3 NPCs? Are you expecting most players to talk to them? Is the player told or is it inferred that the player should talk to them? What happens if the player chooses NOT to talk to them?

The reason I am asking is that @AquaEcho is trying to help you implement this, but it could get increasing complex the more details you add. Like they are going to a specific destination and they are carrying someone.

Sometimes we forget to try more simpler solutions.

You responded to @pawsplay that creating one big sprite might be the best option and I agree that might be something worth trying.

Another option would be to make this a Cut Scene.

If you expect the player to interact with this/these Event(s) as part of the story, then maybe it shouldn't be optional and left up to the player when/where they try to talk to the NPCs. Maybe it would be better to just do a quick Cut Scene where you control the movement of the NPCs and the player for a very brief time.

But not knowing all the details of what you really want, maybe a Cut Scene isn't practical. Personally, I don't really like Cut Scenes, but this seems like a scenario when it might be useful.

Just a thought.
Not important, just optional
I think it will look more natural than me making conversation cutscenes; there are already too many cutscenes compared to the player's freedom to explore.
And I still haven't been able to implement it until now. :hswt:
Not important, just optional
I think it will look more natural than me making conversation cutscenes; there are already too many cutscenes compared to the player's freedom to explore.
And I still haven't been able to implement it until now. :hswt:
You need to describe exactly what you want the movement behavior of all three to look like. Do you want all three to stop where they are if one of them can't move (because you're standing in the way of one of them, for example)?
You need to describe exactly what you want the movement behavior of all three to look like. Do you want all three to stop where they are if one of them can't move (because you're standing in the way of one of them, for example)?
Yeah, like that 😀
Then you would have to modify the event pages I posted above to make them all parallel and add an additional check to see if !(this.character(0).isMoving)

Put a wait 10 frames at the end. Basically every 10 frames, each event checks if itself is not moving, turn on the self switches of the other two

Edit: Actually only one of them needs to be parallel checking all three

(!this.character(0).isMoving || !this.character(eventId2).isMoving || !this.character(eventId3).isMoving)
Then you would have to modify the event pages I posted above to make them all parallel and add an additional check to see if !(this.character(0).isMoving)

Put a wait 10 frames at the end. Basically every 10 frames, each event checks if itself is not moving, turn on the self switches of the other two

Edit: Actually only one of them needs to be parallel checking all three

(!this.character(0).isMoving || !this.character(eventId2).isMoving || !this.character(eventId3).isMoving)
hello, thank you for your help.
After I studied what you provided, I was lucky enough to find a simpler method that doesn't need to use parallel events to check.
Here's the video and screenshots.

Spoiler: Video



1688446781313.png

1688447120879.png


So, for the movement of the injured villager and the soldier behind him, I made the injured villager follow the first soldier (leader) and the second soldier behind him follow the injured villager.

this.moveStraight(this.findDirectionTo($gameMap.event(1).x, $gameMap.event(1).y));
hello, thank you for your help.
After I studied what you provided, I was lucky enough to find a simpler method
This is basically the same as the first solution I said? The parallel would only be needed if you needed to check if any event has stopped moving for any reason, like the player or other event getting in its path. If you only need to stop events if you talk to one, you don't need a parallel because it is triggered by you pressing the action button.
Oh yeah I forgot about that lol
I also tried that if they walk straight, the player can't even interrupt their own path.
I'll try if they walk in turns.

EDIT :
They remained uninterrupted when I tried to block the path between them even though they were walking randomly and swerving. 🙂)

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-make-players-able-to-talk-to-3-npcs-that-are-walking-together.158428/