New account registration is temporarily disabled.

[RMXP] HOW DO I CHANGE EVENT PAGES WITHOUT USING SELF SWITCHES?

Posts

Pages: 1
The reason I ask is because I want to make an NPC that can say up to 20 random things, but, once the first thing is said, it's the only thing they say. I can't use Self Switches for this, because there are only 4 different kinds: A, B, C, and D.

I assume I'll have to use Variables. So, what I have so far is a Control Variable that generates a number between 1 and 20. In the same event, I also have 20 different Event Pages with a unique message written in each.

Once the Variable generates its number, how to I tell it to jump to a different Event Page?

Or, alternatively, is there an easier method to this that doesn't require quite so many Event Pages?

Thanks in advance!!
Instead of pages, use conditional branches, each set to a different variable number, all on the one page. So, for example:

If Variable = 1
insert message
END
If Variable = 2
insert message
END
...
and so on.

At the start just add the Control variable that changes the number randomly. Voila~

What this does is randomly generate the number, then checks each branch until it finds the number that was generated. It then runs whatever is in the branch and then ends.
Next time you interact with the event it generates another number and does the check again, this time doing what is assigned in the branch of that number.
@Liberty:
But therein lies the problem. I would like the NPC to say the say the same thing each time they are interacted with, not something new each time!

I need some way to avoid generating a new number each time the NPC is spoken to.

At any rate, would you happen to know how to switch between Event Pages?
Then what's your question? Because from the sound of it you want them to randomise what they say each time. Otherwise, why bother with pages and randomising variables?

Please explain better?

Ah, I got ya. Easy stuff.
Randomise the variable, turn on a switch, then have the conditional branches as I pointed out before, but on the next page.

So...
Page 1
Variable randomised.
Self Switch A (turns on Page 2)

Page 2
Conditional Branches with all things that can be said.


What this will do is make the variable randomise then turn on the switch.
It will then run that page, find the respective Branch corresponding to that number and refer to it.
The next time you talk to the person, that variable will never change - it will just refer you back to page 2 since the switch is on, thus skipping the variable randomisation.

Sorry about the confusion! I really should have given an example of what I'm going for.

I'm making a sign that that has the possibility of saying up to 20 different messages, but, once the variable decides what it will say the first time, that's the only thing it will ever say. If that... makes sense.

I'll go give your suggestion a try!

EDIT: Awesome! Everything went off without a hitch! Thanks a ton!!
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
As a note, all variables start at 0 at the beginning of the game. So another way to do this would be to check if the variable is 0, and if so, set it to a random number between 1 and 20. If you're making a lot of NPCs like this, this method would probably actually be simpler, since it would only need one page and wouldn't require a self-switch.
Hey, that's actually pretty clever! Thanks!
Pages: 1