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
647
Reaction score
899
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,862
Reaction score
2,199
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 found an absolutely brilliant lifehack on the internet today.

Screenshot_760.jpg
It does sometimes get a little embarrassing that I often come here to ask for help with something and seldom have anything to actually show for it. If there is one thing though I can commend myself for, it's for sticking with an idea I've been tinkering with for this long now and gradually making headways. Even though I've been reserved about my progress, I can say I'm farther now than where I initially started.
I'm gonna put my project on pause for a tiny bit so I can explore the engine outside of it... Winging it can only get you so far LMFAO
Have seen some of my favorite people here posting and helping others with questions today -- love to see it!

Forum statistics

Threads
116,134
Messages
1,096,064
Members
151,555
Latest member
Fotdur
Top