Jump to content
Sign in to follow this  

Common Event Arguments

Recommended Posts

Common Event Arguments



This script allows you to reserve common event arguments using script calls and then retrieve them in the common event.


Naturally, common events would be more flexible if you could pass in arguments, like functions in programs.




Script: http://db.tt/R846qNLZ




You should set the arguments before making a common event call using a script call


add_cevent_args(1, 2, 3, ...)


Then, in the common event, you can retrieve them using script calls as well


args = $game_temp.common_event_args


You would use script calls to assign them to variables or switches or anything else you might want to do.


As an example, here is a "show picture" common event that takes the name of a picture to show as an argument, and then I use methods in Picture Wrapper to display the image



Share this post

Link to post
Share on other sites

I have added a convenience function that allows you to set the common event arguments directly.


1. In the configuration, you reserve a range of variables.

For example, if you write 1..10, that means $game_variables[1] through $game_variables[10] will be used for common event arguments.


2. Use the script call inside an event


set_cevent_args(arg1, arg2, ... )


The first reserved variable will store arg1.

The second reserved variable will store arg2.

And so on.


The variables will be re-used constantly, and cleared out after the common event finishes executing, so they will only be available during the life-time of the common event call.


3. Use "Conditional Branch" command as usual, checking the appropriate variables.


This is purely for convenience and saves you from having to retrieve the variables later yourself.


Note that if you are using non-numeric arguments, you will still have to use scripted conditional statements since RM's variables only support numbers (and integers at that...)

Edited by Tsukihime

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

Top ArrowTop Arrow Highlighted