Project1

标题: 你好,请问哪位大神有自动战斗脚本? [打印本页]

作者: 18503097404    时间: 2017-7-24 23:05
标题: 你好,请问哪位大神有自动战斗脚本?
MV里面的怪物自动战斗AI不是很理想,而且希望是可以切换成手动,和自动的,希望有大大可以分享下,或者传授一些方法。
作者: 18503097404    时间: 2017-7-24 23:11
要的是玩家的自动战斗方法或者脚本。
作者: j296196585    时间: 2017-7-25 04:20
本帖最后由 j296196585 于 2017-7-25 04:22 编辑

JAVASCRIPT 代码复制
  1. /**
  2.  * Created by Gilles on 01.11.2015.
  3.  * @email: [email][email protected][/email]
  4.  */
  5.  
  6. /*:
  7.  * @plugindesc 自动战斗 1
  8.  * @author Gilles Meyer
  9.  *
  10.  * @param Auto Attack Text Party
  11.  * @desc The text which will appear in the Party command Menu
  12.  * @default Auto Attack
  13.  *
  14.  * @param Auto Attack Text Actor
  15.  * @desc The text which will appear in the Actor command Menu
  16.  * @default Auto Attack
  17.  *
  18.  *
  19.  *
  20.  */
  21.  
  22. (function() {
  23.  
  24.  
  25.   var parameters = PluginManager.parameters('AutoBattlePlugin');
  26.   var autoAttackPartyText = String(parameters['Auto Attack Text Party'] || "Auto Attack");
  27.   var autoAttackActorText = String(parameters['Auto Attack Text Actor'] || "Auto Attack");
  28.  
  29.   var getEnemyWithLowestHP = function(enemies) {
  30.     var enemyIndex = 0;
  31.     for(var i=1; i < enemies.length; i++) {
  32.       if(enemies[i].hp < enemies[enemyIndex].hp || enemies[enemyIndex].hp == 0) {
  33.         enemyIndex = i;
  34.       }
  35.     }
  36.     return enemyIndex;
  37.   };
  38.  
  39.  
  40.   Scene_Battle.prototype.commandAutoFight = function() {
  41.     this.selectNextCommand();
  42.     do {
  43.       this.commandAutoAttack.apply(this, arguments);
  44.     } while(BattleManager.isInputting());
  45.     this._actorCommandWindow.deactivate();
  46.   };
  47.  
  48.   Scene_Battle.prototype.commandAutoAttack = function() {
  49.     BattleManager.inputtingAction().setAttack();
  50.     var enemyIndex = getEnemyWithLowestHP(this._enemyWindow._enemies);
  51.     var action = BattleManager.inputtingAction();
  52.     action.setTarget(enemyIndex);
  53.     this.selectNextCommand();
  54.   };
  55.  
  56.  
  57.   // ## Autofight for Party
  58.   Window_PartyCommand.prototype.makeCommandList = function() {
  59.     this.addCommand(TextManager.fight,  'fight');
  60.     // Needs rework
  61.     this.addCommand(autoAttackPartyText,  'autofight');
  62.     this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape());
  63.   };
  64.  
  65.   var _Scene_Battle_createPartyCommandWindow = Scene_Battle.prototype.createPartyCommandWindow;
  66.   Scene_Battle.prototype.createPartyCommandWindow = function() {
  67.     _Scene_Battle_createPartyCommandWindow.apply(this, arguments);
  68.     this._partyCommandWindow.setHandler('autofight',  this.commandAutoFight.bind(this));
  69.   };
  70.  
  71.  
  72.   // ## Autofight for each Actor
  73.   var Scene_Battle_createActorCommandWindow = Scene_Battle.prototype.createActorCommandWindow;
  74.   Scene_Battle.prototype.createActorCommandWindow = function() {
  75.     Scene_Battle_createActorCommandWindow.call(this,arguments);
  76.     this._actorCommandWindow.setHandler('autoattack', this.commandAutoAttack.bind(this));
  77.   };
  78.  
  79.   var _Window_ActorCommand_makeCommandList = Window_ActorCommand.prototype.makeCommandList;
  80.   Window_ActorCommand.prototype.makeCommandList = function() {
  81.     if(this._actor) {
  82.       this.addCommand(autoAttackActorText, 'autoattack', this._actor.canAttack());
  83.     }
  84.     _Window_ActorCommand_makeCommandList.call(this, arguments);
  85.   };
  86.  
  87.  
  88. })();





