Custom requirement Yanfly skill core, Javascript help required.

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!
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>
Thank you! It works 😂
I had the same problem thanks it helped me a lot :LZSsmile:

@Tiago Veras , please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


Glad it could help you. However, I have to close the thread.

Original thread: https://forums.rpgmakerweb.com/threads/custom-requirement-yanfly-skill-core-javascript-help-required.101474/