Switch comes on without my asking.

The switch isn't supposed to come on until AFTER my player has talked to the character, but as soon as I enter the room the switch turns on and it moves to the second event page (which has custom movement). I've checked and no previous character interactions turn on this particular switch.

This is my first event page:

event1-1.png
What's the problem?
The red text is the switch control.
Do you have a custom script that uses that switch, by chance? Some custom scripts will make use of a switch and will turn it on and off automatically as it's used by the script function.

Also, can you show us screenshots of all 3 pages?
The switch isn't supposed to come on until AFTER my player has talked to the character, but as soon as I enter the room the switch turns on and it moves to the second event page (which has custom movement). I've checked and no previous character interactions turn on this particular switch.
Switches don't operate randomly.
Either it's operated by a script as Lunarea assumes, or it's operated by an even that you forgot to check - or the problem isn't that the switch comes on, but that the conditions on your pages are wrong - that's why we need to see all pages of the event to detect what's happening.
Okay, I'll post the other pages. I don't have any scripting at all.

event2-1.png
event3-1.png
that logic is rather convoluted, especially the erase event.


And because the switches don't change alone (unless you mixed up with savegames, better start new game in that case), there has to be something other that changes the switches.


First, please describe what that event should do - because no matter what, the erase event command is wrong in that combination.


Second, test the same event with different switches (some high numbered switches that aren't used anywhere, like 48 and 49)


Third, for testing place a differen tsprite on each page, so that you can detect which page is active by the sprite displayed.


At the moment you can't even tell if the event vanishes because the third page becomes active, or because the erase event was executed.
For the second page, this is after she says "follow me" so she moves up to the top of some stairs, then my player follows her. Since I can't figure out how to get her to just automatically disappear after moving in that direction, it's set up so that when the player touches her she disappears. (You see her again in the next room).
if you use erase event, the event will only be temporarely erased and back as soon as you enter the map again.


To switch off an event, you usually turn a self-switch ON and condition an empty second page to that self-switch.


Using general switches for this will clutter up your switches when the game gets bigger, because you need a different switch for every such event, even if those events are on different maps.


Put the move route command (as the command, not as autonomous movement like your current second page) on the first page, after the text commands and a control self-switch at the end of the first page after the move command, then delete the current second page and condition the current third page (which will then be the new second page) on the self-switch, not on general switches.


You should never use a general switch to turn off events, unless you want that switch to turn off several events - that might be the cause for your problem - if you used the same general switch on a previous map to turn off an earlier event, you will have turned off this one at the same time, because general switches are identical throughout the entire game.
You're going about it all the wrong way - a way that invites problems.


You only need 2 pages on this event.


Page 1 has her talking, then a Set Move Route to go up the stairs or wherever she needs to go, with a Wait for Completion. Then turn on a switch.


Page 2 has no sprite and is conditioned by that switch.


Or you can use a self switch if nothing else depends on you talking to her.
Thank you! I will try that!

EDIT: The switch still ran. I'll just move it to another switch.
You have a script inside of your project that is using that switch. Either comb through your scripts and see which one is using that specific switch, or, as you've already done, simply change to another switch that isn't being used.
Yes, it's better to find out what's updating it, because the same thing could be happening to other switches (and variables).

When you import a script you MUST check what has to be customized.  This includes switches and variables that the script wants to use.  Then you need to allocate NEW switches and variables, NAME them so you don't accidentally use them for something else, and go in and update the script to use the correct ones.

Go into your script list (F11 from the editor) and do a global search (Control+Shift+F) and search for $game_switches.  Then scroll down to the bottom where you will see the list of custom/imported scripts that use switches.  You need to check ALL of those to see what switches are being used (they will be in "constants" near the top of the script, and there will be comments telling you that it's to determine what switch numbers will be used).

If all of that is too hard, just send me your scripts.rvdata2 file and I'll do it for you.
The thing is, I didn't import or make any scripts at all.

EDIT: Hold it, I figured it out. It's because it's the required switch for my HP HUD that I made.

Thanks for everything, everyone.
It's always a good idea, when you use a switch or variable, to go in and NAME it - even if you don't plan to use it in events. That'll stop you forgetting it's in use and accidentally using it for something else.


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/switch-comes-on-without-my-asking.21889/