Get coordinates of player and save to variable

Zwataketa

Villager
Member
Joined
Nov 10, 2020
Messages
22
Reaction score
2
First Language
English
Primarily Uses
RMXP
Hello, I'm trying to make an event that causes an object to spawn on top of the player. I believe the best way to manage that for my purposes would be to make a command that takes the player's current coordinates and saves them to two variables (one for x and one for y). I'm not experienced with scripting in RPG Maker yet, so I'm not sure how to start with this. Could someone help me out?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,391
Reaction score
8,399
First Language
German
Primarily Uses
RMMV
no need for any script
playerx.png
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
307
Reaction score
77
First Language
English
Primarily Uses
RMXP
Code:
$game_variables[1] = $game_player.x
$game_variables[2] = $game_player.y

Just replace 1 and 2 with the positions you might prefer.
 

Latest Threads

Latest Posts

Latest Profile Posts

me: “I’m gonna take a break from game making.”
*five hours later*
me: yeah okay fine I needed to redo that map. Sure.
The OFFICIAL RPG Maker Discord Server is Here | RPG Maker News #116

And the time has come for me to enjoy a good cup of hot cocoa before I sleep... Strangely, that actually helps.
If I ever need to stay up late working on projects, I always get tired. Do you guys think I should try G-Fuel to keep me up and focused at night? And if so, what flavor is best?
I do tend to be quite a night owl.
"Same as it ever was. Same as it ever was. Same as it... EVER was."
Ugh. This update is taking so long that I'm starting to run out of topics for the weekly blogs that I was making to make up for the fact that it was taking so long to begin with!

Forum statistics

Threads
113,973
Messages
1,078,735
Members
148,072
Latest member
raffa2k
Top