Global Common Events

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
This script allows you to assign certain common events as "global" common events. These are common events that will be run in almost any scene, as long as the run conditions are met.



Download

Get it at Hime Works!

Installation

Place this script below Materials and above Main

Usage



To set a common event as a global common event, create a comment with the following string

 <global common event>You can set the run condition if you want to control when the common event will be updated. The trigger itself is irrelevant since a global common event does not need it.If you would like the common events to continue running even if the message

window is open, use the comment

<global common event: non-blocking>Filtering ScenesYou may not want all global common events to run in every scene, but you may

want to run certain global common events in certain scenes, but not others.

You can control which scenes global common events run in using a set of

filters, organized into two types of filters: whitelists, and blacklists.

Whitelists determine which scenes allow global common events to update.

If the whitelist is empty, then all scenes will update events.

If the whitelist is not empty, then only those scenes will update events.

Blacklists determine which scenes disallow global common events to update.

The blacklist is used to prevent updating in certain scenes, while allowing

all other scenes to update events.

Note that by this definition, whitelists are more restrictive. For example,

if you put Scene_Map on the whitelist, then global common events will

ONLY run on the map and nowhere else. But if you put Scene_Map on the blacklist, then the events will run on any scene EXCEPT the map scene

Universal Filters

In the configuration section, there is a whitelist and a blacklist. These are universal filter lists: they apply to all global common events.

Local Filters

Each global common event can have its own whitelist and blacklist.

To specify filters, create a comment of the form

<global scene blacklist: scene_name1, scene_name2, ... ><global scene whitelist: scene_name3, scene_name4, ... >You must specify the exact scene name (eg: Scene_Title), each scene separated by a single comma.Local filters only apply to the events that they are defined in and do not affect other events.
 
Last edited by a moderator:

seita

Donn_M
Veteran
Joined
Feb 6, 2013
Messages
2,254
Reaction score
611
First Language
English
Primarily Uses
Would this allow events within the common event to execute while say, in the menu scene as well? so opening up a message within the menu would work?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Yes, it will run in every scene except the excluded ones.


No, it does not include every command such as a message, because message windows do not exist in the menu scene.


You can try combining it with the scene interpreter.
 

MakoInfused

Veteran
Veteran
Joined
Jul 17, 2012
Messages
55
Reaction score
9
First Language
English
Primarily Uses
RMMZ
Standard Parallel Process Common Events reset every time you leave one map for another (ie: their command execution index is set to 0). This leads me to my question: does this "Global Common Event" reset after a map changes?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
No, they are stored globally so they are separate from any map or menu or scene.


Regular common events reset because everytime you load a new map, all common events are re-created.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
Does this include running the common event in a battle?

I just finished and tested a little hack that makes Ace call a common event whenever an actor levels up, but unfortunately if several actors level up in the battleresults, that event is only run once for all levelups after the battleprocessing is over. If this script enables the common event to run inside battle, I'll probably get what I want (one script call per actor levelup)...
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Yes, the global common events are updated in Scene_Base, so that should cover every scene. In the default project anyways.


I know there are some scripters who prefer to write their own scene class from scratch (eg: no inheritance, basically duplicate Scene_Base and add more stuff) but I don't really understand the purpose of that.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
Yes, the global common events are updated in Scene_Base, so that should cover every scene. In the default project anyways.

