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
632
Reaction score
848
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,775
Reaction score
2,124
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

Just released a new trailer for Manafinder! It's the TGS trailer! :D I'm very happy with the result!
sooo... im gonna go ahead and release all my game ideas on android as Beta. Everyone will be nice right? cause its Beta... right?...

AABS traps and heals (detail is below the YTB desc)
 I may actually have something I can put into the Boss Battle Build Bout by the time it’s due. It won’t be anything spectacular (or even great (and maybe not even good (I have no idea how to do combat (yay for nested parentheses)))), but I might have a submission none the less.
Today's my first login since Jan 2020. Time sure flies. Sorry to everyone's messages i missed.

Forum statistics

Threads
115,408
Messages
1,089,652
Members
150,150
Latest member
Moss-eater
Top