I've recently found out something that could be useful to developers.
Common Event are really useful, but the editor misses the function to call them through variable.
So, if you want to call one of them randomly, you have to create a set of conditions, one incapsulated into another.
There's a simple way to do that:
1. Open a Script event
or a Conditional Branch
event, then select the Script condition;
2. Write this line:
@params = $game_variables[X]; command_117
where X should be replaced by the varaible id you're using;
3. See the whole system working and enjoy it How does it work:
When you access the script editing via event commands (Move Route, Conditions, Script, Variables), you are calling the Game_Interpreter class.
This class is the script section which handles with event commands. command_117
is the method which calls a common event, the one indentified by the @params
is an array which contains every information sent by the program to the script section (i.e. event id
and animation id
when you're playing an animation, actor id
and hp value
when you're changing a hero hp, etc, etc.).
In this case, @params
is the id of the common event you wish to call. Setting it equal to a variable makes you able to control the common event which will be called via a simple variable operation.
This trick works on RMXP
and even on RMVAce Lite
, without modifying anything.
I hope this can help,