RMMV Self Switch?

Alador

The Mage of Mythix
Veteran
Joined
Apr 16, 2020
Messages
140
Reaction score
90
First Language
English
Primarily Uses
RMMV
Hey guys, you've all been extremely helpful to me in the past, so I was hoping you could help me with this as well. I was wondering if there is a specific way to trigger a self switch in MV using scripts. Now, before you tell me that this can be achieved from a reference in the Big Spreadsheet of MV Scripting Knowledge (If that's not what it's called, it should be what it's called!) I know that it is in the spreadsheet, and I tried that. It did not work. Maybe my problem is that I am trying to initiate a self switch from another self switch-triggered event, without first turning the self switch off so that the self switch triggered event will stop. I don't really, know, like, does the second self switch-triggered event have to be on autorun or something? Anyways, I hope you can help! Thank you in advance!
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,938
Reaction score
1,386
First Language
EN
Primarily Uses
RMMZ
With event commands, an event can only ever toggle its own self-switches.

Note that only map events have self-switches; troop events and common events do not. (Common events called via the Common Event command are inserted into the current event, so follow that event's self-switch rules.)

For reference, here's a couple of examples of correct script calls:
  • $gameSelfSwitches.setValue([1, 2, 'A'], true);
    This says "set the value of map 1, event 2, self-switch A equal to true", i.e. turn it on.
  • $gameSelfSwitches.setValue([4, 10, 'C'], false);
    This says "turn off self-switch C of event 10 on map 4".
Change the values as needed. Note that the self-switch letter (A, B, etc) must be enclosed in 'single' or "double" quotes. Also the [square] and (round) brackets are necessary, and code is case-sensitive.
 

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
114
Reaction score
65
First Language
French
Primarily Uses
RMMV
(tip for your next request for help, don't be afraid of the Enter key)

Whatever happens with your self-switches, the event that's doing its commands will do them until it reaches the bottom of the page. Changing self-switches mid-event so that the current page's self-switch condition is now invalid will not interrupt the commands in its page.

Make sure that's not what you're trying to do, then refer closely to the Holy Script Call Spreadsheet.
 

Alador

The Mage of Mythix
Veteran
Joined
Apr 16, 2020
Messages
140
Reaction score
90
First Language
English
Primarily Uses
RMMV
With event commands, an event can only ever toggle its own self-switches.

Note that only map events have self-switches; troop events and common events do not. (Common events called via the Common Event command are inserted into the current event, so follow that event's self-switch rules.)

For reference, here's a couple of examples of correct script calls:
  • $gameSelfSwitches.setValue([1, 2, 'A'], true);
    This says "set the value of map 1, event 2, self-switch A equal to true", i.e. turn it on.
  • $gameSelfSwitches.setValue([4, 10, 'C'], false);
    This says "turn off self-switch C of event 10 on map 4".
Change the values as needed. Note that the self-switch letter (A, B, etc) must be enclosed in 'single' or "double" quotes. Also the [square] and (round) brackets are necessary, and code is case-sensitive.
@caethyril, I am using a map event to change the self switch of the aforementioned map event, so we're all good there! I will try using your scripts and get back to you on if they work for me or not.
(tip for your next request for help, don't be afraid of the Enter key)

Whatever happens with your self-switches, the event that's doing its commands will do them until it reaches the bottom of the page. Changing self-switches mid-event so that the current page's self-switch condition is now invalid will not interrupt the commands in its page.

Make sure that's not what you're trying to do, then refer closely to the Holy Script Call Spreadsheet.
@CHKNRAVE, I will remember the enter key next time! Do not worry, all of the self switch commands happen at the bottom of the page.
 

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
114
Reaction score
65
First Language
French
Primarily Uses
RMMV
Your initial message made me think you have an autorun event that keeps replaying. Is that not the case?

That'd mean it's still the last page in its event to have a valid condition.
 

Alador

The Mage of Mythix
Veteran
Joined
Apr 16, 2020
Messages
140
Reaction score
90
First Language
English
Primarily Uses
RMMV
Your initial message made me think you have an autorun event that keeps replaying. Is that not the case?

That'd mean it's still the last page in its event to have a valid condition.
No, the first page is autorun, which changes the self switch on, therefore activating the problematic event page in question.
 

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
114
Reaction score
65
First Language
French
Primarily Uses
RMMV
And that problematic event page, what's the problem with it exactly?
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,938
Reaction score
1,386
First Language
EN
Primarily Uses
RMMZ
If you happen to have trouble getting it to work following the script call examples I cited, maybe post some screenshots of the troublesome events. :)

Changing self-switches mid-event so that the current page's self-switch condition is now invalid will not interrupt the commands in its page.
Just to note: this is true unless the event page trigger is set to Parallel (not sure if that's the case here). Parallel events run on an interpreter attached to the event: when they switch page that interpreter is deleted. :kaoswt2:
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Yesterday I made my first step towards eating more healthily.
I saw candy on discount and did not buy it.
"They yearn for what they fear for."
I always told my DA fans how much I hate slot machines. They're fine in games as a risk-and-reward system. But when you're spending REAL MONEY in a Vegas casino to try and hit the jackpot (which very, very few people will), it can really hurt your budget. Gambling is a bad habit, and I don't like wasting my money on a slim chance. Go to Vegas for the experience, not the jackpot.
Took the kids to a corn maze. They gave us a map and had lights at certain points in the maze. Not overwhelming... or underwhelming... just... whelming.
Okay, vacuuming fruit flies out of the air is surprisingly effective.

Forum statistics

Threads
104,396
Messages
1,006,082
Members
135,927
Latest member
mich
Top