ConditionalBranch+: how to use Check.any_equipped?

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
96
Reaction score
6
First Language
Russian
Primarily Uses
RMMV
I tried to use "Check.any_equipped" command of "Conditional Branch+", but it doesn't work with multiple armor IDs.
I want to make sure that the actor 1 wears one of two types of armor.
condbranch1.jpg
How to solve this problem?
 

tale

Volunteer
Veteran
Joined
Dec 16, 2016
Messages
726
Reaction score
1,226
First Language
English
Primarily Uses
N/A
Did you tried-
Check.any_equipped

The script you used in the image-
Check.equipped_any

Edit: I checked the plugin, both ways should work. Are there other plugins you used?
 
Last edited:

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
96
Reaction score
6
First Language
Russian
Primarily Uses
RMMV
Did you tried-
Check.any_equipped

The script you used in the image-
Check.equipped_any

Edit: I checked the plugin, both ways should work. Are there other plugins you used?
Yes, I using other plugins. A lot of them:
TerraxLightingPlugin;
ARP_TitleCommandExit;
ChangeGraphics;
Yami's Skill Shop;
Yanfly's Battle Engine Core, Buffs & States Core, MoveRouteCore, HitAccuracy, HPGauge, TurnOrderDisplay;
Polyedit's BondageMovementSystem and BMSSV;
And EnemyBook with Community_Basic.
plugins.jpg
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
Please include a link to the script (do not copy/paste the script into this thread)
 

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
96
Reaction score
6
First Language
Russian
Primarily Uses
RMMV
Please include a link to the script (do not copy/paste the script into this thread)
You mean link to the plugin?
2.0 version.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
A plugin is a script, so yes.
 

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
96
Reaction score
6
First Language
Russian
Primarily Uses
RMMV
Alright, the script works well
Code:
(function(actor, ...ids){ var result = false, armors = actor.armors().reduce(function(r, obj){ return r.concat(obj.id); },[] ); for (i in ids) if (armors.contains(ids[i])) result = true; return result; })($gameActors.actor(1), 6, 1, 2, 9, 10, 11)
but plugin doesn't do it. Although i wrote the right lines:
Code:
Check.any_equipped(1, "armor", 6, 1, 2, 9, 10, 11)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
link, please. It would take a small amount of time to give you the correct command, if you would just provide the link. I'm not going to go hunting for it.
 

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
96
Reaction score
6
First Language
Russian
Primarily Uses
RMMV
link, please. It would take a small amount of time to give you the correct command, if you would just provide the link. I'm not going to go hunting for it.
I'm not sure that I can help here.
Link to the plugin is above. Or you need another link? I can't understand what the link is required.
I found the code, which supposed to make "Check.any_equipped" works, in the plugin:
Code:
Check.any_equipped = function() {
    var args = Array.prototype.slice.call(arguments);
    var actors = [], weapons = [], armors = [];
    //setup actors
    if (isNaN(args[0])) {
        if (args[0] === "active") {for (var i = 0; i < $gameParty.battleMembers().length; i++) {actors.push($gameParty.battleMembers()[i]._actorId)}
        } else {for (var i = 0; i < $gameParty.allMembers().length; i++) {actors.push($gameParty.allMembers()[i]._actorId)}}
    } else {
        for (var i = 0; i < args.length; i++) {
            if (isNaN(args[i])) {break}; //stop when they declare weapon/armor
            actors.push(args[i]);
        } for (var i = 0; i < actors.length; i++) {args.shift()}
    }
    //setup weapons and armors arrays
    for (var i = 0; i < args.length; i++) {
        if (isNaN(args[i])) {phase = args[i]} else {
            eval(phase + "s" + ".push($data"+ phase.charAt(0).toUpperCase() + phase.slice(1) + "s" + "[" + args[i] + "])")
        }
    }

    for (var i = 0; i < actors.length; i++) { //for every person
        var has = false;
        for (var w = 0; w < weapons.length; w++) { //check weapons
            has = $gameActors.actor(actors[i]).hasWeapon(weapons[w]);
        } if (has) { //we got it, stop checking now
            Check._whoHad = actors[i]; //save who had it
            return true}
        for (var a = 0; a < armors.length; a++) { //check armors
            has = $gameActors.actor(actors[i]).hasArmor(armors[a]);
        } if (has) { //we got it, stop checking now
            Check._whoHad = actors[i]; //save who had it
            return true}
    }
    //we checked everyone already, and nobody had it
    Check._whoHad = 0;
    return false;
};
"Check.equipped" works well.
 

tale

Volunteer
Veteran
Joined
Dec 16, 2016
Messages
726
Reaction score
1,226
First Language
English
Primarily Uses
N/A
Code:
Check.any_equipped(1, "armor", 6, 1, 2, 9, 10, 11)
Possible reason why it might not work was probably due to using armor id that's not created in the database yet.
If maximum is 10 then 11 is null in the script. (from what I tried) You did get it to work by using a different script call.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
<removed>

okay - I haven't seen that in a plugin before. Will need to take a bit more time to look at it before I understand how it's processing arguments that aren't even passed.

Edit: according to the description, Check.equipped() and Check.any_equipped() both do the same thing. If Check.equipped() works, why not just use that?
 
Last edited:

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