不太喜欢默认的逃跑选项的位置在PartyCommand,于是把逃跑并入了ActorCommand跟攻击物品技能放在一起
使用Yanfly的插件的话,战斗开始的时候自动跳过partycommand那个战斗还是逃跑的菜单直接进入角色行动。
稍微改一下ActorCommand加入逃跑,并且屏蔽掉退回上一层菜单就可以了,修改如下
JAVASCRIPT 代码 - Scene_Battle.prototype.createActorCommandWindow = function(){
- this._actorCommandWindow = new Window_ActorCommand();
- this._actorCommandWindow.setHandler('attack', this.commandAttack.bind(this));
- this._actorCommandWindow.setHandler('skill', this.commandSkill.bind(this));
- this._actorCommandWindow.setHandler('guard', this.commandGuard.bind(this));
- this._actorCommandWindow.setHandler('item', this.commandItem.bind(this));
- // this._actorCommandWindow.setHandler('cancel', this.selectPreviousCommand.bind(this));
- // 加入逃跑选项
- this._actorCommandWindow.setHandler('escape', this.commandEscape.bind(this));
- this.addWindow(this._actorCommandWindow);
- //this._actorCommandWindow.opacity = 150;
- };
- Window_ActorCommand.prototype.makeCommandList = function(){
- if(this._actor){
- this.addAttackCommand();
- this.addSkillCommands();
- this.addGuardCommand();
- this.addItemCommand();
- //加入逃跑选项
- this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape());
- }
- };
复制代码
回合制的时候没有任何问题,然而ATB的模式问题来了。
如果逃跑失败的话,atb就不会继续更新,然后战斗就停留在逃跑失败的状态无法继续。翻了半天js也没找到究竟是哪个地方的问题。默认的在partycommand里面逃跑没有这个问题。应该是turn的计算哪里错了导致没有继续。这次代码一层套一层感觉很难找到哪里有问题。不知道有木有熟悉Yanfly的ATB的菊苣指点一下。。。
Yanfly的逃跑的函数是这个
JAVASCRIPT 代码 - BattleManager.processEscapeATB = function(){
- $gameParty.performEscape();
- SoundManager.playEscape();
- var success = this._preemptive ? true : (Math.random() < this._escapeRatio);
- if(success){
- $gameParty.removeBattleStates();
- this.displayEscapeSuccessMessage();
- this._escaped = true;
- this.processAbort();
- }else{
- this.displayEscapeFailureMessage();
- this._escapeRatio += this._escapeFailBoost;
- $gameParty.clearActions();
- this.startTurn();
- this.processFailEscapeATB();
- }
- return success;
- };
复制代码
然后那个默认的startTurn在ATB模式下是直接被跳过了,没有搞懂到底咋继续的。。。
JAVASCRIPT 代码 - Yanfly.ATB.BattleManager_startTurn = BattleManager.startTurn;
- BattleManager.startTurn = function(){
- if(this.isATB())return;
- Yanfly.ATB.BattleManager_startTurn.call(this);
- };
复制代码
本帖来自P1论坛作者doranikofu,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址: https://rpg.blue/forum.php?mod=viewthread&tid=385854 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。 |