I know there are some scripters who prefer to write their own scene class from scratch (eg: no inheritance, basically duplicate Scene_Base and add more stuff) but I don't really understand the purpose of that.
I don't understand such a thing either - I'm trying to limit the need for scripts as far as possible (since I'll probably have too much scripts anyway, and recreating everything just adds to complexity and number of possible errors.

Thanks for the answer,I'll try it out tomorrow
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
I have updated the script and implemented whitelists.

The term "inclusion" and "exclusion" is bad choice, since you can be included on a whitelist and also included on a blacklist (probably not at the same time, of course). I've renamed them to blacklist and whitelist accordingly.

The comments to use in common events for the filter lists is now

<global scene whitelist: ... ><global scene blacklist: ... >For those that are not familiar with how blacklists and whitelists work:Whitelists determine which scenes allow global common events to update.

If the whitelist is empty, then all scenes will update events.

If the whitelist is not empty, then only those scenes will update events.

Blacklists

Blacklists determine which scenes disallow global common events to update.

The blacklist is used to prevent updating in certain scenes, while allowing all other scenes to update events.

Note that by this definition, whitelists are more restrictive. For example,

if you put Scene_Map on the whitelist, then global common events will ONLY run on the map and nowhere else. On the other hand, if you put Scene_Map on the blacklist, then the events will run on any scene EXCEPT the map scene.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
Is there a fast way to check wether the script is running at all?

I tried to use the script for the after-battle-calls, but the common event behaves like a regular parallel process with a battle scene (i.e. starting after battle processing is complete, not before). Same goes when I try to call up the event (without parallel and switch) while in the battle aftermath - the event also waits until battle processing is finished before executing.
 

mihai7

Veteran
Veteran
Joined
Sep 23, 2012
Messages
54
Reaction score
1
Primarily Uses
Making common events run while message windows are open would be very useful. There is an event trick for this, putting the common event in a loop, but you can only do it for only one parallel process common event. My game freezed when I tried 2. Celianna said that common events not running while text boxes are open wasn't the case with VX.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Global common events can now be set to continue running even if the message window is open.

These are called "non-blocking" common events (where the blocking refers to the message...)

Use the following comment when setting a common event as a global common event

Code:
<global common event: non-blocking>
 

mihai7

Veteran
Veteran
Joined
Sep 23, 2012
Messages
54
Reaction score
1
Primarily Uses
Updated the script, put the comment in there but it won't work with my time common event, like it does if I put it in a loop. Time halts when message boxes are open.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Must've hit undo or something before I pasted the script to the text file, cause it was checking for "non-blocki" instead of "non-blocking"


Fixed script.
 

mihai7

Veteran
Veteran
Joined
Sep 23, 2012
Messages
54
Reaction score
1
Primarily Uses
Yup, it works now. Thanks for the script.
 

McTone

This Guy
Veteran
Joined
May 15, 2013
Messages
203
Reaction score
34
First Language
English
Primarily Uses
I'm having an issue with this script which is preventing me from playing any saved games. Has anyone run into this or know of a fix?


The exact error message is:


line308: NoMethod Error occured.


undefined method 'update' for nil:NilClass
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
The issue should be addressed now.
 

McTone

This Guy
Veteran
Joined
May 15, 2013
Messages
203
Reaction score
34
First Language
English
Primarily Uses
It's all good! Thanks for the swift response!
 

beefdew

Warper
Member
Joined
Jul 11, 2013
Messages
1
Reaction score
0
First Language
English
Primarily Uses
Awesome stuff, thanks a lot.

I noticed non-blocking global events will not work properly after loading, however. I have a parallel process non-blocking global event that works fine with the switch ON. It ends, switch goes off. Save, load, turn switch ON - and text makes it stop.

Is there any way to fix this?
 

Zillandi

Warper
Member
Joined
Sep 13, 2015
Messages
1
Reaction score
0
First Language
English
Primarily Uses
When I enter a battle, the battle BGM begins playing, but is then changed by the global event.  In the audio "system" I have setup, when you enter a new map an event immediately sets a control variable with a value used as a hash key.  The method playBGM then plays the audio that key is linked to.

Code:
@Comment: <global screne blacklist: Scene_Battle, Scene_Gameover>@Conditional Branch: Switch [0001:Day/Night]==ON    @>Script: playBGM    @>:   Else    @>:   Branch End@>Wait: 120 frame(s)@>def playBGM    initBGMHash        RPG::BGM.new(@map_bgm_hash[$game_variables[MAP_BGM]], 100, 100).playend
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,570
Latest member
fgfhdfg
Top