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
620
Reaction score
832
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,748
Reaction score
2,100
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 Profile Posts

I might not participate in the Boss Battle contest after all... I have more important things to do, like Wishful Wanda. And of course the Dark Deception spinoff I plan to pitch, Demon Slayer.
Changed my avatar, goodbye Alan Sugar, hello George Carlin (one of my favorite human beings ever)
If you still don't subscribe our Polish channel please consider it :)
1.png
Who wants to see my review of the worst star wars movie? This movie has all the excitement of being on Jury Duty of the most boring case ever about trade negotiations.
A lot to learn to make a game. Can I handle it?

Forum statistics

Threads
115,171
Messages
1,087,803
Members
149,723
Latest member
krinalle
Top