Advertisement
Rafael_Sol_Maker

RSM's Customize Stock Battlebacks MV v1.1 [EN]

May 25th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // RSM_CustomizeStockBattlebacks.js
  3. // Rafael_Sol_Maker's Customize Stock Battlebacks MV v1.1.
  4. // This work is licensed under a Creative Commons Attribution 4.0 International License.
  5. //=============================================================================
  6.  
  7. //Changelog: ////////////////////////////////////////////////////////////////////////////
  8. // 1.0 -> 1.1: * Compatibility with functions of Plugin Manager for RPG Maker mV 1.5+.
  9. //             * Possibility to easily change default battleback as well.
  10. //             * Now part of Imported and parameters can be found in RSMTweaks
  11. /////////////////////////////////////////////////////////////////////////////////////////
  12.  
  13. // Here we go again...
  14. var Imported = Imported || {};
  15. var RSMTweaks = RSMTweaks || {};
  16. Imported.RSM_Battlebacks = true;
  17. Imported.RSM_Battlebacks.version = 1.1;
  18. RSMTweaks.Battlebacks = RSMTweaks.Battlebacks || {};
  19.  
  20. /*:
  21.  * @plugindesc RSM's Customize Stock Battlebacks MV v1.1.
  22.  * Allows you to customize battlebacks. Requires RPG Maker 1.5 or newer.
  23.  * @author Rafael_Sol_Maker (www.condadobraveheart.com/forum)
  24.  *
  25.  * @param default
  26.  * @text Default Battlebacks
  27.  * @desc The battlebacks files in default cases.
  28.  * @type struct<DualBattleback>
  29.  * @default {"battleback1":"Grassland","battleback2":"Grassland"}
  30.  *
  31.  * @param ship
  32.  * @text Ship Battlebacks
  33.  * @desc The battlebacks files for boat and ship (in vehicle).
  34.  * @type struct<DualBattleback>
  35.  * @default {"battleback1":"Ship","battleback2":"Ship"}
  36.  *
  37.  * @param grassland
  38.  * @text Grassland Battlebacks
  39.  * @desc The battlebacks files for normal grasslands.
  40.  * @type struct<DualBattleback>
  41.  * @default {"battleback1":"Grassland","battleback2":"Grassland"}
  42.  *
  43.  * @param wasteland
  44.  * @text Wasteland Battlebacks
  45.  * @desc The battlebacks files for wastelands.
  46.  * @type struct<DualBattleback>
  47.  * @default {"battleback1":"Wasteland","battleback2":"Wasteland"}
  48.  *
  49.  * @param desert
  50.  * @text Desert Battlebacks
  51.  * @desc The battlebacks files for deserts.
  52.  * @type struct<DualBattleback>
  53.  * @default {"battleback1":"Desert","battleback2":"Desert"}
  54.  *
  55.  * @param snowfield
  56.  * @text Snowfield Battlebacks
  57.  * @desc The battlebacks files for snowfields.
  58.  * @type struct<DualBattleback>
  59.  * @default {"battleback1":"Snowfield","battleback2":"Snowfield"}
  60.  *
  61.  * @param clouds
  62.  * @text Cloud Battlebacks
  63.  * @desc The battlebacks files for clouds.
  64.  * @type struct<DualBattleback>
  65.  * @default {"battleback1":"Clouds","battleback2":"Clouds"}
  66.  *
  67.  * @param poisonswamp
  68.  * @text Poison Swamp Battlebacks
  69.  * @desc The battlebacks files for poison swamps.
  70.  * @type struct<DualBattleback>
  71.  * @default {"battleback1":"PoisonSwamp","battleback2":"PoisonSwamp"}
  72.  *
  73.  * @param lava
  74.  * @text Lava Battlebacks
  75.  * @desc The (3) battlebacks files for lava. See help for details on this one.
  76.  * @type struct<LavaBattleback>
  77.  * @default {"battleback":"Lava","battlefloor1":"Lava1","battlefloor2":"Lava2"}
  78.  *
  79.  * @param forest
  80.  * @text Forest Superposition
  81.  * @desc The battleback file for forest superposition (for Grassland).
  82.  * @type file
  83.  * @dir img/battlebacks2
  84.  * @default Forest
  85.  *
  86.  * @param cliff
  87.  * @text Cliff Superposition
  88.  * @desc The battleback file for cliff superposition (for Grassland).
  89.  * @type file
  90.  * @dir img/battlebacks2
  91.  * @default Cliff
  92.  *
  93.  * @param dirtfield
  94.  * @text Dirt Field Superposition
  95.  * @desc The battleback file for dirtfield superposition floor (for Wasteland).
  96.  * @type file
  97.  * @dir img/battlebacks1
  98.  * @default DirtField
  99.  *
  100.  * @help
  101.  * This Plugin has one command available:
  102.  *   ChangeBattleback <type> filename
  103.  *   # Changes the chosen battleback for the specified file.
  104.  *
  105.  * <type> can be: defaultX, grasslandX, shipX, wastelandX, desertX,
  106.  * snowfieldX, cloudsX, poisonswampX OR lavafloorX.
  107.  * Where X you put 1 or 2 to decide which one you would like to change.
  108.  * The non-numbered battlebacks are lavaback, forest, dirtfield OR cliff.
  109.  * Filename will be your image. Example: ChangeBattleback desert1 Arabia
  110.  *
  111.  * Depending on context, the folder where it will come from will be different.
  112.  * Most of battlebacks ending in 1 will be from battlebacks1 (floors)
  113.  * And ending in 2 will be the background (clouds, mountains, etcetera.)
  114.  * For the exceptions and non-numbered ones, please continue reading.
  115.  *
  116.  * Please repair that the non-numbered are the ones that will be used for
  117.  * superposition in special occasions (battlebacks2 folder).
  118.  * For lava, there are 2 "floors" (battlebacks1 folder), lavafloor1 &
  119.  * lavafloor2, and only one "wall" or "back", lavaback (battlebacks2 folder).
  120.  *
  121.  * The working of the original system was not changed at all. All regions are
  122.  * hardcoded and relative to the default tileset. In a future version I would
  123.  * allow this to be changed and you will  * be able to apply any set of
  124.  * battlebacks to any tileset you want. Please stay tuned!
  125.  *
  126.  * If you have any questions, criticisms or suggestions, please let me know.
  127.  * Best regards,
  128.  *                                                          ~RAFAEL_SOL_MAKER
  129.  */
  130.  
  131.  /*~struct~DualBattleback:
  132.  
  133.  * @param battleback1
  134.  * @text Battleback 01 (Floor)
  135.  * @type file
  136.  * @dir img/battlebacks1
  137.  *
  138.  * @param battleback2
  139.  * @text Battleback 01 (Back)
  140.  * @type file
  141.  * @dir img/battlebacks2
  142. */
  143.  
  144.  /*~struct~LavaBattleback:
  145.  *
  146.  * @param battleback
  147.  * @text Lava Back
  148.  * @type file
  149.  * @dir img/battlebacks2
  150.  *
  151.  * @param battlefloor1
  152.  * @text Ground Floor
  153.  * @type file
  154.  * @dir img/battlebacks1
  155.  *
  156.  * @param battlefloor2
  157.  * @text Lava Floor
  158.  * @type file
  159.  * @dir img/battlebacks1
  160. */
  161.  
  162. /*
  163. #==============================================================================
  164. # ** PARAMETERS, COMMANDS & MISC
  165. #------------------------------------------------------------------------------
  166. #  Let's handle these values first
  167. #==============================================================================
  168. */
  169.  
  170. (function() {
  171.  
  172.   // First let's have the parameters
  173.   var parameters = PluginManager.parameters('RSM_CustomizeStockBattlebacks');
  174.   RSMTweaks.Battlebacks.default = JSON.parse(parameters['default']);
  175.   RSMTweaks.Battlebacks.grassland = JSON.parse(parameters['grassland']);
  176.   RSMTweaks.Battlebacks.ship = JSON.parse(parameters['ship']);
  177.   RSMTweaks.Battlebacks.wasteland = JSON.parse(parameters['wasteland']);
  178.   RSMTweaks.Battlebacks.desert = JSON.parse(parameters['desert']);
  179.   RSMTweaks.Battlebacks.snowfield = JSON.parse(parameters['snowfield']);
  180.   RSMTweaks.Battlebacks.clouds = JSON.parse(parameters['clouds']);
  181.   RSMTweaks.Battlebacks.poisonswamp = JSON.parse(parameters['poisonswamp']);
  182.   RSMTweaks.Battlebacks.lava = JSON.parse(parameters['lava']);
  183.   RSMTweaks.Battlebacks.forest = parameters['forest'] || 'Forest';
  184.   RSMTweaks.Battlebacks.cliff = parameters['cliff'] || 'Cliff';
  185.   RSMTweaks.Battlebacks.dirtfield = parameters['dirtfield'] || 'Dirtfield';
  186.  
  187.   // Dealing with our commands here
  188.   var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  189.   Game_Interpreter.prototype.pluginCommand = function(command, args) {
  190.     _Game_Interpreter_pluginCommand.call(this, command, args);
  191.  
  192.     if (command === 'ChangeBattleback') {
  193.     // Plugin Commands Goes Here
  194.       switch (args[0]) {
  195.       case 'default1':
  196.         RSMTweaks.Battlebacks.default.battleback1 = args[1];
  197.         break;
  198.       case 'default2':
  199.         RSMTweaks.Battlebacks.default.battleback2 = args[1];
  200.         break;
  201.       case 'grassland1':
  202.         RSMTweaks.Battlebacks.grassland.battleback1 = args[1];
  203.         break;
  204.       case 'grassland2':
  205.         RSMTweaks.Battlebacks.grassland.battleback2 = args[1];
  206.         break;
  207.       case 'ship1':
  208.         RSMTweaks.Battlebacks.ship.battleback1 = args[1];
  209.         break;
  210.       case 'ship2':
  211.         RSMTweaks.Battlebacks.ship.battleback2 = args[1];
  212.         break;
  213.       case 'wasteland1':
  214.         RSMTweaks.Battlebacks.wasteland.battleback1 = args[1];
  215.         break;
  216.       case 'wasteland2':
  217.         RSMTweaks.Battlebacks.wasteland.battleback2 = args[1];
  218.         break;
  219.       case 'desert1':
  220.         RSMTweaks.Battlebacks.desert.battleback1 = args[1];
  221.         break;
  222.       case 'desert2':
  223.         RSMTweaks.Battlebacks.desert.battleback2 = args[1];
  224.         break;
  225.       case 'snowfield1':
  226.         RSMTweaks.Battlebacks.snowfield.battleback1 = args[1];
  227.         break;
  228.       case 'snowfield2':
  229.         RSMTweaks.Battlebacks.snowfield.battleback2 = args[1];
  230.         break;
  231.       case 'clouds1':
  232.         RSMTweaks.Battlebacks.clouds.battleback1 = args[1];
  233.         break;
  234.       case 'clouds2':
  235.         RSMTweaks.Battlebacks.clouds.battleback2 = args[1];
  236.         break;
  237.       case 'poisonswamp1':
  238.         RSMTweaks.Battlebacks.poisonswamp.battleback1 = args[1];
  239.         break;
  240.       case 'poisonswamp2':
  241.         RSMTweaks.Battlebacks.poisonswamp.battleback2 = args[1];
  242.         break;
  243.       case 'lavafloor1':
  244.         RSMTweaks.Battlebacks.lava.battlefloor1 = args[1];
  245.         break;
  246.       case 'lavafloor2':
  247.         RSMTweaks.Battlebacks.lava.battlefloor2 = args[1];
  248.         break;
  249.       case 'lavaback':
  250.         RSMTweaks.Battlebacks.lava.battleback = args[1];
  251.         break;
  252.       case 'forest':
  253.         RSMTweaks.Battlebacks.forest = args[1];
  254.         break;
  255.       case 'cliff':
  256.         RSMTweaks.Battlebacks.cliff = args[1];
  257.         break;
  258.       case 'dirtfield':
  259.         RSMTweaks.Battlebacks.dirtfield = args[1];
  260.         break;
  261.       };
  262.     };
  263.   };
  264.  
  265. /*
  266. #==============================================================================
  267. # ** Spriteset_Battle
  268. #------------------------------------------------------------------------------
  269. #  Handles the sprites in battle, duh.
  270. #==============================================================================
  271. */
  272.   Spriteset_Battle.prototype.terrainBattleback1Name = function(type) {
  273.     switch (type) {
  274.     case 24: case 25:
  275.       return RSMTweaks.Battlebacks.wasteland.battleback1;
  276.     case 26: case 27:
  277.       return RSMTweaks.Battlebacks.dirtfield;
  278.     case 32: case 33:
  279.       return RSMTweaks.Battlebacks.desert.battleback1;
  280.     case 34:
  281.       return RSMTweaks.Battlebacks.lava.battlefloor1;
  282.     case 35:
  283.       return RSMTweaks.Battlebacks.lava.battlefloor2;
  284.     case 40: case 41:
  285.       return RSMTweaks.Battlebacks.snowfield.battleback1;
  286.     case 42:
  287.       return RSMTweaks.Battlebacks.clouds.battleback1;
  288.     case 4: case 5:
  289.       return RSMTweaks.Battlebacks.poisonswamp.battleback1;
  290.     default:
  291.       return null;
  292.     };
  293.   };
  294.  
  295.   Spriteset_Battle.prototype.terrainBattleback2Name = function(type) {
  296.     switch (type) {
  297.     case 20: case 21:
  298.       return RSMTweaks.Battlebacks.forest;
  299.     case 22: case 30: case 38:
  300.       return RSMTweaks.Battlebacks.cliff;
  301.     case 24: case 25: case 26: case 27:
  302.       return RSMTweaks.Battlebacks.wasteland.battleback2;
  303.     case 32: case 33:
  304.       return RSMTweaks.Battlebacks.desert.battleback2;
  305.     case 34: case 35:
  306.       return RSMTweaks.Battlebacks.lava.battleback;
  307.     case 40: case 41:
  308.       return RSMTweaks.Battlebacks.snowfield.battleback2;
  309.     case 42:
  310.       return RSMTweaks.Battlebacks.clouds.battleback2;
  311.     case 4: case 5:
  312.       return RSMTweaks.Battlebacks.poisonswamp.battleback2;
  313.     };
  314.   };
  315.  
  316.   Spriteset_Battle.prototype.defaultBattleback1Name = function() {
  317.     return RSMTweaks.Battlebacks.default.battleback1;
  318.   };
  319.  
  320.   Spriteset_Battle.prototype.defaultBattleback2Name = function() {
  321.     return RSMTweaks.Battlebacks.default.battleback2;
  322.   };
  323.  
  324.   Spriteset_Battle.prototype.shipBattleback1Name = function() {
  325.     return RSMTweaks.Battlebacks.ship.battleback1;
  326.   };
  327.  
  328.   Spriteset_Battle.prototype.shipBattleback2Name = function() {
  329.     return RSMTweaks.Battlebacks.ship.battleback2;
  330.   };
  331.  
  332. /*
  333. #==============================================================================
  334. # ** END OF CODE
  335. #==============================================================================
  336. */
  337. })(); //Don't remove this!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement