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,959
Reaction score
1,405
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
117
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
117
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
117
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,959
Reaction score
1,405
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

Enter the password in letters. (English subtitles)
I really tried to pull off something for halloween, but I don't feel like going on. I feel like the plot I was building was too generic, and I couldn't connect to it as I do with other projects. On the bright side, I've been working on my cosmic-puzzle project, so far I think the core mechanics are working properly, so I'll be creating some large test maps to see how it works out.
People2_5 & SF_Monster1 added!

Ami
--- X Costume ---

M.Healer: I'm wearing M.Mage's Costume.
M.Mage: I'm wearing M.Healer's Costume.
M.Knight: Why not using the Scary Costume like me,The Scary Frankenstein?
M.Healer: Err…Because we have low of Budget.
M.Mage: Yeah,right.
MV Plugin Showcase: Opening the in-game menu without pausing the background. :LZSgrin:

Forum statistics

Threads
104,602
Messages
1,007,481
Members
136,084
Latest member
TikeTenGamesOffical
Top