Advertisement
Maliki79

MalLocationLoader

Nov 9th, 2015
518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*:
  2. //=============================================================================
  3. // Maliki's Location Loader
  4. // MalLocationLoader.js
  5. // version 1.1
  6. //=============================================================================
  7.  * @plugindesc Allows developers to move where players respawn upon loading a saved game.
  8.  * @author Maliki79
  9.  
  10.  * @param Location Load X
  11.  * @desc The Variable number of the X coordinate that saves will load.
  12.  *
  13.  * @param Location Load Y
  14.  * @desc The Variable number of the Y coordinate that saves will load.
  15.  *
  16.  * @param Location Load MapID
  17.  * @desc The Variable number of the Map ID that saves will load.
  18.  *@help  This script will require 3 game variables to function properly.
  19.  *
  20.  *First, designate 3 game variables for each an X, Y and MapID.
  21.  *Note the variable's numbers in the plugin interface.
  22.  *Then you must change the variables as appropriate for the desired
  23.  *load point in-game.
  24.  *You can do this via Variable Change Eventing.
  25.  *
  26.  *Once the variables are set, just save normally and upon loading,
  27.  *the player will appear at the coordinates set.
  28.  *
  29.  *This plugin is turned off by default.  In order to activate it,
  30.  *you must make the script call LL_Active = true.
  31.  *
  32.  *If need be, you can disable it again by using LL_Active = false.
  33.  *
  34.  *Note: If you input the coordinates incorrectly, turn off the plugin from the
  35.  *editor and reload the save.  It should position the player at
  36.  *the original save point, where you can edit the variables as needed.
  37.  */
  38. var Mal = Mal || {};
  39. var LL_Active = false;
  40. Mal.Parameters = PluginManager.parameters('MalLocationLoader');
  41. Mal.Param = Yanfly.Param || {};
  42.  
  43. Mal.Param.NewLoadX = Number(Mal.Parameters['Location Load X']);
  44. Mal.Param.NewLoadY = Number(Mal.Parameters['Location Load Y']);
  45. Mal.Param.NewLoadID = Number(Mal.Parameters['Location Load MapID']);
  46.  
  47. var MalLocationLoader = Scene_Load.prototype.reloadMapIfUpdated
  48. Scene_Load.prototype.reloadMapIfUpdated = function() {
  49.     if (LL_Active) {
  50.         $gamePlayer.reserveTransfer($gameVariables.value(Mal.Param.NewLoadID), $gameVariables.value(Mal.Param.NewLoadX), $gameVariables.value(Mal.Param.NewLoadY));
  51.         $gamePlayer.requestMapReload();
  52.         } else {
  53.         if ($gameSystem.versionId() !== $dataSystem.versionId) {
  54.         $gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);
  55.         $gamePlayer.requestMapReload();
  56.     }}
  57.    
  58. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement