Getting Events' Coordinates

Erangot

Veteran
Veteran
Joined
Mar 25, 2012
Messages
56
Reaction score
68
First Language
Filipino
Primarily Uses
Hi there, how do I get an event's x and y coordinates?

For the player's position I type "$game_player.x" or "$game_player.y" in the event's script.

But how can I get an event's coordinates where I put the script into?

----
Sorry for the trouble, I'm very much inexperienced with scripting. Thanks in advance.
 
Last edited by a moderator:

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,600
Reaction score
2,359
First Language
French
Primarily Uses
for the event position 

$game_event.event.x$game_event.event.y(if I remember I don't know gemini just crash in front of me lol...when I was doing search X_X )
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Params means these are the parameters in the arguments that you need to fill up, if you're talking about the params in events.
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,600
Reaction score
2,359
First Language
French
Primarily Uses
Params means these are the parameters in the arguments that you need to fill up, if you're talking about the params in events.
buts I am always curious why exemple for  the comment

#-------------------------------------------------------------------------- # * Comment #-------------------------------------------------------------------------- def command_108 @comments = [@params[0]] while next_event_code == 408 @index += 1 @comments.push(@list[@index].parameters[0]) end endthey use @params when actually this not really "params" UNLESS this not wield the same signification of parameter in french :/
 

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
781
First Language
English
Primarily Uses
RMMV
Actually Nio I think it's:

$game_map.events[ID].x$game_map.events[ID].yBut I'm also not completely sure, too lazy to run vxa to check lol
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,600
Reaction score
2,359
First Language
French
Primarily Uses
Actually Nio I think it's:

$game_map.events[ID].x$game_map.events[ID].yBut I'm also not completely sure, too lazy to run vxa to check lol
it's vx not vxace Quasi : D
 

Erangot

Veteran
Veteran
Joined
Mar 25, 2012
Messages
56
Reaction score
68
First Language
Filipino
Primarily Uses
Actually Nio I think it's:

$game_map.events[ID].x$game_map.events[ID].yBut I'm also not completely sure, too lazy to run vxa to check lol
Ahh thanks Quasi it's working for me ;w; All I need to know now is how I'm going to get the coordinates of the "this event", or the event I placed the script into. :D
 
Last edited by a moderator:

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,600
Reaction score
2,359
First Language
French
Primarily Uses
Ahh thanks Quasi it's working for me ;w; All I need to know now is how I'm going to get the coordinates of the "this event", or the event I placed the script into. :D
then you replace id by the id of the event and you will obtain "this event"
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Comments though, is done like this in VX:

class Game_Event < Game_Character #-------------------------------------------------------------------------- # * Set Event Location #-------------------------------------------------------------------------- def command_108 character = get_character(@params[0]) if character != nil if @params[1] == 0 # Direct designation character.moveto(@params[2], @params[3]) # event x and event y elsif @params[1] == 1 # Designation with variables new_x = $game_variables[@params[2]] # variable number new_y = $game_variables[@params[3]] # variable number character.moveto(new_x, new_y) else # Exchange with another event old_x = character.x old_y = character.y character2 = get_character(@params[2]) if character2 != nil character.moveto(character2.x, character2.y) character2.moveto(old_x, old_y) # from its old value end end case @params[4] # Direction when 8 # Up character.turn_up when 6 # Right character.turn_right when 2 # Down character.turn_down when 4 # Left character.turn_left end end return true endendSo whenever comments or any other params are involved, mostly they are taken from what they are, like this:

$game_map.events[ID].x$game_map.events[ID].ytechnically, ID is a param.
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
536
Reaction score
249
First Language
German
Primarily Uses
You can obtain the ID of "this event" by using  @event_id  instead of a static number.

As an alternative, you can use  get_character(0)  instead of  $game_map.events[@event_id]  too.

(The only difference is that if the event execution continues after you changed the map, the former will return  nil  while the latter will return the event of the new map with the specified ID.)

Script commands used in move routes are executed in a different context though, neither  get_character(...)  nor  @event_id   will work there, but you can simply use  self  to access the moving character.
 
Last edited by a moderator:

Erangot

Veteran
Veteran
Joined
Mar 25, 2012
Messages
56
Reaction score
68
First Language
Filipino
Primarily Uses
You can obtain the ID of "this event" by using  @event_id  instead of a static number.

As an alternative, you can use  get_character(0)  instead of  $game_map.events[@event_id]  too.

(The only difference is that if the event execution continues after you changed the map, the former will return  nil  while the latter will return the event of the new map with the specified ID.)

Script commands used in move routes are executed in a different context though, neither  get_character(...)  nor  @event_id   will work there, but you can simply use  self  to access the moving character.
You are an angel ♥ It's working perfectly now ;w; $game_map.events.... or get_character works fine, whichever of the two that I have used. : D

Thanks so much! The reason is that my events are cloned from another map and the player chooses where he/she will till the soil, so I couldnt manage to use a static number to set where the event should be placed. Here's how it looks like as of now.





Thanks again .. I guess I wouldn't need to ask regarding the tile_id any longer. And and thanks to Milena for the info regarding params : )
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

TFW: You get a text from someone and a long conversation--but you have no idea who this person is and don't wanna be that guy that asks "Who is this by the way?" I have no clue who this person is... but they seem to know me quite well. :rswt
You know, after all these years of using RM I've never played To The Moon. With being busy with life and then after my mom died I was too emotionally fragile to play something that heavy. Has anyone played the Switch version? Is there any big differences between that and the RM version?
Today I finished my Lets Play. Gonna have the videos scheduled for daily uploads now. Woo I finished something ^^
*tries to study Emergence of Bangladesh: Ancient Bengal* Matsyanyayam- When the law of punishment is kept in abeyance... okay what? *searches dictionary* oh! Ok. In abeyance, it gives rise to such disorders as is implied in the proverb of fishes i.e the larger fish swallows a small one- wait fishes eat each other!? Is that like... fishy cannibalism!?...Oh! It's 8:30! Time for dinner! *throws book on floor*
Babbaditch Finster and the Seven-Sided Cube has got to be one of my favorite classic games that didn't exist when I was kid, or ever

Forum statistics

Threads
93,397
Messages
911,977
Members
122,902
Latest member
Tiregs
Top