设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 65|回复: 0

[转载发布] Conditional Branch+

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    7947

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    29901
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    38742

    灌水之王

    发表于 13 小时前 | 显示全部楼层 |阅读模式
    Conditional Branch+ v2.0 (MV)
    by mjshi- OK for use in all projects with credit
    Get it here! (direct link)
    VX Ace version also available.


    In the past, if you wanted to see if the player has more than 10 potions in their inventory, you would have to open up a new event and do the following:
        Control Variables > Variable 1 > Set > Game Data > Item "Potion" In Inventory > OK > OK > New Line > Conditional Branch > Variable 1 is > Greater than or equal to > "10" > OK

    How tedious! If only there was a simpler, more efficient way...

    Well. Look no further. Lazy- er, efficient people, rejoice! For the future is now, and with Conditional Branch+, you can replace that lengthy process with one that looks like this:
        Conditional Branch > Script > "Check.has_more(1, 10)" > OK

    Features
    - No longer do you need a bazillion nested conditional branches to check if the player has multiple items!
    Check.has(list of item ids) does that for you.
    - No more must you abuse the else branch to see if the player has either one item or another!
        Check.has_any(list of item ids) does that for you.
    - And the above apply for switches and variables as well, along with much, much more. A full list of functions can be found below and in the plugin's help file.


    update 1.1 added functions to check for weapons and equipment
    update 1.1a fixed some help file description errors and added shorthands Check.true and Check.false for Check.all_true and Check.all_false respectively
    update 1.2 fixed Check.greater and Check.lesser, also added Check.is_not (see help for more details)


    Spoiler* ------------------------------------------------------------------------------
    *    Conditional Branch+ v2
    *     Extends the functionality of what a conditional branch can check.
    *     By mjshi, OK for use in all projects with credit.
    * ------------------------------------------------------------------------------
    * How to use:
    * On a conditional branch, go to the fourth tab and select the "Script" option.
    * Type in desired thing to check. See below...
    * ------------------------------------------------------------------------------
    *    Update 2.0!
    *     Added support for checking all ids or items in a given range.
    *     Rather than Check.has(1, 2, 3, 4, 10), you can type Check.has("1-4", 10)
    *     Simply type "1-4" or "1 to 4" or "1...4" or any variant you want, so long
    *     as the separator between the start and stop is a non-digit character.
    * ==============================================================================
    *               Asterisk (*) means multiple inputs are accepted.
    *       Tilde (~) means that string ranges can be used for that parameter.
    * ==============================================================================
    * Combining Checks
    * Use "&&", "||", and "()" to combine several checks in a conditional branch.
    *   && = this AND that are true
    *   || = this OR that are true
    *   () = order of operations, check innermost parentheses first
    *   !  = translates to NOT. EX. !Check.has(1) checks if player DOESN'T have
    *        item id 1 in their inventory.
    *
    * -- EX: (Check.has(1) && Check.greater(1 , 0)) || Check.has(2)
    * -- Checks if player has item 1 and variable 1 > 0, or player has item 2.
    * ==============================================================================
    *  Possible Checks
    * ------------------------------------------------------------------------------
    *    Items
    * ------------------------------------------------------------------------------
    * Check.has(~*items)
    * -- EX: Check.has(1, 3, 4)
    * -- checks if player has items 1, 3, and 4 in inventory.
    * -- EX: Check.has("1-4")
    * -- checks if player has items 1 through 4 in inventory.
    *
    * Check.has_more(~*items, number)
    * -- EX: Check.has_more(1, 2, 3, 4, 5)
    * -- checks if player has at least five (includes 5) of items 1, 2, 3, 4.
    * -- EX: Check.has_more("1-4", 5)
    * -- checks if player has at least five of items 1 through 4 in inventory.
    *
    * Check.has_less(~*items, number)
    * -- EX: Check.has_less(1, 2, 3, 4, 5)
    * -- checks if player has at most five (includes 5) of items 1, 2, 3, 4.
    * -- EX: Check.has_less("1-4", 5)
    * -- checks if player has at most five of items 1 through 4 in inventory.
    *
    * Check.has_any(~*items)
    * -- EX: Check.has_any(1, 3, 4)
    * -- checks if player has either item 1, 3, or 4 in inventory.
    * -- EX: Check.has_any("1-4")
    * -- checks if player has any of the item IDS from 1 to 4.
    *
    * Check.each_more(*[item, number])
    * -- EX: Check.each_more([1, 2], [2, 4])
    * -- checks if there are at least 2 of item 1 and at least 4 of item 2.
    *
    * Check.each_less(*[item, number])
    * -- EX: Check.each_less([1, 2], [2, 4])
    * -- checks if there are at most 2 of item 1 and at most 4 of item 2.
    * ------------------------------------------------------------------------------
    *    Equipment
    * ------------------------------------------------------------------------------
    * Check.equipped(who, "weapon", *ids, "armor", *ids)
    *  who can be omitted to check ALL members of the party or "active" to check all
    *  party members active in battle, or it can be a list of actor ids.
    *   additionally: stores the ID of the first person it finds with the equips
    *   in Check._whoHad, and if nobody had them equipped, Check._whoHad is 0.
    *   This can be used in Control Variables to set a variable to the ID of the
    *   person who had everything equipped.
    *
    * -- EX: Check.equipped("weapon", 1, "armor", 1, 3, 5)
    * -- this works too: Check.equipped("armor", 1, 3, 5, "weapon", 1)
    * -- checks if armors 1, 3 AND 5 as well as weapon 1 are equipped by anyone in
    *    the party. As you can see, weapon and armor can be anywhere.
    * -- EX: Check.equipped(1, "weapon", 1)
    * -- checks if weapon 1 is equipped by actor id 1
    * -- EX: Check.equipped(1, 2, "armor", 1)
    * -- checks if armor 1 is equipped by actor id 1 or two
    *
    * Check.any_equipped(who, "weapon", *ids, "armor", *ids)
    *  Similar setup to Check.equipped, but is lazier. Also stores the ID of the
    *  first person it finds in Check._whoHad. Check.equipped_any works as well.
    * -- EX: Check.any_equipped(1, "weapon", 3, "armor", 1, 2, 3)
    * -- checks if actor 1 equipped either weapon id 3 or armor id 1 or 2 or 3
    *
    *              **The following commands check the inventory ONLY**
    *
    * Check.has_weapon(~*ids)
    * Check.has_armor(~*ids)
    * Check.weapon_any(~*ids)
    * Check.armor_any(~*ids)
    * -- EX: Check.has_weapon(1, 3, 4)
    * -- checks if player has weapons 1, 3, and 4 in their inventory
    * -- EX: Check.armor_any(1, 3, 4)
    * -- checks if player has either armor 1, 3, or 4 in their inventory
    * -- EX: Check.weapon_any("1-4")
    * -- checks if player has either of the weapons 1 through 4 in inventory
    *
    * Check.weapon_more(~*ids, number)
    * Check.weapon_less(~*ids, number)
    * Check.armor_more(~*ids, number)
    * Check.armor_less(~*ids, number)
    * -- EX: Check.weapon_more(2, 10)
    * -- checks if there are at least 10 of weapon id 2
    * -- EX: Check.armor_less(2, 10)
    * -- checks if there are at most 10 of armor id 2
    * ------------------------------------------------------------------------------
    *    Variables
    * ------------------------------------------------------------------------------
    * Check.is_any(variable, ~*values)
    * -- EX: Check.is_any(1, 3, 4, 5)
    * -- checks if variable 1 is either 3, 4, or 5.
    *
    * Check.is_not(variable, ~*values)
    * -- EX: Check.is_not(1, 3, 4, 5)
    * -- checks if variable 1 is neither 3, 4, nor 5.
    *
    * Check.greater(~*variables, value)
    * -- EX: Check.greater(1, 2, 3, 5)
    * -- checks if variables 1, 2, and 3 are at least 5.
    *
    * Check.lesser(~*variables, value)
    * -- EX: Check.lesser(1, 2, 3, 5)
    * -- checks if variables 1, 2, and 3 are at most 5.
    *
    * Check.in_range(~*variables, start, stop)
    * -- EX: Check.in_range(1, 3, 4, 5)
    * -- checks if variable 1 AND 3 are between 4 and 5, including 4 and 5.
    *
    * Check.any_is(~*variables, value)
    * -- EX: Check.any_is(1, 3, 4, 5)
    * -- checks if variable 1 or 3 or 4 are equal to 5
    *
    * Check.any_inrange(~*variables, start, stop)
    * -- EX: Check.any_inrange(1, 3, 4, 5)
    * -- checks if variable 1 OR 3 are between 4 and 5, including 4 and 5.
    *
    * Check.each_is(*[variable, value])
    * -- EX: Check.each_is([1, 3], [4, 5])
    * -- checks if variable 1 is 3, and variable 4 is 5.
    *
    * Check.each_greater(*[variable, value])
    * -- EX: Check.each_greater([1, 3], [4, 5])
    * -- checks if variable 1 is at least 3 and variable 4 is at least 5.
    *
    * Check.each_lesser(*[variable, value])
    * -- EX: Check.each_lesser([1, 3], [4, 5])
    * -- checks if variable 1 is at most 3 and variable 4 is at most 5.
    *
    * Check.each_inrange(*[variable, start, stop])
    * -- EX: Check.in_range([1, 3, 5], [3, 1, 4])
    * -- checks if variable 1 is between 3 and 5, and variable 3 is between 1 and 4.
    * ------------------------------------------------------------------------------
    *    Switches
    * ------------------------------------------------------------------------------
    * Check.all_true(~*switches)
    * -- EX: Check.all_true(1, 2, 3)
    * -- checks if switches 1, 2, 3 are true.
    * -- EX: Check.all_true("1-4")
    * -- checks if switches 1 through 4 are true.
    *
    * Check.true(~*switches)
    * -- Same behavior as above
    *
    * Check.any_true(~*switches)
    * -- EX: Check.any_true(1, 2, 3)
    * -- checks if either of switches 1, 2, 3 are true.
    *
    * Check.all_false(~*switches)
    * -- EX: Check.all_false(1, 2, 3)
    * -- checks if switches 1, 2, 3 are false.
    * -- EX: Check.all_false("1-4")
    * -- checks if switches 1 through 4 are false.
    *
    * Check.false(~*switches)
    * -- Same behavior as above
    *
    * Check.any_false(~*switches)
    * -- EX: Check.any_false(1, 2, 3)
    * -- checks if either of switches 1, 2, 3 are false.
    *
    * Check.each_switch(*[switch, on/off])
    * If on, put 1. If off, put 0.
    * ==============================================================================




    Installation
    Drag into plugin folder, enable in plugin manager. It's just a collection of logic bits, so read the help to see which functions exist.

    Credit
    mjshi


    本贴来自国际rpgmaker官方论坛作者:mjshi处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/conditional-branch.63723/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-31 22:34 , Processed in 0.098359 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表