JAVASCRIPT 代码复制
  1. #=============================================================================
  2. # Battle Auto Selection
  3. # LeBattleAutoSelection.js
  4. # By Lecode
  5. # Version 1.07
  6. #-----------------------------------------------------------------------------
  7. # TERMS OF USE
  8. #-----------------------------------------------------------------------------
  9. # - Credit required
  10. # - Keep this header
  11. # - Free for commercial use
  12. #=============================================================================
  13. */
  14. var Imported = Imported || {};
  15. Imported.Lecode_BattleAutoSelection = true;
  16. /*:
  17.  * @plugindesc 自动战斗2
  18.  * @author Lecode
  19.  * @version 1.06
  20.  *
  21.  * @help Skip the selection window when there is only one available enemy
  22.  * or one available ally.
  23. */
  24. //#=============================================================================
  25.  
  26. (function() {
  27.  
  28. /*-------------------------------------------------------------------------
  29. * Scene_Battle
  30. -------------------------------------------------------------------------*/
  31. //---- SelectEnemySelection
  32. var oldSelectEnemySelec_method = Scene_Battle.prototype.selectEnemySelection;
  33. Scene_Battle.prototype.selectEnemySelection = function() {
  34.     oldSelectEnemySelec_method.call(this);
  35.     if ( !this._enemyWindow.active ) { return; }
  36.     if (this._enemyWindow._enemies.length == 1) {
  37.             this._enemyWindow.processOk();
  38.     }
  39. };
  40.  
  41. //---- SelectActorSelection
  42. var oldSelectActorSelec_method = Scene_Battle.prototype.selectActorSelection;
  43. Scene_Battle.prototype.selectActorSelection = function() {
  44.     oldSelectActorSelec_method.call(this);
  45.     if ( !this._actorWindow.active ) { return; }
  46.         var action = BattleManager.inputtingAction();
  47.     if (action.isForUser() || (action.isForFriend() && action.isForAll())) {
  48.         this._actorWindow.select(BattleManager.actor().index());
  49.         this._actorWindow.processOk();
  50.     } else if (action.isForDeadFriend()) {
  51.                 if ($gameParty.deadMembers().length == 1) { this._actorWindow.processOk(); }
  52.         } else {
  53.                 if ($gameParty.aliveMembers().length == 1) { this._actorWindow.processOk(); }
  54.         }
  55. };
  56.  
  57.  
  58. })();

作者: 18503097404    时间: 2017-7-25 07:37
j296196585 发表于 2017-7-25 04:20
/**
* Created by Gilles on 01.11.2015.
* @email:

太感谢了!
作者: 18503097404    时间: 2017-7-25 09:31
j296196585 发表于 2017-7-25 04:20
/**
* Created by Gilles on 01.11.2015.
* @email:

请问下,这个自动攻击不是很智能,因为不放技能,有没那种可以放技能的?
作者: 18503097404    时间: 2017-7-25 10:28
j296196585 发表于 2017-7-25 04:20
/**
* Created by Gilles on 01.11.2015.
* @email:

能方便加个QQ吗?380617414
作者: 18503097404    时间: 2017-7-25 10:31
j296196585 发表于 2017-7-25 04:20
/**
* Created by Gilles on 01.11.2015.
* @email:

大神,应该是姿势不太对,希望能多和你取取经{:2_249:}
作者: j296196585    时间: 2017-7-25 11:03
18503097404 发表于 2017-7-25 10:31
大神,应该是姿势不太对,希望能多和你取取经

自动战斗确实不能使用技能 不过你要是用MOG 系统整合 就知道他的好了




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