Global Common Events

● ARCHIVED · READ-ONLY
Started by Tsukihime 20 posts View original ↗
  1. 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.
  2. 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?
  3. 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.
  4. 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?
  5. 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.
  6. 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)...
  7. 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.
  8. Tsukihime said:
    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
  9. 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.
  10. 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.
  11. 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.
  12. 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>
  13. 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.
  14. 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.
  15. Yup, it works now. Thanks for the script.
  16. 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
  17. The issue should be addressed now.
  18. It's all good! Thanks for the swift response!
  19. 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?
  20. 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