设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 4164|回复: 1
打印 上一主题 下一主题

[已经解决] 逃跑菜单并入ActorCommand的问题

[复制链接]

Lv2.观梦者

梦石
0
星屑
676
在线时间
224 小时
注册时间
2006-12-7
帖子
839
跳转到指定楼层
1
发表于 2015-11-18 14:51:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
不太喜欢默认的逃跑选项的位置在PartyCommand,于是把逃跑并入了ActorCommand跟攻击物品技能放在一起

使用Yanfly的插件的话,战斗开始的时候自动跳过partycommand那个战斗还是逃跑的菜单直接进入角色行动。
稍微改一下ActorCommand加入逃跑,并且屏蔽掉退回上一层菜单就可以了,修改如下

JAVASCRIPT 代码复制
  1. Scene_Battle.prototype.createActorCommandWindow = function() {
  2.     this._actorCommandWindow = new Window_ActorCommand();
  3.     this._actorCommandWindow.setHandler('attack', this.commandAttack.bind(this));
  4.     this._actorCommandWindow.setHandler('skill',  this.commandSkill.bind(this));
  5.     this._actorCommandWindow.setHandler('guard',  this.commandGuard.bind(this));
  6.     this._actorCommandWindow.setHandler('item',   this.commandItem.bind(this));
  7. //    this._actorCommandWindow.setHandler('cancel', this.selectPreviousCommand.bind(this));
  8. // 加入逃跑选项
  9.     this._actorCommandWindow.setHandler('escape', this.commandEscape.bind(this));
  10.     this.addWindow(this._actorCommandWindow);
  11.         //this._actorCommandWindow.opacity = 150;
  12.  
  13. };
  14.  
  15. Window_ActorCommand.prototype.makeCommandList = function() {
  16.     if (this._actor) {
  17.         this.addAttackCommand();
  18.         this.addSkillCommands();
  19.         this.addGuardCommand();
  20.         this.addItemCommand();
  21. //加入逃跑选项
  22.                 this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape());
  23.     }
  24. };


回合制的时候没有任何问题,然而ATB的模式问题来了。
如果逃跑失败的话,atb就不会继续更新,然后战斗就停留在逃跑失败的状态无法继续。翻了半天js也没找到究竟是哪个地方的问题。默认的在partycommand里面逃跑没有这个问题。应该是turn的计算哪里错了导致没有继续。这次代码一层套一层感觉很难找到哪里有问题。不知道有木有熟悉Yanfly的ATB的菊苣指点一下。。。

Yanfly的逃跑的函数是这个
JAVASCRIPT 代码复制
  1. BattleManager.processEscapeATB = function() {
  2.   $gameParty.performEscape();
  3.   SoundManager.playEscape();
  4.   var success = this._preemptive ? true : (Math.random() < this._escapeRatio);
  5.   if (success) {
  6.       $gameParty.removeBattleStates();
  7.       this.displayEscapeSuccessMessage();
  8.       this._escaped = true;
  9.       this.processAbort();
  10.   } else {
  11.       this.displayEscapeFailureMessage();
  12.       this._escapeRatio += this._escapeFailBoost;
  13.       $gameParty.clearActions();
  14.       this.startTurn();
  15.       this.processFailEscapeATB();
  16.   }
  17.   return success;
  18. };


然后那个默认的startTurn在ATB模式下是直接被跳过了,没有搞懂到底咋继续的。。。
JAVASCRIPT 代码复制
  1. Yanfly.ATB.BattleManager_startTurn = BattleManager.startTurn;
  2. BattleManager.startTurn = function() {
  3.     if (this.isATB()) return;
  4.     Yanfly.ATB.BattleManager_startTurn.call(this);
  5. };

Lv1.梦旅人

梦石
0
星屑
65
在线时间
385 小时
注册时间
2007-7-27
帖子
4106

开拓者

2
发表于 2015-12-7 22:13:33 | 只看该作者
本帖最后由 trentswd 于 2015-12-7 22:36 编辑

原因是
actor->party  party->actor 菜单切换的时候做了一些处理
所以要把这些处理给弄好
JAVASCRIPT 代码复制
  1. Scene_Battle.prototype.createActorCommandWindow = function() {
  2.   this._actorCommandWindow = new Window_ActorCommand();
  3.   this._actorCommandWindow.setHandler('attack', this.commandAttack.bind(this));
  4.   this._actorCommandWindow.setHandler('skill', this.commandSkill.bind(this));
  5.   this._actorCommandWindow.setHandler('guard', this.commandGuard.bind(this));
  6.   this._actorCommandWindow.setHandler('item', this.commandItem.bind(this));
  7.   //    this._actorCommandWindow.setHandler('cancel', this.selectPreviousCommand.bind(this));
  8.   // 加入逃跑选项
  9.   this._actorCommandWindow.setHandler('escape', this.commandEscapeActor.bind(this));
  10.   this.addWindow(this._actorCommandWindow);
  11.   //this._actorCommandWindow.opacity = 150;
  12.  
  13. };
  14.  
  15. Scene_Battle.prototype.commandEscapeActor = function() {
  16.   var actorIndex = BattleManager._actorIndex;
  17.   BattleManager.selectNextCommand();
  18.   BattleManager._actorIndex = actorIndex;
  19.   this.commandEscape();
  20. }
  21.  
  22. Window_ActorCommand.prototype.makeCommandList = function() {
  23.   if (this._actor) {
  24.     this.addAttackCommand();
  25.     this.addSkillCommands();
  26.     this.addGuardCommand();
  27.     this.addItemCommand();
  28.     //加入逃跑选项
  29.     this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape());
  30.   }
  31. };

点评

菊苣实在是太强大了!  发表于 2015-12-8 11:09

评分

参与人数 2星屑 +60 梦石 +1 收起 理由
余烬之中 + 1 菊苣实在是太强大了!
doranikofu + 60 认可答案

查看全部评分

吸吸
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-11 21:09

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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