Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Calling Common Events by Variable, How to use events to simplify your work.
Jens of Zanicuud
post Dec 2 2012, 09:53 AM
Post #1


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 916
Type: Scripter
RM Skill: Skilled
Rev Points: 120




Hi everyone,
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:
CODE
@params[0] = $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 smile.gif

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[0] value.
@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[0] 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, RMVX, RMVAce and even on RMVAce Lite, without modifying anything.

I hope this can help,

Jens


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 17th June 2013 - 09:38 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker