garret95

Pokémon Breeder
Member
Joined
Mar 15, 2017
Messages
17
Reaction score
4
First Language
Spanish
Primarily Uses
RMMV
I'm using Yanfly's Skill Core, and I've created a pretty neat concept for some skills that need a switch to be on to use them.

JavaScript:
<Custom Requirement>
if $gameSwitches.value[122] == true {
  value = true; // enable skill
} else {
  value = false; // disable skill
}
</Custom Requirement>

I though that would work but gives me an error... What am I doing wrong? Is it even possible with switches or should I use variables instead?
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
631
Reaction score
847
First Language
German
Primarily Uses
RMMV
use ( ) instead of [ ]

Like this:

<Custom Requirement>
if ($gameSwitches.value(122) == true) {
value = true; // enable skill
} else {
value = false; // disable skill
}
</Custom Requirement>
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,771
Reaction score
2,121
First Language
EN
Primarily Uses
RMMZ
Also, you need brackets around the entire condition (details here: link), i.e.

<Custom Requirement> if ($gameSwitches.value(122) === true) { value = true; } else { value = false; } </Custom Requirement>
Since $gameSwitches.value should always return true or false, this can be written more concisely:

<Custom Requirement> value = $gameSwitches.value(122); </Custom Requirement>
 

garret95

Pokémon Breeder
Member
Joined
Mar 15, 2017
Messages
17
Reaction score
4
First Language
Spanish
Primarily Uses
RMMV
Well would you look at that, it just works. Looks like someone (me) needs to start learning some javascript. Thank you Scorchedground, and thank you again caethyril!
 

Latest Threads

Latest Posts

Latest Profile Posts

I'm making Toilet in Wonderland 2. and tell vinny about it lol
WE ARE THE BORG. YOUR BIOLOGICAL AND TECHNOLOGICAL DISTINCTIVENESS WILL BE ADDED TO OUR OWN. RESISTANCE IS FUTILE.
D2R save files are so broken. how was the beta test better then the full release. blizzard's last hope crashed and burned.
they're getting no more chances from me.
Anyone going to talk about Chris Pratt Mario?

Forum statistics

Threads
115,336
Messages
1,089,105
Members
150,009
Latest member
biscoitovelho
Top