扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 237|回复: 0

[转载发布] 【插件改】为MOG_BattleHud添加状态回合数

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    2025-2-4 02:05
  • 签到天数: 110 天

    连续签到: 2 天

    [LV.6]常住居民II

    2327

    主题

    395

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    10465
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    13215

    灌水之王

    发表于 2024-3-7 00:28:50 | 显示全部楼层 |阅读模式
    用过MOG_BattleHud插件的你或许和我一样困扰于一个很劝退的问题,即是这个插件它创建的角色战斗窗口竟然不显示状态回合数,只是一个状态摆在那里不知道要持续多久。相关的求助贴在P1,rpgmaker forum都很多,却无人能回答。
    今天我偶然翻到一篇神文在MTK project上https://mtk-project.jimdofree.co ... %E8%A9%B3%E7%B4%B0/
    其详细叙述了如何为该插件添加状态回合的功能,同时我也对此方法进行了一定改进工作,希望能帮到一部分人。

    被解决的问题:1.状态不显示回合数。 2.buff与debuff更新时下方状态列表不刷新状态。3.(新增)状态不显示堆叠数
    解决思路:为Game_Battler的increaseBuff、decreaseBuff、eraseBuff、overwriteBuffTurns、updateBuffTurns分别添加need_refresh_bhud_states标记以触发刷新。将Triacontane的StateRingIcon插件中获取状态回合数与buff回合数的函数搬到MOG_BattleHud,挂在Game_BattlerBase上,最后在Refresh States2函数中调用它。
    如果是已经魔改过度的,就只能手动加代码了,请参阅[具体过程],如果是Drill版可直接下载最底下文件覆盖。
    具体过程:我们假定你手里有一份MOG_BattleHud.js
    第一步
    JAVASCRIPT 代码
    1. * @param States Adjust
    2. * @parent ==状态==
    3. * @desc ステートの間隔を自動調整する
    4. * @defaulttrue
    5. *
    6. * @param States Turn
    7. * @parent ==状态==
    8. * @desc 味方ステートのターン数を表示する
    9. * @defaulttrue
    10. *  
    11. * @param States FontSize
    12. * @parent ==状态==
    13. * @desc 味方ステートのターン数のフォントサイズ
    14. * @default20
    15. *  
    16. * @param States Turn X-Axis
    17. * @parent ==状态==
    18. * @desc 味方ステートのターン数のX座標調整
    19. * @default0
    20. *
    21. * @param States Turn Y-Axis
    22. * @parent ==状态==
    23. * @desc 味方ステートのターン数のY座標調整
    24. * @default0
    25. *
    26. * @param States Counter X-Axis
    27. * @parent ==状态==
    28. * @desc 味方ステートのターン数のX座標調整
    29. * @default0
    30. *
    31. * @param States Counter Y-Axis
    32. * @parent ==状态==
    33. * @desc 味方ステートのターン数のY座標調整
    34. * @default0
    35. *
    36. * @param State Color
    37. * @parent ==状态==
    38. * @type number
    39. * @min 0
    40. * @max 31
    41. * @desc 状态颜色,如果有YEP状态核心设置了颜色,则遵循该插件的设置
    42. * @default0
    复制代码


    增加一部分控制状态回合数、堆叠数坐标与字体、颜色的插件参数

    第二步
    JAVASCRIPT 代码
    1. Moghunter.bhud_statesAdjust = String(Moghunter.parameters['States Adjust'] || true);
    2.         Moghunter.bhud_statesTurn = String(Moghunter.parameters['States Turn'] || true);
    3.         Moghunter.bhud_statesSize = Number(Moghunter.parameters['States FontSize'] || 20);
    4.         Moghunter.bhud_states_turn_x = Number(Moghunter.parameters['States Turn X-Axis'] || 0);
    5.         Moghunter.bhud_states_turn_y = Number(Moghunter.parameters['States Turn Y-Axis'] || 0);
    6.         Moghunter.bhud_states_counter_x = Number(Moghunter.parameters['States Counter X-Axis'] || 0);
    7.         Moghunter.bhud_states_counter_y = Number(Moghunter.parameters['States Counter Y-Axis'] || 0);
    8.         Moghunter.BSCTurnColor = Number(Moghunter.parameters['State Color']);
    复制代码


    增加更多读取步骤,让插件获取到你的插件参数

    第2.5步
    JAVASCRIPT 代码
    1. //==============================
    2. // * addNewState
    3. //==============================
    4. var _alias_mog_bhud_addState = Game_Battler.prototype.addState
    5. Game_Battler.prototype.addState = function(stateId){
    6.     _alias_mog_bhud_addState.call(this, stateId);
    7.     this.need_refresh_bhud_states = true;
    8. };
    复制代码


    原函数对addNewState添加的更新不够全面,无法在状态覆盖导致回合数变化时自动更新,故这里选择直接在addstate阶段添加更新标记同时删去addNewState更改

    第三步
    JAVASCRIPT 代码
    [code]if(Imported.YEP_BuffsStatesCore){
    //==============================
    // * setStateCounter
    //==============================
    var _alias_mog_bhud_setStateCounter = Game_BattlerBase.prototype.setStateCounter
    Game_BattlerBase.prototype.setStateCounter = function(stateId, value){
            _alias_mog_bhud_setStateCounter.call(this, stateId, value);
            this.need_refresh_bhud_states = true;
            };
    }

    //==============================

    // * increaseBuff

    //==============================

    var _alias_mog_bhud_increaseBuff = Game_BattlerBase.prototype.increaseBuff

    Game_BattlerBase.prototype.increaseBuff = function(paramId){

        _alias_mog_bhud_increaseBuff.call(this, paramId);

        this.need_refresh_bhud_states = true;

    };
    //==============================

    // * decreaseBuff

    //==============================

    var _alias_mog_bhud_decreaseBuff = Game_BattlerBase.prototype.decreaseBuff

    Game_BattlerBase.prototype.decreaseBuff = function(paramId){

        _alias_mog_bhud_decreaseBuff.call(this, paramId);

        this.need_refresh_bhud_states = true;

    };
    //==============================

    // * eraseBuff

    //==============================

    var _alias_mog_bhud_eraseBuff = Game_BattlerBase.prototype.eraseBuff

    Game_BattlerBase.prototype.eraseBuff = function(paramId){

        _alias_mog_bhud_eraseBuff.call(this, paramId);

        this.need_refresh_bhud_states = true;

    };

    //==============================

    // * overwriteBuffTurns

    //==============================

    var _alias_mog_bhud_overwriteBuffTurns = Game_Battler.prototype.overwriteBuffTurns

    Game_Battler.prototype.overwriteBuffTurns = function(paramId, turns){

        _alias_mog_bhud_overwriteBuffTurns.call(this, paramId, turns);

        this.need_refresh_bhud_states = true;

    };

    //==============================

    // * updateBuffTurns

    //==============================

    var _alias_mog_bhud_updateBuffTurns = Game_Battler.prototype.updateBuffTurns

    Game_Battler.prototype.updateBuffTurns = function(){

        _alias_mog_bhud_updateBuffTurns.call(this);

        this.need_refresh_bhud_states = true;

    };

    Game_BattlerBase.prototype.getStateTurns = function(){
        var stateTurns = this.states().map(function(state){
            if(state.iconIndex  0){
                                    this._statusTooltipWindow.tooltipWindow()._battler = this._battler;
                                    this._statusTooltipWindow.updateStateIconTooltipWindow();
                            };
            };
            var _alias_wr_mogbattlehud_update_states2 = Battle_Hud.prototype.update_states2
            Battle_Hud.prototype.update_states2 = function(){
                    _alias_wr_mogbattlehud_update_states2.call(this);
                            x = TouchInput._mouseOverX;
                            y = TouchInput._mouseOverY;
                            if(this.is_hover_over_icon(x, y) && this._battler.allIcons().length > 0){
                                    this._statusTooltipWindow.tooltipWindow()._battler = this._battler;
                                    this._statusTooltipWindow.updateStateIconTooltipWindow();
                            };
            };

            Battle_Hud.prototype.is_hover_over_icon = function(x, y){
                    if(x >= this._state_icon.x &&
                            x = this._state_icon.y &&
                            y

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

    关闭

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2025-3-10 16:09 , Processed in 0.143959 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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