RPG Maker Forums

Hey there! I am trying to figure out how to turn on a switch if a variable is equal to a bunch of possible values? What I got so far is something like this...

So I have an event that sets variable 1 to the value of 115. And then I create the following script call:

var hs = [113, 114, 115, 116, 117];
if ($gameVariables.value(1) === hs) {
$gameSwitches.setValue(100, true);
}


So basically if variable #1 is equal to 113, 114, 115, 116, or 117, game switch 100 will turn on. I'm no programmer so I'm not entirely sure how to do this part exactly. I can do this through a bunch of conditional branches but what if variable 1 can be equal to lets say 1000 different numbers, then I'd have a bunch of conditionals :) . Any help would be greatly appreciated! Thank you!!!!

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top