Common Event Variables

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author


This script automatically updates a set of “common event variables” throughout the game. The purpose is to make it easier for developers to design events that rely on information such as who used a skill.

The main purpose of this script is to provide a way to specify common event arguments. These arguments are stored in game variables, which makes it easy to use for the event editor and some script calls when necessary.

The variables will be updated automatically whenever a skill or item is used, on the map or in a battle.


Script: download here


Place this script below Materials and above Main


Object Access

The following objects are automatically set when a common event is used

$game_temp.common_event_user   - stores the user
$game_temp.common_event_target - stores the target
$game_temp.common_event_item   - stores the item used.
$game_temp.common_event_skill  - stores the skill used

You can access them in your common event script calls as needed. All values are nil if no data is available.

Variable Designation

In the configuration, set the ID of the game variables to store the common event variables. The game automatically tracks the following data upon item or skill use:

  • the user (actor or enemy ID)
  • the target (actor or enemy ID)
  • the skill (skill ID)
  • the item (item ID)

Note that the skill and item are stored in separate variables.
You can reference these variables in your events or script calls.

For common event effects, only the first common event will have this
information available. The data is lost after the first common event
finishes running. I have not figured out when is a good time to clear out
temporary data.

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

19 Responses

  1. AngryAragami says:

    Hime, I have a question. How can I use this to pull specific stats? The gist of what I want to do is use the variables of who the user and target are in order to allow the common event to find out what they have in a stat. For example, using this so the common event can find the atk of the user and def of the target.

    • Hime says:

      In your common event, you can use conditional branches with the script condition


      To get the user's ATK and target's DEF respectively.

      So for example, if you wanted your common event to do something only if the target's defense is less than half the user's attack, you could say in your condition

      $game_temp.common_event_target.def < $game_temp.common_event_user.atk / 2
  2. piksalh says:

    No matter how I try, I cant find a proper way to make it work in my project. I want to show specific text when player casts skill on specific enemy. Let’s say if enemy with ID 001 is target, show text after using skill “Enemy 1”, if Enemy with ID 002 is target, show “Enemy 2”, etc. I tested on empty project – still no luck.

    I added common event in Attack skill, then in first common event I added conditional branch with script $game_temp.common_event_target == 1 and show text “Enemy 1”. I never get that text in the battle when using skill on Enemy ID 001.

    • Hime says:

      $game_temp.common_event_target is an object, not a number. If you want to know the position of the enemy is the first position, you can use

      $game_temp.common_event_target.enemy_id == 1

      Note that this the target MUST be an enemy in this case. If it is an actor it will crash.

  3. nat says:

    🙁 i need something like this to return the enemy id not the spot that enemy takes in the battle…

  4. formica says:

    Thanks for your great works but I think the download link is broken. How can I get that?

  5. Awesome says:

    Hmm, there seems to be a bug here…the script never sets the target of the skill/item, and it stays zero. Trying to use $game_temp.common_event_target brings up this error:

    “Script ‘Game_Interpreter’ line 450: NoMethodError occurred.

    undefined method `common_event_target=’ for #”

    • Awesome says:

      (the comment cut out something: basically, it was Game_Temp: (and then a hexadecimal offset))

    • Hime says:

      Have you tried this in a new project? Did you set up your variables correctly?

      • Awesome says:

        I just tried this in a clean project by inserting a common event in the Attack skill, and then using it. In that common event was a conditional branch that said $game_temp.common_event_target = 1, and if it did, display a message. When testing it, he same NoMethodError from before showed up.

        And I did set up my variables correctly.

      • Awesome says:

        Well, that fixed that error.
        It’s still returning zero, though, no matter what, variable or through $game_temp.common_event_target.

      • Awesome says:

        Stupid me, I didn’t realize that it starts from zero and not one. Sorry for wasting your time. This is a great script. 🙂

        Thank you!

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see