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.
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 )
Params means these are the parameters in the arguments that you need to fill up, if you're talking about the params in events.
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
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.
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.