Conditional Brand - Is Leader Equipped? (Solved)

Zonegm

Veteran
Veteran
Joined
Mar 1, 2019
Messages
36
Reaction score
7
First Language
English
Primarily Uses
RMMV
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?
 

dommit

Villager
Member
Joined
Dec 30, 2019
Messages
6
Reaction score
1
First Language
English
Primarily Uses
RMMV
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"); 
}
 

Zonegm

Veteran
Veteran
Joined
Mar 1, 2019
Messages
36
Reaction score
7
First Language
English
Primarily Uses
RMMV
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.
 
Last edited:

dommit

Villager
Member
Joined
Dec 30, 2019
Messages
6
Reaction score
1
First Language
English
Primarily Uses
RMMV
@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!
 
Last edited:

Zonegm

Veteran
Veteran
Joined
Mar 1, 2019
Messages
36
Reaction score
7
First Language
English
Primarily Uses
RMMV
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
 

dommit

Villager
Member
Joined
Dec 30, 2019
Messages
6
Reaction score
1
First Language
English
Primarily Uses
RMMV
@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.
 

Zonegm

Veteran
Veteran
Joined
Mar 1, 2019
Messages
36
Reaction score
7
First Language
English
Primarily Uses
RMMV
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!!!
 

Zonegm

Veteran
Veteran
Joined
Mar 1, 2019
Messages
36
Reaction score
7
First Language
English
Primarily Uses
RMMV
@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?
 

dommit

Villager
Member
Joined
Dec 30, 2019
Messages
6
Reaction score
1
First Language
English
Primarily Uses
RMMV
@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.
 

Attachments

Zonegm

Veteran
Veteran
Joined
Mar 1, 2019
Messages
36
Reaction score
7
First Language
English
Primarily Uses
RMMV
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
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
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.
 
Last edited:

Zonegm

Veteran
Veteran
Joined
Mar 1, 2019
Messages
36
Reaction score
7
First Language
English
Primarily Uses
RMMV
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!
 

Attachments

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
@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.
 

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

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,549
Members
137,837
Latest member
Dabi
Top