artyrambles

Arty's Post Battle Common Events

Oct 29th, 2016
704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Arty's Post Battle Common Events
  3. // by Arty
  4. // Date: 29.10.2016
  5. //=============================================================================
  6.  
  7.  
  8. /*:
  9.  * @plugindesc [v.1.0] This plugin allows you to run a common event after the battle ended.
  10.  * @author Arty
  11.  *
  12.  * @param Common Event Victory    
  13.  * @desc The ID of the Common Event that should be run when the battle is won.      
  14.  * @default 0  
  15.  *
  16.  * @param Common Event Defeat    
  17.  * @desc The ID of the Common Event that should be run when the battle is lost.      
  18.  * @default 0
  19.  *
  20.  * @param Common Event Abort    
  21.  * @desc The ID of the Common Event that should be run when the battle is aborted.      
  22.  * @default 0
  23.  *
  24.  * @param Common Event Always  
  25.  * @desc The ID of the Common Event that should be run after every battle.      
  26.  * @default 0
  27.  *
  28.  * @help
  29.  * ============================================================================
  30.  * How To Use
  31.  * ============================================================================
  32.  *
  33.  * Pretty much plug and play. Just set the parameters to the IDs of the Common
  34.  * Events that you want to run (without leading zeroes) and you're good to go.
  35.  * Make sure that you save the file under the filename "Arty_PostBattleCommonEvent.js"
  36.  * or else it won't work.
  37.  *
  38.  * ============================================================================
  39.  * Terms Of Use
  40.  * ============================================================================
  41.  *
  42.  * You can use this plugin for free and commercial projects as long as you
  43.  * credit me.
  44.  *
  45.  */
  46.  
  47.  //============================================================================
  48.  
  49.  var Imported = Imported || {};
  50.  Imported.Arty_PostBattleCommonEvent = true;
  51.  
  52.  var Arty = Arty || {};
  53.  
  54.  Arty.Parameters = PluginManager.parameters('Arty_PostBattleCommonEvent');
  55.  Arty.Param = Arty.Param || {};
  56.  Arty.Param.CommonEventVictory = String(Arty.Parameters["Common Event Victory"]);
  57.  Arty.Param.CommonEventDefeat = String(Arty.Parameters["Common Event Defeat"]);
  58.  Arty.Param.CommonEventAbort = String(Arty.Parameters["Common Event Abort"]);
  59.  Arty.Param.CommonEventAlways = String(Arty.Parameters["Common Event Always"]);
  60.  
  61.  Arty.Battle_Manager_Victory = BattleManager.processVictory;
  62.  BattleManager.processVictory = function() {
  63.     Arty.Battle_Manager_Victory.call(this);
  64.     $gameTemp.reserveCommonEvent(Arty.Param.CommonEventVictory);
  65.  };
  66.  
  67.  Arty.Battle_Manager_Defeat = BattleManager.processDefeat;
  68.  BattleManager.processDefeat = function() {
  69.     Arty.Battle_Manager_Defeat.call(this);
  70.     $gameTemp.reserveCommonEvent(Arty.Param.CommonEventDefeat);
  71.  };
  72.  
  73.  Arty.Battle_Manager_Abort = BattleManager.processAbort;
  74.  BattleManager.processAbort = function() {
  75.     Arty.Battle_Manager_Abort.call(this);
  76.     $gameTemp.reserveCommonEvent(Arty.Param.CommonEventAbort);
  77.  };
  78.  
  79.  Arty.Battle_Manager_Always = BattleManager.endBattle;
  80.  BattleManager.endBattle = function(result) {
  81.      Arty.Battle_Manager_Always.call(this, result);
  82.      $gameTemp.reserveCommonEvent(Arty.Param.CommonEventAlways);
  83. };
Advertisement
Add Comment
Please, Sign In to add comment