Map Transfer Common Event
Version: 1.0.0
Author: Exhydra
Date: 6 July 2016
Version History
- <Version 1.0.0> 6 July 2016 - Original Release
Description
This script lets you instantly run a specified common event when exiting or entering a map.
Features
- Easy to set up through map notes
Instructions
Place the script in your plugins folder and import it through the Plugin Manager.
Include the following tag(s) into the 'note' box of the map you wish to use the 'Map Transfer Common Event' plugin on.
<mtceEn:commonEventId>
├─Run specified common event when entering the map.
│
├─commonEventId
├ Value ► Numeric
└ The ID of the common event.
<mtceEx:commonEventId>
├─Run specified common event when exiting the map.
│
├─commonEventId
├ Value ► Numeric
└ The ID of the common event.
Plugin
Pastebin Link:
http://pastebin.com/iq2iyYbm// ╒══════════════════════════════════════════════════════════════════════════════════╕
// █▐▐ Map Transfer Common Event
// ╞══════════════════════════════════════════════════════════════════════════════════╡
// █▐▐ Alias(s) and/or Addition(s)
// ├──────────────────────────────────────────────────────────────────────────────────┤
// ├── Game_Map
// │ ├ [ALIAS] initialize
// │ ├ [ALIAS] setup
// │ └ [NEW] mtceRunCommonEvent
// ╞══════════════════════════════════════════════════════════════════════════════════╡
/*:
* @plugindesc Run a specified common event when entering or exiting a map.
* @author Exhydra
*
* @help
* ▄ Plugin ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄
*
* ┌─ Version : 1.0
* ├─ Release : 6th July 2016
* ├─ Updated : 6th July 2016
* └─ License : Free for Commercial and Non-Commercial Usage
*
* ▄ Usage ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄
*
* Place the following tag(s) into the 'note' box of the map you wish to
* use the 'Map Transfer Common Event' plugin on.
*
* <mtceEn:commonEventId>
* ├─Run specified common event when entering the map.
* │
* ├─commonEventId
* ├ Value ► Numeric
* └ The ID of the common event.
*
* <mtceEx:commonEventId>
* ├─Run specified common event when exiting the map.
* │
* ├─commonEventId
* ├ Value ► Numeric
* └ The ID of the common event.
*
* ▄ Example(s) ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄
*
* <mtceEn:3>
* └─Run common event with the ID of 3 when entering the map.
*
* <mtceEx:11>
* └─Run common event with the ID of 11 when exiting the map.
*
*/
// ╘══════════════════════════════════════════════════════════════════════════════════╛
// ╒══════════════════════════════════════════════════════════════════════════════════╕
// ■ [Object] Plugin
// ╘══════════════════════════════════════════════════════════════════════════════════╛
var Imported = Imported || {};
Imported.EXA_MapTransferCommonEvent = true;
var EXA = EXA || {};
EXA.MTCE = EXA.MTCE || {};
// ╒══════════════════════════════════════════════════════════════════════════════════╕
// ■ [Object] Game_Map
// ╘══════════════════════════════════════════════════════════════════════════════════╛
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] initialize
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.MTCE.Game_Map_initialize = Game_Map.prototype.initialize;
Game_Map.prototype.initialize = function() {
this._mtceInterpreter = new Game_Interpreter();
this._mtceEnterEvent = 0;
this._mtceExitEvent = 0;
EXA.MTCE.Game_Map_initialize.call(this)
}; // Game_Map ‹‹ initialize
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] setup
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.MTCE.Game_Map_setup = Game_Map.prototype.setup;
Game_Map.prototype.setup = function(mapId) {
if ($gamePlayer.newMapId() != $gameMap.mapId()) {
$gameMap.mtceRunCommonEvent(this._mtceExitEvent);
}
EXA.MTCE.Game_Map_setup.call(this, mapId);
this._mtceEnterEvent = $dataMap.meta.mtceEn || 0;
this._mtceExitEvent = $dataMap.meta.mtceEx || 0;
if ($gamePlayer.newMapId() == $gameMap.mapId()) {
$gameMap.mtceRunCommonEvent(this._mtceEnterEvent);
}
}; // Game_Map ‹‹ setup
// NEW ───────────────────────────────────────────────────────────────────────────────┐
// □ [Function] mtceCommonEvent
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Map.prototype.mtceRunCommonEvent = function(cevId) {
if (cevId <= 0) return;
var mtceEvent = $dataCommonEvents[cevId];
this._mtceInterpreter.setup(mtceEvent.list);
for (var i = 0; i < mtceEvent.list.length; i++) {
this._mtceInterpreter.executeCommand();
}
this._mtceInterpreter.clear;
}; // Game_Map ‹‹ mtceCommonEvent
// ▌▌██████████████████████████████████████ EOF █████████████████████████████████████▐▐
Credit
Support
Post in this thread if you have any comments or questions.
Author's Notes
RPG Maker MV port of modern algebra's
Map Transfer Common Event for RPG Maker VXA.
Terms of Use
Free for commercial and non-commercial usage.