Jump to content

Self referencing event

Recommended Posts

Im looking for the script call for the following commands:


Control variable > set > game data > This event's map X

Control variable > set > game data > This event's map Y

Control variable > set > game data > This event's direction


I can do it with the regular event commands but ideally, I need it inside a set move route, hence the request for the script calls.


I've looked everywhere I can think to look but I cannot find this particular call.


Any help is greatly appreciated

Share this post

Link to post
Share on other sites

The nice thing about script calls in move routes is you can just use 'self' to get the current event object like this:

$game_variables[0] = self.x
$game_variables[0] = self.y
$game_variables[0] = self.direction

Though in this case it is probobly better to use '@' to look up the current event object's private attributes/variables directly like this:

$game_variables[0] = @x
$game_variables[0] = @y
$game_variables[0] = @direction

In either case replace 0 with whatever variable number you want.


Also, Just FYI: Let explain the difference between these two things for a bit, it may be handy in the future. You see, RPG Maker VX Ace uses Ruby, and in Ruby all of an objects attributes/variables are basically like secrets that only it knows. However you are able to make it so an object can tell other things the secret when asked. Why is this important? Because objects usually don't give away all their secrets, a lot of things it might need to figure out on the spot and can't just give a secret answer for, and sometimes they can just outright lie. An object can respond to things any way it likes.


Basically 'self.' is gonna give you what the object will tell everyone else when asked, and '@' is gonna give you some of the secret information it keeps hidden from everything else.


Edited by Kayzee
  • Like 1

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

  • Recently Browsing   0 members

    No registered users viewing this page.

Top ArrowTop Arrow Highlighted