Advertisement
Maliki79

MalCommandequip_edits

Jun 21st, 2016
804
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Maliki's Equip Battle Command edits
  3. // MalCommandequip_edits.js
  4. // version 1.0
  5. //=============================================================================
  6. /*:  
  7.  * @plugindesc Fixes equip pick crash issue in original plugin and adds turn loss option.
  8.  * @author Maliki79 (original plugin by Jeneeus Guruman)
  9.  * @param CooldownState
  10.  * @desc ID of state to add to actors to facilitate Equip changing costing a turn.  Leave 0 to not add state.
  11.  * Default: 0
  12.  * @default 0
  13.  *
  14.  * @help You need two steps to use this plugin:
  15.  * 1: If you have not done so already, install the commandequip.js plugin
  16.  *    currently found at http://forums.rpgmakerweb.com/index.php?/topic/49324-equip-battle-command/
  17.  * 2: If you want to impose a used turn when changing equips, you'll need to first make a cooldown state.
  18.  *    It will need to restrict movement, remove at battle end, and auto cure at turn end, duration of 1 - 1.
  19.  *    You may also want to remove the "state removal" text to keep the transition smoother.
  20.  * Note that you must keep the name of this plugin MalCommandequip_edits.js.
  21.  */
  22.  
  23. var Mal = Mal || {};
  24.  
  25. Mal.Parameters = PluginManager.parameters('MalCommandequip_edits');
  26. Mal.Param = Mal.Param || {};
  27.  
  28. Mal.Param.coolD = (Mal.Parameters['CooldownState']);
  29.  
  30. var MalcommandEquipment = Scene_Battle.prototype.commandEquipment;
  31. Scene_Battle.prototype.commandEquipment = function() {
  32.     MalcommandEquipment.call(this);
  33.     BattleManager.actor()._origEquips = [];
  34.     for (i = 0; i < BattleManager.actor()._equips.length; i++ ) {
  35.     if(BattleManager.actor()._equips[i]) {
  36.     BattleManager.actor()._origEquips[i] = BattleManager.actor()._equips[i]._itemId;
  37.     } else {
  38.     BattleManager.actor()._origEquips[i] = 0;
  39.     }
  40.     }
  41. };
  42.  
  43. Scene_Battle.prototype.commandEquip = function() {
  44.     this._slotWindow.refresh();
  45.     this._slotWindow.activate();
  46.     this._slotWindow.select(0);
  47. };
  48.  
  49. Scene_Battle.prototype.equipCheck = function() {
  50. for (i = 0; i < BattleManager.actor()._equips.length; i++ ) {
  51.  if (BattleManager.actor()._origEquips[i] != BattleManager.actor()._equips[i]._itemId) return false;
  52. }
  53. return true;
  54. }
  55.  
  56. var MalEquipCancel = Scene_Battle.prototype.commandEquipmentCancel;
  57. Scene_Battle.prototype.commandEquipmentCancel = function() {
  58.     MalEquipCancel.call(this);
  59.     if(Mal.Param.coolD != 0) {
  60.     if(!this.equipCheck()) {
  61.     BattleManager.actor().addState(Number(Mal.Param.coolD) || 0);
  62.     BattleManager.selectNextCommand();
  63.     this.changeInputWindow();
  64.     BattleManager._statusWindow.refresh();
  65.     console.log(BattleManager.actor());
  66.     if(!BattleManager.actor()) {
  67.     BattleManager.startTurn();
  68.     this._actorCommandWindow.deactivate();
  69.     }
  70.     }
  71.     }
  72. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement