how do i make a common event that plays every time you enter a new map/area? (and doesn't repeat)

barp

Villager
Member
Joined
Jan 8, 2022
Messages
10
Reaction score
9
First Language
English
Primarily Uses
RMMV
for a common event to not loop and freeze the game, the trigger switch has to be off by the end. in order for it to play upon entering each area, the trigger switch has to be on by the end. i've tried autorun and parallel and any number of conditionals. and for whatever reason, "exit event processing" and "erase event" just don't work. i can think of any number of workarounds, but all of them would require another common event, which would have the same problem. the trigger switch has to be on for it to play, and turning it on during another event would play it early, resulting in the same problem as before.

what i'm trying to do is change the actor's image and have it actually stick between areas. it's sort of like the toad spell in final fantasy, a spell that changes your overworld sprite. it's like a status effect, it's not permanent enough that i wanna mess around with actors for it. anything that can activate the status turns on a switch that activates this event. anything that can deactivate it turns the switch off.
 
Last edited:

Soulrender

Jack Of All Trades
Veteran
Joined
Jan 12, 2019
Messages
1,570
Reaction score
1,076
First Language
Polish
Primarily Uses
RMMV
@procraftynation wrote some time ago a plugin that allows that:
JavaScript:
/*:
 * @plugindesc v1.00 Allows a common event to run on start of a Scene_Map, without creating an autorun.
 * @author Procraftynation - https://www.youtube.com/c/procraftynation
 *                         - https://github.com/procraftynation
 * @help
 * =====================================================================
 *   - Calls the Common Event 1 when the map is just started.
 * NOTE: Only 1 common event can run on map start
 * =====================================================================
 * Terms of Use
 * =====================================================================
 * Free for use in non-commercial and commercial games just give credit
 * and link back to https://www.youtube.com/c/procraftynation.
 * If commercial, a free copy of the game is awesome but optional.
 * =====================================================================
 *
 * @param Common Event ID
 * @type number
 * @min 1
 * @desc Select Common Event to run at map start.
 * Default: 1
 * @default 1
 */
 
 
var CE = CE || {};
CE.Core = CE.Core || {};
CE.Core.version = 1.00;

CE.Parameters = PluginManager.parameters('CE_MapLoad');
CE.Param = CE.Param || {};
CE.Param.CommonEventId = Number(CE.Parameters['Common Event ID'] || 1);

Scene_Map.prototype.start = function() {
    Scene_Base.prototype.start.call(this);
    SceneManager.clearStack();
    if (this._transfer) {
        this.fadeInForTransfer();
        this._mapNameWindow.open();
        $gameMap.autoplay();
        $gameTemp.reserveCommonEvent(CE.Param.CommonEventId); 
        //$gameTemp.clearCommonEvent();
    } else if (this.needsFadeIn()) {
        this.startFadeIn(this.fadeSpeed(), false);
    }
    this.menuCalling = false;
  
};

Save this as plugin with name CE_MapLoads.js, add to your project and in plugin manager in plugin settings select your common event. Or use much shorter code:
Code:
var alias = Scene_Map.prototype.start;
Scene_Map.prototype.start = function(){
    alias.call(this);
    $gameTemp.reserveCommonEvent(id); //In place of ID enter the number of your common event
}
 
Last edited:

Htlaets

Veteran
Veteran
Joined
Feb 1, 2017
Messages
321
Reaction score
174
First Language
English
Primarily Uses
I mean, the non-plug-in way is to have a switch get flicked every transfer, and have the common event flick that switch off.

The better non-plug-in way is to have the common event trigger be none and then just have an event on every map you can copy and paste with the following:

Common event in question
Erase event

this event would have a parallel trigger.

But, yeah, Soul's plugin is probably a good bet, but the above is just in case of plugin conflicts.
 

Soulrender

Jack Of All Trades
Veteran
Joined
Jan 12, 2019
Messages
1,570
Reaction score
1,076
First Language
Polish
Primarily Uses
RMMV
That's why I aliased Start of map code, so the all things will run properly and later, play common event.
So no worry, there are no conflicts.
 

KurayamiBlackheart

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
173
Reaction score
138
First Language
French
Primarily Uses
RMMV
I mean, the non-plug-in way is to have a switch get flicked every transfer, and have the common event flick that switch off.

The better non-plug-in way is to have the common event trigger be none and then just have an event on every map you can copy and paste with the following:

Common event in question
Erase event

this event would have a parallel trigger.

But, yeah, Soul's plugin is probably a good bet, but the above is just in case of plugin conflicts.
I personally have a "On map refresh" common event on my game, which is actually executed the same way you proposed it to be. Parallel process event triggering a common event then erasing itself, on each map. It works just fine. But I'm not sure if OP wants it to be repeated if the player load the game. 'cause if it's only during map transfer, then the event shouldn't be triggered when the map is loaded (loading saves, etc etc). in this case, it would be quite more complex to accomplish without a plugin.
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
1,069
Reaction score
514
First Language
english
Primarily Uses
RMMV
i usually have 1 autorun/erase event on most maps for various checks and changes based on progression.
adding a switch or common event call at the end is no issue.
and some maps use parallel with switch tied to every possible transfer to that map (more of a niche use and nowhere near as common)
 
Last edited:

KurayamiBlackheart

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
173
Reaction score
138
First Language
French
Primarily Uses
RMMV
i usually have 1 autorun/erase event on most maps for various checks and changes based on progression.
adding a switch or common event call at the end is no issue.
and some maps use parallel with switch tied to every possible transfer to that map (more of a niche use and nowhere near as common)
your checks should be as parallel process, except if you want the player to be unable to move during the time the event executes itself.
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
1,069
Reaction score
514
First Language
english
Primarily Uses
RMMV
your checks should be as parallel process, except if you want the player to be unable to move during the time the event executes itself.
thats exactly what i want. these checks often include changing music, event locations, changing follower sprites. and it all happens while the screen is still black
 

KurayamiBlackheart

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
173
Reaction score
138
First Language
French
Primarily Uses
RMMV
thats exactly what i want. these checks often include changing music, event locations, changing follower sprites. and it all happens while the screen is still black
if you have another auto-run event (like for cinematics, scenario, etc etc) that has a lower ID than your autorun event changing all this stuff, the autorun event won't change anything until the cinematic/etc is over too. also the fact that it's an auto-run doesn't make it happen while the screen is black. if I recall the basic fade screen is 24 frames.

TLDR; if there's no reason for the player to be unable to move and for your event to use the main process, put it as parallel process, in this case it would actually be better.
 

barp

Villager
Member
Joined
Jan 8, 2022
Messages
10
Reaction score
9
First Language
English
Primarily Uses
RMMV
couldn't you make the autorun events black out the screen the instant they start, (with a flash effect or something, paired with a fadeout) and fadein the screen at the end? might make transitions take too long, though.

i appreciate the help, by the way. everyone. i'm using that idea with the self-erasing parallel event that calls up a common event. it works great.
 

Htlaets

Veteran
Veteran
Joined
Feb 1, 2017
Messages
321
Reaction score
174
First Language
English
Primarily Uses
The problem I've always had with autorun events that black out the screen AFTER a map transition is that they usually flash the map before blacking out for a frame or two, which looks sloppy.

Oh, and you should probably bear in mind that, like soulrender said, the self-erase event will run both when you load the map, and if you save a game and load that game. So, depending on your exact use case, the plug-in might be a better plan.
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,631
Reaction score
509
First Language
German
Primarily Uses
RMMV
Autorun Event = Map will be visible for a split second.

Paralell Event = Will start while the Screen is black.

Erase Event = Will delete the Event until the Map is re-entered from another Map.
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
1,069
Reaction score
514
First Language
english
Primarily Uses
RMMV
if you have another auto-run event (like for cinematics, scenario, etc etc) that has a lower ID than your autorun event changing all this stuff, the autorun event won't change anything until the cinematic/etc is over too. also the fact that it's an auto-run doesn't make it happen while the screen is black. if I recall the basic fade screen is 24 frames.

TLDR; if there's no reason for the player to be unable to move and for your event to use the main process, put it as parallel process, in this case it would actually be better.
if use transfer fade this would be true, but i use tint screen instead. less instantaneous transition, adds to ambience (some maps are ment to never give full clarity), also tied to the time system in open field maps.
and i can control weather the fade in is part of the map transition or part of a cutscene.
 
Last edited:
  • Like
Reactions: Bex

Latest Threads

Latest Posts

Latest Profile Posts

:v I "unlearn" how to use the forum.
I've made and moved to a THIRD spreadsheet document to reorganize my thoughts and better plot out my RPG.

halp
Today, we got "The ancient Forest"

Map042.png


And here's a little ingame view:
Clipboard01.png

New Boss Attacks for Soul Hero Adventure:
1,Aim and shoot
2,Boulders falling frenzy
3,Throwing Fireballs
4,Chasing Magical Traps
5,Lasers attack of 360-degree
Pokemon AI Logic: "Enemy is weak to Fire, I better use Rain Dance to make fire type moves less effective. I should just always cast Rain Dance first no matter what, even though it's a niche move that I'm not set up to exploit."

Forum statistics

Threads
123,288
Messages
1,155,524
Members
161,702
Latest member
Elekks
Top