Custom requirement Yanfly skill core, Javascript help required.

ABandit

Veteran
Veteran
Joined
Sep 24, 2018
Messages
56
Reaction score
47
First Language
English
Primarily Uses
VNM
Hi there!

I'm working on 'joint skills' in my RPG maker MV project, in which two characters join forces.
These skills cannot be used if a certain member is not in the party or that certain party member is affected by a status effect that makes you lose control of that character, like paralysis, rage or confusion.

With the code snippet below, the joint skill cannot be used when Actor 3 is not in the party or when he is dead (State 1).
<Custom Requirement>
if ($gameParty.members().contains($gameActors.actor(3))) {
if ($gameActors.actor(3).isStateAffected(1)){
value = false;
}
else {
value = true;
}
} else {
value = false;
}
</Custom Requirement>
This works fine, but I have more states to add and I cannot get this to work.
I made a variable list as follows:
var status = []:
status.push(1, 7, 8, 9, 10, 11, 13, 49, 104, 120);
And I tried to fill in that variable in 'StateAffected', but this doesn't work. Also tried to simply list all states as follows:
if ($gameActors.actor(3).isStateAffected(1) || $gameActors.actor(3).isStateAffected(7)) {
This also doesn't work.

Anyone here that can point me in right direction?

Thanks in advance!
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,038
Reaction score
10,254
First Language
Czech
Primarily Uses
RMMV
Code:
<Custom Requirement>
if ($gameParty.members().contains($gameActors.actor(3))) {
var status = [1, 7, 8, 9, 10, 11, 13, 49, 104, 120];
value = true;
for (var i in status) {
if ($gameActors.actor(3).isStateAffected(status[i])){
value = false;
break;
}
}
} else {
value = false;
}
</Custom Requirement>
 

ABandit

Veteran
Veteran
Joined
Sep 24, 2018
Messages
56
Reaction score
47
First Language
English
Primarily Uses
VNM
Thank you! It works :kaojoy:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

"If the lion knew her own strength, hard were it for anyone to rule her". This would be my custom title if I had enough spaces for it. Coming off of personal pain, I'm glad I found the original quote I've tweaked.
Today I found out that ladybirds\ladybugs are apparently named for the Virgin Mary. They're also known as God's cows in some places.
J0pac wrote on CrowStorm's profile.
The sad reaction was not because I want you to credit me. (terms clearly say no need to credit) but because those maps are meant to be used as inspiration or guidence. You are ofcourse alowed to use them however you want :)
I'm an adult married woman

Forum statistics

Threads
93,452
Messages
912,528
Members
122,977
Latest member
Midgar21
Top