Turn off all Self Switch 'A's

Warped_Tales

Veteran
Veteran
Joined
Sep 17, 2016
Messages
47
Reaction score
64
First Language
English
Primarily Uses
N/A
Does anyone know of a simple way of resetting all self switches, but only relating one letter (self switch A for example), in an entire project?

Ideally a simple script would be great but I'm happy to use a plugin if anyone knows of one.

Thanks in advance!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,969
Reaction score
7,471
First Language
German
Primarily Uses
RMMV
This has been asked before, and received a script sequence as answer - but I don't have it ready, so please search the forum - I know I read it just a few days ago in another topic.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,948
First Language
English
Primarily Uses
RMMV
Edit: Forgot the specific letter part, one sec.

Okay, so say you wanted to turn off all A self switches:

Code:
var keys = Object.keys($gameSelfSwitches._data);
var matchingKeys = keys.filter(function(key) { return key.split(",")[2] === "A"; });
for (var i = 0; i < matchingKeys.length; i++) {
  $gameSelfSwitches.setValue(keys[i], false);
}
 
Last edited:

Warped_Tales

Veteran
Veteran
Joined
Sep 17, 2016
Messages
47
Reaction score
64
First Language
English
Primarily Uses
N/A
Code:
var keys = Object.keys($gameSelfSwitches._data);
var matchingKeys = keys.filter(function(key) { return key.split(",")[2] === "A"; });
for (var i = 0; i < matchingKeys.length; i++) {
  $gameSelfSwitches.setValue(keys[i], false);
}
This works perfectly. Thank you!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,948
First Language
English
Primarily Uses
RMMV
Working perfectly is what Trihans do best!
 

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

Latest Threads

Latest Profile Posts

Another day of mostly mapping in Make a Game in RPG Maker MZ: Episode 7 starting now! We're making a mansion! Come watch live and join in on the chat!
Game=Forest, Feature=Tree. There's little worth in looking at a tree except in its relation to how it affects the feel of the forest.
Been a while, guys. Despite being in college now, I'm working on Season's Promise as often as I can.
Helping my sister make her game
I hope i can get some freckles for the generator soon
Guys, if you are seeing this post, send me your RPG Games, I wanna test some to know about everyone! ^^

Forum statistics

Threads
104,575
Messages
1,007,276
Members
136,056
Latest member
MichaelRIR
Top