Custom requirement Yanfly skill core, Javascript help required.

ABandit

Veteran
Veteran
Joined
Sep 24, 2018
Messages
56
Reaction score
51
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,125
Reaction score
10,639
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
51
First Language
English
Primarily Uses
VNM
Thank you! It works :kaojoy:
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,040
Members
137,569
Latest member
Shtelsky
Top