How to apply a switch to one event that turns on after talking to all NPCs

Yuan

Villager
Member
Joined
Apr 6, 2019
Messages
10
Reaction score
1
First Language
English
Primarily Uses
RMXP
Hello,

I know this problem is probably a problem to many of you but I'm a beginner.

I have several NPCs on my map who all will say something when the main character talks to them. How do I apply the single switch on one event that will activate once the character finishes talking to all NPCs? There are only two spaces for switches on every single event but I have more than 2 NPCs.

Thanks in advance.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
add a counter at the end of the dialogue of each NPC, tally up the total, and check for it at the final NPC.
make sure the dialogue of each individual NPC doesn't trigger again once the player has talked to them once, or you'll trigger the sum twice, and that'll change the total.
you can use self-switches on each speaking NPC, so that when the dialogue finishes the NPC passes to an alternate state where it doesn't have dialogue, or just dismisses the player.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Use a variable. Do something like this on each event you have to talk to:

Code:
Conditional Branch: If Self Switch A is OFF
  Control Variables: NPC Talked To += 1
  Control Self Switches: A = ON
End
Text: blah blah blah
On the event that you need to activate, use the variable in the page conditions (not a conditional branch).

Each time you talk to an NPC, the variable will increase by one. If you talk to the same NPC again, it won't increase the variable a second time, so you can talk to them as many times as you want, and it will only register the first time.

Once you've spoken to everyone, the other event will activate.

(edit: seconds too slow!)
 

Yuan

Villager
Member
Joined
Apr 6, 2019
Messages
10
Reaction score
1
First Language
English
Primarily Uses
RMXP
@Shaz So for the NPC events, the variables will be written in conditional branch while the final event that activates after talking to all NPCs is to have its variable set in the conditional page?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
In the NPC events, just put the commands I've written, using the appropriate text and variable number (same variable for all events).

In the final event that activates, use that variable with the total number it needs to reach on the page conditions. The box above the event sprite.
 

Yuan

Villager
Member
Joined
Apr 6, 2019
Messages
10
Reaction score
1
First Language
English
Primarily Uses
RMXP
@Shaz Thanks for your help. But I have one other problem. When the final event is set to autorun, it activates when the variable reaches the desired number.

upload_2019-5-28_22-44-11.png

But it didn't work for this event that has the trigger set to Player Touch. Everything else is set as you said.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
When the event is set to autorun, as long as the conditions are met it will activate, no matter where the player is. If it is set to Player Touch, you have to actually walk on it.

Are you saying you've spoken with the 15 NPCs then walked onto this, and nothing happens?

The fact that it works when set to autorun indicates the page conditions are working properly. If it doesn't work when you set it to Player Touch means either you didn't talk to all 15 NPCs, or there's an issue with the Player Touch trigger. Play again and make sure you speak with EVERY one (you could temporarily move them so they're all in a line so you don't miss anyone or double up). If it still doesn't work, change the trigger to Event Touch and try again (it shouldn't make a difference, but it might). Then if it still doesn't work, try the below ...

Please copy and paste that event page, then go back to page 1 and remove the variable condition and the transfer player. Instead, put Show Text \V[2]. (does XP let you do that? You want it to display a text box with the value of variable 2).

Then go talk to all your events and walk onto this one. If you've talked to them all and they've all incremented the variable, the second event page SHOULD be active, and you'll transfer. If you haven't talked to them all or something is wrong with one/more of the events (don't increment the variable properly), the first page will be active and it'll tell you how many it thinks you've talked to. If that happens, go recheck all of your events to make sure there's nothing weird in the way they change the variable (you don't have some weird conditions on one or two that cause them not to increment sometimes).

Also make sure you don't have any scripts that use variable 2. And that you do actually have a Map 3 that is at least 11x10 tiles in size.
 

Yuan

Villager
Member
Joined
Apr 6, 2019
Messages
10
Reaction score
1
First Language
English
Primarily Uses
RMXP
Wow. It worked. I used the wrong variable name. Such a stupid mistake. But I've learnt something new too. :LZScheeze:

Thanks for your help, @Shaz. You've been a big help.
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top