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,973
Reaction score
3,096
First Language
French
Primarily Uses
RMMV
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,281
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,973
Reaction score
3,096
First Language
French
Primarily Uses
RMMV
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
788
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,973
Reaction score
3,096
First Language
French
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
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,973
Reaction score
3,096
First Language
French
Primarily Uses
RMMV
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,281
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
608
Reaction score
320
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.

19981_818727414875599_8314438731164971542_n.jpg


10308945_818727394875601_7785202060303442715_n.jpg


11083850_818727458208928_3673151940422942468_n.jpg
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:

Latest Threads

Latest Posts

Latest Profile Posts

Reading about metaverses recently. I can totally imagine myself in the future, logging in with VR glasses to a virtual beach villa sitting in a virtual chair, with a virtual laptop facing the sea...coding 16-bit RM.
Mod name: "[Game name] Gameplay Overhaul"
What they actually mean: "Here is a mod that makes the game harder."
I decided to reinstall one of my most favourite game of all times, Gothic 2. Time to get back to Khorinis!
So much game make... I needs to rest. The foods call.
-Casino with bunnysuit green check.png
1638563168795.png

Forum statistics

Threads
117,171
Messages
1,105,121
Members
153,259
Latest member
litespace
Top