POG_GamePresets: call a common event automatically

​

License: Free for personal or commercial use.

Context: It is very common for the developer to use an event to automatically start on the first map of the game for the sole purpose of calling an introduction scene to the game. The same happens when the developer wants certain events to occur as soon as the player is teleported to a map.


Description: This script allows the developer to determine a common database event to be called at the exact moment the game is started or the player is teleported to a new map.


Script configuration: you will need to determine the number of the common event that is called when starting the game.
Spoiler: Image
Spoiler: Image
​
presets2.jpg
​

Map presets (when loading)

You can use a common event to make adjustments to the game map as soon as it loads. To do this, use the tag:


<presets: Id>​


Id is the number of the common database event that will be called when the map is loaded.

Spoiler: image
presets3.jpg

In the example shown, common event number 2 will be called as soon as the map is loaded.​



​
This is really nice, this is mostly a function that existed on eAthena emulators (Ragnarok Online) and could do so many amazing stuffs with that, mainly conditional branches which depending on the map ID the script ran one or another function.

In RPG Maker, this is more clean, you just have to write the map name on the common event name and insert there as many conditional branch as you want for specific maps, and the same for global checks, and if you want everything in the same common event, you can do it aswell and use the comment tags to separate each branch for each map, only thing I miss is a built-in option to see directly the Script Code on the engine itself, much like a "WYSIWYG OFF" function, so we could even learn more easily javascript since I guess that every event we make in the engine are, essentially, javascript functions, but simplified by an User UI.

Is very likely I'll use your script a lot on my project, once I really start working on it...
Thank you!

By the way, can you also make an option to execute a common event when shutting down, which also recognizes Alt+F4, and when the user presses alt+f4 it takes a small delay to execute the common event before close the game completely? And, if you can, do it also when the player closes by right-click > exit on the taskbar, and click on the Close button, this can be really useful, specially to force an Autosave for these games that doesn't really rely on the Save Function but in Autosaves (this can be really useful for 3rd plugins that brings online features, like Pheonix's Alpha Net/Net ABS, and for mobile games).

...Talking about mobile games, it can be more complicate to do, but begin with PC is a good step.
@Killuki Zaoldyeck

This idea of alt + f4 is very good. I'll think about it.

I'm glad that the scrpt will be of use to you. I use it on my own project and I can optimize a lot of development time with it.

I will reflect on your ideas. I believe I can improve the script from them.

Thanks for the comments!

Original thread: https://forums.rpgmakerweb.com/threads/pog_gamepresets-call-a-common-event-automatically.128627/