Stop npc from talking

Here's my problem:

I have two guards standing, facing each other in front of a door. When you approach them they will say "sorry you cannot pass" until you talk to the King. He will give you a task at which point the guards back away one square and allow you in.

I made an event and gave it the text "Sorry you cannot pass." and set the trigger to player touch. Then once you talk to the King it turns on the switch that activates the 2nd page of the npc's event that makes them move back and allow you in. 

However, they still say the text from the 1st page. This is very early in my game so I didn't make a key for the first event page. 

I just don't know how to stop them from talking after they already let you pass..

Thanks!
You've set up your event incorrectly. Could be one of several things (if you'd posted screenshots of your event pages, I'd be able to tell you exactly which one, so remember that next time you need event logic assistance - and include the WHOLE event window in the screenshot, because in many cases the issue is NOT in the list of event commands).

- your event's second pages are not conditioned by the switch, or by the wrong switch

- you've used the switch condition in event commands and not as page conditions

- your event's pages are in the wrong order - the default one where they stop you should be page 1, the one conditioned by the switch where they let you enter should be page 2

- something else is turning the switch off again after you talk to the king

Could be other reasons too, but these are the more likely ones.
I just went ahead and deleted what I had. I probably did something wrong anyways. Here's what I have now:

ss.png
include the WHOLE event window in the screenshot, because in many cases the issue is NOT in the list of event commands).
What you have there tells me nothing. There's not even a switch being turned on. I'm assuming that's the "talk to the king" event, but I'm only guessing at that.
Nevermind. Can you delete this thread?
If you need help, please post the full event window. Giving up because you've been asked for more info is not going to help you learn or progress with your game 🙂
Here they are:

ss.png

ss2.png

ss3.png

ss4.png
They're saying the text from the first page because you turned the switch off again as part of the autorun event.


What's meant to happen AFTER they let you pass? Do you go through to another map? Can you come back again? Are they meant to be standing in the original positions, or where they've moved to? Are they meant to be in the original positions and move out of the way EVERY time you enter the room?


There are several ways to fix the issue, and which one is best depends on how you want them to behave AFTER moving out of your way.
I want them to stand still and not talk for the rest of the game.  I'll upload a screenshot of what I mean.

EDIT: I want their positions to remain the same after they move. I do have plans for the player to be able to come back and talk to the King again. I just don't want them to say "You cannot pass" after moving.

ss5.png
So they're in the same room as the king, but you've got them set to automatically move as soon as the king asks you to go and check on them? (Or is it someone else you're checking on?) Do you want them ALL to step back at the same time?

Easiest way is to have 2 events for each guard. If they step away as soon as the king tells you to go check, remove the autorun events from the guards, and put the following on the king event:

Set Move Route: Guard 1 (don't check the Wait for completion box) Through ON Move up Turn RightSet Move Route: Guard 2 (don't check the wait box) Through ON Move down Turn RightSet Move Route: Guard 3 (don't check the wait box) Through ON Move Up Turn LeftSet Move Route: Guard 4 (check the wait box this time) Through ON Move Down Turn LeftControl Switches [??? Guards Moved] = ONOn each guard, add a second event page controlled by the [??? Guards Moved] switch. Leave EVERYTHING else as default - blank sprite, action button, below characters priority, no commands.Then create a NEW event for each guard, in their final position and facing out away from the walls. This just has one page per event, and that page is conditioned by the [??? Guards Moved] switch.

So what will happen is that you'll talk to the king, the guards (original events) will step back from the door and turn so their backs are against the wall. Then the switch will be turned on and the original guards will be replaced with the "in-position" guards. When you leave the room and come back, because that switch is on, the "new" guards will be visible, but the "original" ones won't.
The person you check on is not in the room. Also, which guards are which? I only want 2 guards to move in this event, the 2 on the right.
I'll try and break it down even more. This is the very beginning of the game. At this point no switches are ON. You enter the room and talk to the king (approach and use spacebar to begin dialog) after a few pages of text the switch dc_king1 (dreamcastle kingsquest1) is set to ON. If a play tried to approach the right doorway prior to speaking with the King, he would be sent away. But after being told to check on some guards in the dungeon, the guards back up and let him through. I'll include another screenshot and show you what I did. Now after I talk to the king I can't move and I don't think the guards are moving either.

I labeled the guards now. 1 is on the top and 2 is the bottom (right side of the map).

guard1.png

guard2.png
Okay, I just noticed I didn't set guard2 on the second move route. Fixed

But instead of standing still they now move up, turn left, move up, turn left, and keep repeating until they reach a wall.

Once they reach they freeze and I can't walk.

Here's an updated screenshot:

ss1.png
Dark_The_Hero, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

You've still got the processing on your guard events, and they're still set to autorun, and you're still turning off the switch again at the end.

If you don't want all 4 to move, just move the 2 that you want to move.  But do it like I said above - on the king event, no autorun, don't turn that switch off - use the switches I said.
Here's the problem now:

The guards return to their original position if the game is saved and loaded. They will also return if you leave the map and come back. I need them to leave the doorway and stay put.

They do walk away from the door as soon as the quest starts which is perfect, they just won't stay there.

ss1.png

ss2.png

ss3.png
restoring events to the original position on reloading a map is the default behavior.


Howwever, in the last version of your events you can easily prevent that with a script.


Install


http://forums.rpgmakerweb.com/index.php?/topic/1853-remember-event-position/


and then in the two guard move routes on the king's event, add a script command save_pos() as the last command of the moveroutes, after you added that linked script.
Thanks Andar 😀
You didn't create multiple events for each guard and condition the pages by switches the way I explained.


I did consider giving you a link to that script, but scripting is an advanced topic, and using switches with events is a basic topic. I was very hesitant to send you down the scripting path, because you're having so much trouble with simple events, and there were OTHER issues with your events than just getting the guard to stay there.


Anyway, let us know if you manage to get it working.
Yes I got it working, I'm up to about 10 minutes of event-filled gameplay now.

Thank you Shaz for this genius script.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/stop-npc-from-talking.24380/