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

[转载发布] Weapon & Armor Check calls

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

    连续签到: 2 天

    [LV.7]常住居民III

    5778

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 昨天 20:16 | 显示全部楼层 |阅读模式
    This is Fugama's Weapon and Armors calls plugin 1.0!


             This is my first plugin and as such, it's very basic. But I think it'll get some use. I've noticed a lot of people around here lately want to be able to easily check for things such as armors and weapons. With this plugin it'll be just a bit easier to check for those things. This doesn't do too much for the average consumer since it simply adds some more javascripts calls, but it goes well with for people who are trying out Yanfly's Lunatic Mode! Feel free to use this for anything you want! and please let me know if something isn't working properly


    features: Four Javscript calls to check for the existence of weapons and armor (be it specific or just the existence of)


    How to use: I haven't seen the location on the plugin list matter yet, so just put it into your games "Base/js/plugins" folder, and add it in rpgmaker's plugin manager! you can use the commands "hasWep()", "hasArmor()", "isEquippedWep(Weapon Id Here)", and "isEquippedArmor(Armor Id Here)". The first two check to see if the user has a weapon or armor equipped (respectively). The last two let you check for specific weapons or armors based on the Id you place in the parentheses. 


    The plugin: you can download it HERE! or copy this and paste it into a .js file.


    /*:
    *
    *@plugindesc Some new checks you can access!
    *
    *@author Fugama
    *
    *@help
    *
    * With these new identifiers you can customize
    *Yanfly's lunatic mode just a little bit easier,
    *or just have an easier time calling these checks for any other
    *JS scripting you may be doing.
    *
    *
    *The first command is "isEquippedWep()" it can be used like this
    *"user.isEquippedWep(x)" where x is the weapon id You want to check!
    *
    *The second is "hasWep()". This checks if the Actor was any weapon at all
    *(compatable with Dual Wielding) example:
    *"user.hasWep()" this needs no paramaters for the parentheses.
    *
    *The third is "isEquippedArmor()" This checks for a specific Armor equip. example:
    *"user.isEquippedArmor(x)" where x is the ID of the armor.
    *
    *Following the pattern, the fourth is "hasArmor()" This goes through and checks if the actor has any armor equipped!
    *
    *example: "user.hasArmor()"
    *
    *I hope you find some use from these ease-of-access addtions!
    */
    (function(){


            //Actor Checks
    Game_Actor.prototype.isEquippedWep = function(WepID) {
    var wep = $dataWeapons[WepID];
    if (this.isActor() && this.equips().contains(wep)){
            return true;
    } else {
            return false;
    }
    };


    Game_Actor.prototype.hasWep = function() {

                    var equipList = this._equips;
                    var wepCount = 0;
                    for (i = 0; i < equipList.length; i++){
                            var itemCheck = equipList;
                                    if (itemCheck._dataClass === "weapon"){
                                            wepCount =+ 1;
                                    }
                    }
            if (wepCount != 0){
                    return true;
            } else {
            return false;
    }
    };

    Game_Actor.prototype.isEquippedArmor = function(ArmID) {
            var armor = $dataArmors[ArmID];
    if (this.isActor() && this.equips().contains(armor)){
            return true;
    } else {
            return false;
    }
    };


    Game_Actor.prototype.hasArmor = function() {
                    var equipList = this._equips;
                    var ArmCount = 0;
                    for (i = 0; i < equipList.length; i++){
                            var itemCheck = equipList;
                                    if (itemCheck._dataClass === "armor"){
                                            ArmCount =+ 1;
                                    }
                    }
            if (ArmCount != 0){
                    return true;
            } else {
            return false;
    }
    };       


    //prevent crashes from enemy battlers using the same abilities
    Game_BattlerBase.prototype.isEquippedWep = function(WepID) {
        return false;
    };


    Game_BattlerBase.prototype.hasWep = function(WepID) {
        return false;
    };       

    Game_BattlerBase.prototype.hasArmor = function(WepID) {
        return false;
    };       

    Game_BattlerBase.prototype.isEquippedArmor = function(WepID) {
        return false;
    };       



    })();


            credits: Myself for making the plugin


            Yanfly for his tips and tricks videos making JS easier to understand


            and SumRndmDde for his making a plugin series!



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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-26 02:42 , Processed in 0.087315 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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