artyrambles

Highest Actor Level Plugin by Arty

Oct 23rd, 2016
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Arty - Highest Actor Level
  3. // Arty_HighestActorLevel.js
  4. // by: Arty
  5. //=============================================================================
  6.  
  7. //=============================================================================
  8.  /*:
  9.  * @plugindesc Assigns the party's highest level to a variable.
  10.  * @author Arty
  11.  * @param Variable
  12.  * @desc ID of the variable that you want to save the level to.
  13.  * @default 1
  14.  *
  15.  * @help
  16.  * ============================================================================
  17.  * Introduction
  18.  * ============================================================================
  19.  *
  20.  * This plugin assigns the party's highest actor level to a variable.
  21.  * That's all.
  22.  * It's up to you what you do with it - maybe check in a conditional branch
  23.  * if it's below or above a certain level and do something with that info.
  24.  *
  25.  * ============================================================================
  26.  * Usage
  27.  * ============================================================================
  28.  *
  29.  * Use the plugin command
  30.  *
  31.  * GetPartyLevel
  32.  *
  33.  * to assign the highest level to the variable you chose in the plugin setup.
  34.  *
  35.  * ============================================================================
  36.  * Support
  37.  * ============================================================================
  38.  *
  39.  * This should be pretty straightforward...if something doesn't work,
  40.  * just tell me and I'll try to help.
  41.  *
  42.  * ============================================================================
  43.  * Note
  44.  * ============================================================================
  45.  *
  46.  * You can use this plugin in your free and commercial projects as long as
  47.  * you credit me. Please don't remove the header or claim you wrote this.
  48.  *
  49.  * ============================================================================
  50.  * Changelog
  51.  * ============================================================================
  52.  *
  53.  * Version 1.0:
  54.  * - release
  55.  *
  56.  */
  57. //=============================================================================
  58.  
  59. (function() {
  60.   var parameters = PluginManager.parameters('Arty_HighestActorLevel');
  61.    
  62.     arty_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  63.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  64.         arty_pluginCommand.call(this, command, args);
  65.         if (command === "GetPartyLevel")
  66.         {
  67.             var partysize = $gameParty.allMembers().length;
  68.             var temp = 0;
  69.             var tempnew = 0;
  70.             var result = 0;
  71.             var actorID = 0;
  72.             for (i = 0; i < partysize; i++)
  73.             {
  74.                 actorID = $gameParty.allMembers()[i].actorId();
  75.                 tempnew = $gameActors.actor(actorID).level;
  76.                 if (tempnew > temp)
  77.                 {
  78.                     temp = tempnew;
  79.                 }
  80.             }
  81.             result = temp;
  82.             $gameVariables.setValue(parameters["Variable"], result);
  83.         }
  84.     };
  85.   })();
Advertisement
Add Comment
Please, Sign In to add comment