Map Transfer Common Event

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
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.

Code: [Select]
   <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

Code: [Select]
// ╒══════════════════════════════════════════════════════════════════════════════════╕
// █▐▐  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


  • Exhydra

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.
« Last Edit: July 06, 2016, 11:55:55 PM by exhydra »

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

*
The Hero of Rhyme
Rep:
Level 82
( ͡° ͜ʖ ͡°)
2014 Best RPG Maker User - StoryProject of the Year 20142014 Queen of RMRK2011 Best Newbie2014 Best RPG Maker User - Creativity2014 Kindest Member2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best Yuyubabe Smiley2012 Best RPG Maker User (Creativity);o
Nice!! Thanks for the port! :-)
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]