ConditionalBranch+: how to use Check.any_equipped?

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
67
Reaction score
3
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
544
Reaction score
884
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
67
Reaction score
3
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
38,488
Reaction score
12,033
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
67
Reaction score
3
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
38,488
Reaction score
12,033
First Language
English
Primarily Uses
RMMV
A plugin is a script, so yes.
 

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
67
Reaction score
3
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
38,488
Reaction score
12,033
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
67
Reaction score
3
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
544
Reaction score
884
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
38,488
Reaction score
12,033
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

This forum is a great source of procrastination for me.
Today I read "The mouth speaks what the heart is full of." Simple, and reminds me I have a ton of work to do.
Why are cats so darn cute when their tongues are sticking out? If I did that, it wouldn't have the same effect.
The joy when you see a notification, the down when it's just a unnecessary quote of one of your posts again.

Forum statistics

Threads
94,399
Messages
920,619
Members
124,179
Latest member
mybriguy
Top