搜索附件  
同能RPG制作大师 附件中心 同能RM技术讨论区 RPG Maker MV 讨论区 【插件改】为MOG_BattleHud添加状态回合数: MOG_BattleHud.zip

【插件改】为MOG_BattleHud添加状态回合数: MOG_BattleHud.zip

 

【插件改】为MOG_BattleHud添加状态回合数:
用过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

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

GMT+8, 2024-5-20 13:47 , Processed in 0.040668 second(s), 17 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

返回顶部