Project1

标题: 怎么把这段“自动战斗”脚本里的英文按钮改成“自动”... [打印本页]

作者: 索里    时间: 2015-11-17 14:16
标题: 怎么把这段“自动战斗”脚本里的英文按钮改成“自动”...
  1. /**
  2. * Created by Gilles on 01.11.2015.
  3. * @email: [email protected]
  4. */

  5. /*:
  6. * @plugindesc Allows Auto Attack in Battle. The players will always choose the enemy with the lowest hp
  7. * @author Gilles Meyer
  8. *
  9. * @param Auto Attack Text Party
  10. * @desc The text which will appear in the Party command Menu
  11. * @default Auto Attack
  12. *
  13. * @param Auto Attack Text Actor
  14. * @desc The text which will appear in the Actor command Menu
  15. * @default Auto Attack
  16. *
  17. *
  18. *
  19. */

  20. (function() {


  21.   var parameters = PluginManager.parameters('AutoBattlePlugin');
  22.   var autoAttackPartyText = String(parameters['Auto Attack Text Party'] || "Auto Attack");
  23.   var autoAttackActorText = String(parameters['Auto Attack Text Actor'] || "Auto Attack");

  24.   var getEnemyWithLowestHP = function(enemies) {
  25.     var enemyIndex = 0;
  26.     for(var i=1; i < enemies.length; i++) {
  27.       if(enemies[i].hp < enemies[enemyIndex].hp || enemies[enemyIndex].hp == 0) {
  28.         enemyIndex = i;
  29.       }
  30.     }
  31.     return enemyIndex;
  32.   };

  33.   
  34.   Scene_Battle.prototype.commandAutoFight = function() {
  35.     this.selectNextCommand();
  36.     do {
  37.       this.commandAutoAttack.apply(this, arguments);
  38.     } while(BattleManager.isInputting());
  39.     this._actorCommandWindow.deactivate();
  40.   };

  41.   Scene_Battle.prototype.commandAutoAttack = function() {
  42.     BattleManager.inputtingAction().setAttack();
  43.     var enemyIndex = getEnemyWithLowestHP(this._enemyWindow._enemies);
  44.     var action = BattleManager.inputtingAction();
  45.     action.setTarget(enemyIndex);
  46.     this.selectNextCommand();
  47.   };


  48.   // ## Autofight for Party
  49.   Window_PartyCommand.prototype.makeCommandList = function() {
  50.     this.addCommand(TextManager.fight,  'fight');
  51.     // Needs rework
  52.     this.addCommand(autoAttackPartyText,  'autofight');
  53.     this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape());
  54.   };

  55.   var _Scene_Battle_createPartyCommandWindow = Scene_Battle.prototype.createPartyCommandWindow;
  56.   Scene_Battle.prototype.createPartyCommandWindow = function() {
  57.     _Scene_Battle_createPartyCommandWindow.apply(this, arguments);
  58.     this._partyCommandWindow.setHandler('autofight',  this.commandAutoFight.bind(this));
  59.   };


  60.   // ## Autofight for each Actor
  61.   var Scene_Battle_createActorCommandWindow = Scene_Battle.prototype.createActorCommandWindow;
  62.   Scene_Battle.prototype.createActorCommandWindow = function() {
  63.     Scene_Battle_createActorCommandWindow.call(this,arguments);
  64.     this._actorCommandWindow.setHandler('autoattack', this.commandAutoAttack.bind(this));
  65.   };

  66.   var _Window_ActorCommand_makeCommandList = Window_ActorCommand.prototype.makeCommandList;
  67.   Window_ActorCommand.prototype.makeCommandList = function() {
  68.     if(this._actor) {
  69.       this.addCommand(autoAttackActorText, 'autoattack', this._actor.canAttack());
  70.     }
  71.     _Window_ActorCommand_makeCommandList.call(this, arguments);
  72.   };


  73. })();
复制代码

QQ截图20151117141210.png (824.39 KB, 下载次数: 38)

QQ截图20151117141210.png

QQ截图20151117141058.png (48.14 KB, 下载次数: 38)

QQ截图20151117141058.png

作者: dc1988123    时间: 2015-11-17 17:11
var autoAttackPartyText = String(parameters['Auto Attack Text Party'] || "Auto Attack");
var autoAttackActorText = String(parameters['Auto Attack Text Actor'] || "Auto Attack");
应该是这个了,Auto Attack改一下名字,试试看吧。

作者: 索里    时间: 2015-11-20 16:40
dc1988123 发表于 2015-11-17 17:11
var autoAttackPartyText = String(parameters['Auto Attack Text Party'] || "Auto Attack");
var autoAtt ...

多谢,已经解决,但是这个脚本和YEP的ATB脚本冲突
作者: 索里    时间: 2015-12-5 02:45
dc1988123 发表于 2015-11-17 17:11
var autoAttackPartyText = String(parameters['Auto Attack Text Party'] || "Auto Attack");
var autoAtt ...

那么问题来了,新手不会将其调到战斗显示的界面......




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1