How do a conditional check: if any party member has certain skill

Hi,

How can I get a conditional branch that checks if any of the current party members has a certain skill?

To clarify, I want to do a Pokémon style HM move à la cut. So if you press Z when in front of a tree and one of your party members has the skill Cut, it will remove the tree. To do this I need to have the above conditional check.

Thanks in advance!
You check it for every party member. Go to conditional branch, set it to the actor, then check if that actor has the skill. You'll have to do it for every party member to do it the way you describe.
Thanks for the reply.

The above I figured out. I was wondering if there was a less cumbersome method, perhaps via a script call? Like: if any party member has skill is not zero.

My project has a bunch of a lot of possible party members and I want to keep the event as short as possible.
If there is, I don't know it. And for requests on script calls and such, this thread should be under Learning JavaScript. I'll move it there for you.
I've had a look at it, and frankly, the script required to perform this action would be even MORE cumbersome than just using a 4x nested conditional in the event. You would need to reset a game variable, then run a forEach command to check if each actor has the skill, and for each one if they do change the game variable to true, and then at the end of your script call run a conditional branch to check if the variable is set to true.

The power of the event editor is that it does so much of the code behind the scenes for you. If there's a way to do it in the editor, it's usually faster than the associated script.

EDIT: Since you're interested in the script, though, it would look something like this...
Code:
$gameVariables.setValue(VARIABLEID, false);
$gameParty.members().forEach(function(actor) {
    if (actor.hasSkill(SKILLID) {
        $gameVariables.setValue(VARIABLEID, true);
    };
});
where VARIABLEID and SKILLID are replaced by the appropriate numbers, and follow that up with your conditional branch to check if VARIABLEID is true.

EDIT2: (GAH, I hate it when you figure something out after you post)
If you're just pasting it into the conditional branch script area, you could do this, if it fits:
Code:
var temporaryVariable = false;
$gameParty.members().forEach(function(actor) {
    if (actor.hasSkill(SKILLID) {
        temporaryVariable = true;
    };
});
return temporaryVariable;
Still pretty hard to follow your own logic after the fact, though. I'd do the nested conditional unless you have 18 party members or something.
Thanks, I'll try it out!
Tried the latter first, but it didn't work. Got an 'unexpected token }'. The first one got me an error too: unexpected token )

Unless this tells you immediately what's wrong, I'll try the builtin way until I run into trouble.
Yeah, sorry, I just grabbed up the code that was relevant and didn't test it out. It would probably take a lot to figure it out. Like I said, the other way seems far superior to me.
@Leaufai : Thanks to @Trihan , I now know how to do this. Just replace SKILLID with the number of the skill you're looking for. This will return a true/false value and can be pasted directly into the conditional branch script box.

$gameParty.members().some(function(member){return member.hasSkill(SKILLID);});
Thanks for the shoutout! As an aside, you may wish to substitute members() for aliveMembers() if you don't want to include characters who are dead in the check.
Didn't expect to see an update here again. So even though it's been a month ago, @Llareian and @Trihan, thanks a lot for this! This really helps me with the monster game that I'm working on.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-a-conditional-check-if-any-party-member-has-certain-skill.85715/