Conditional Brand - Is Leader Equipped? (Solved)

Nice thread! I don't really know if my question belongs here but here I go:

I am trying to make a conditional branch using the following script call:

$gameParty.isAnyMemberEquipped($dataArmors[20])

Now, the command works fine but I'd like to know how to check if the Leader of the party is equipped with some specific equipment (the Armor ID 20 in this case).

I already checked the Rpg_objects.js for references and tried a lot of things (that "should" had worked but I it didn't).

May you guys please help me out?
Now, the command works fine but I'd like to know how to check if the Leader of the party is equipped with some specific equipment (the Armor ID 20 in this case).
Here's one way to do it:

Code:
var lead = $gameParty.members()[0]._actorId;
var body = $gameActors.actor(lead).equips()[3];
if (body != null && body.id == 20) {
     $gameMessage.add("yes"); 
} else {
     $gameMessage.add("nah"); 
}
Code:
var lead = $gameParty.members()[0]._actorId;
var body = $gameActors.actor(lead).equips()[3];
if (body != null && body.id == 20) {
$gameMessage.add("yes");
} else {
$gameMessage.add("nah");
}

I understand the code but I am not sure where to use it. Like, how do I put it in the Conditional Brand Event Command - Script Call?

Also, why the $gameMessage part? I am really confused and I don't understand much of it xD, sorry!

//EDIT: Was that supposed to be used in a Script Event Command? I just tried and it didn't worked.
@Zonegm

Sorry, I misunderstood where you were using the code. For using in the Conditional Branch Script:

Code:
$gameActors.actor($gameParty.members()[0]._actorId).equips()[3] != null && $gameActors.actor($gameParty.members()[0]._actorId).equips()[3].id == 20

(The $gameMessage part was just for testing.) Just check the "Create Else Branch" box!
Code:
$gameActors.actor($gameParty.members()[0]._actorId).equips()[3] != null && $gameActors.actor($gameParty.members()[0]._actorId).equips()[3].id == 3

It didn't worked. I got that the 3 is for the Head ID, right? The thing is that I am using the ID 8 for Tools, check it out:

1580537273287.png


So, what I am doing is this: in my game you can collect resources, like mining! Then you have your proficiency in mining and the pickaxe. The Pickaxe here is equippable as a Equipment Type (Tool - 08 ID) and the Pickaxe itself is ID 20. What I am looking for is a script call for something like: "if leader is equipped with Pickaxe then...". Putting it in Javalanguage xD would be something like this: $gameParty.leader.isEquipped($dataArmors[20]). But this doesn't work so what I am looking at is how to make it work? xDDDD
@Zonegm

Ah, didn't know you'd customized like that. Try this?

Code:
$gameActors.actor($gameParty.members()[0]._actorId).equips()[7] != null && $gameActors.actor($gameParty.members()[0]._actorId).equips()[7].id == 20

where 7 is the Tool category (in code it starts with 0) and 20 at the end is the Pickaxe ID.

Unfortunately if this doesn't work I don't think I can help, since you've got a pretty customized setup, sorry.
Code:
$gameActors.actor($gameParty.members()[0]._actorId).equips()[7] != null && $gameActors.actor($gameParty.members()[0]._actorId).equips()[7].id == 20

No, it didn't worked. I also tried to change the 7 for 8 and didn't worked. Although I can not see really why! Because logically speaking, it makes sense for me! Could be something wrong in this part?

$gameActors.actor($gameParty.members()[0]._actorId).equips()[7] != null

I can't say...

1580539048088.png


The $gameParty.isAnyMemberEquipped($dataArmors[20]) works pretty well! I tried linking it with the $gameParty.leader so many times but none worked. Don't know why!!!
@dommit

What if I create a new object (isLeaderEquipped) to address the command: $gameParty.isLeaderEquipped($dataArmors[20])

1580541247435.png


Based in the isAnyMemberEquipped. Could it be done? Do you or anyone else know how to do this?
@Zonegm

Try this?
Code:
$gameActors.actor($gameParty.members()[0]._actorId).equips()[7] != null && $gameActors.actor($gameParty.members()[0]._actorId).equips()[7].id == $dataArmors[20].id

You shouldn't need to do any "isLeaderEquipped" stuff. The code above works in my test environment, so please if it doesn't work... do you get any errors in console? Note: it doesn't work if I right-click "test", but it works if I do a full test play.
Code:
$gameActors.actor($gameParty.members()[0]._actorId).equips()[7] != null && $gameActors.actor($gameParty.members()[0]._actorId).equips()[7].id == $dataArmors[20].id

No, it didn't worked. No console error neither:

1580542963279.png


I am doing the tests in PlayTest.

I don't know what to do... xDDD
Is it possible that Weapon ID 20 is number 19 in this case, i mean some stuff starts counting with 0 as 1st number.Normally it would be 1 for 1st number.
Okay, so... I found out a way to do it and also maybe the explanation!

First, the code I made to work is this: $gameParty.leader().hasArmor($dataArmors[20])

Second: I do think that HIME_CustomPartyLeader was interfering with the game interpreter in some way, I can't really say for sure, the only thing I know is that after disabling it, the code worked perfectly!!!

I'll continue to do some more tests and I'll report if I find out other issues or even an explanation about the conflict with the HIME plugin.

Thanks @dommit for the effort and time, I really appreciated it!
@Zonegm I have separated your posts out into their own thread as they are trying to figure out how to use a specific javascript code rather than asking for a specific script call, and so go beyond the purpose of the Script Call thread.

Original thread: https://forums.rpgmakerweb.com/threads/conditional-brand-is-leader-equipped-solved.117853/