Nilom

Veteran
Veteran
Joined
Sep 9, 2013
Messages
178
Reaction score
40
First Language
German
Primarily Uses
RMMV
Hello!

I try to draw a picture at an events position with:

Code:
$gameScreen.showPicture(params);

The event doesn't have a fixed position. I tried this:

Code:
$gameScreen.showPicture(80, "picname", 1, $gameMap.event($eventID).x*36, $gameMap.event($eventID).y*36, 100, 100, 255, 0);

But it doesn't work. The closest I could get was multiply the x and y with 24. But the pictures still were not at the exact same position as the events.

Does anyone know the pixel dimensions of the grid in RPG Maker MV?

When I put $gameMap.event($eventID).x in the console I get values like 2, 4, 10 or whatever. It counts the tiles between the outer map line and the event. But how many pixels does each tile have?

Thanks in advance!
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,119
First Language
English
Primarily Uses
RMMV
You want to grab the _realX and _realY properties of the event, that should give you the pixel position.

The closest I could get was multiply the x and y with 24. But the pictures still were not at the exact same position as the events.
Each tile in RPG Maker MV is 48x48, you can find more information about the default dimensions in the help manual that comes with MV.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,784
Reaction score
7,875
First Language
German
Primarily Uses
RMMV
But the pictures still were not at the exact same position as
the tile coordinates simply need to be multiplied with 48 to get the screen coordinates in pixels.
What you're missing here is that "Show Picture" as a command can switch between two different forms of pixel coordinates, and from what you're writing I think you're using the centered form - which needs to handle the numbers in a different math than the origin form.

Please check the event command itself and use its different options including the selection which coordinates to use. With that selection you not only switch the base of the coordinates but also the point in the picture that will be locked to those coordinates.
It's difficult to explain, just try the command with a picture and use the same coordinates to see how the display changes, and then use different coordinates at one setting to see the other effect.
 

Nilom

Veteran
Veteran
Joined
Sep 9, 2013
Messages
178
Reaction score
40
First Language
German
Primarily Uses
RMMV
You want to grab the _realX and _realY properties of the event, that should give you the pixel position.

Each tile in RPG Maker MV is 48x48, you can find more information about the default dimensions in the help manual that comes with MV.

Unfortunately ._realX and ._realY do return the exact same values as .x and .y in the console aswell as if I replace the respective code sections. It did not correct the picture position.
Did I use it correctly?
Code:
$gameMap.event(ID)._realX


the tile coordinates simply need to be multiplied with 48 to get the screen coordinates in pixels.
What you're missing here is that "Show Picture" as a command can switch between two different forms of pixel coordinates, and from what you're writing I think you're using the centered form - which needs to handle the numbers in a different math than the origin form.

I was assuming that *48 aswell. But the picture showed up way beyond the right side of the event. It didn't matter if I put the picture in center or upper left. It is only 96*96 pixels small, so that shouldn't matter too much.

I wonder why ._realX and .x do return the same values.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
40,782
Reaction score
14,015
First Language
English
Primarily Uses
RMMV
the tile coordinates simply need to be multiplied with 48 to get the screen coordinates in pixels.

Isn't that only valid if the map is the exact size of the screen?

In an event, you can Change Variables and use Game Data > Character's .... to get the Screen X and Screen Y into variables, then use those variables in the Show Picture command, with the picture origin set to Center.

However, if the event is moving, you'd need to put that in a parallel process if you wanted the picture to keep following the event. If you do that, make sure you add a Wait 1 Frame (or a few frames) so it doesn't cause your game to lag.

Why not just use the picture as the event sprite?
 

Nilom

Veteran
Veteran
Joined
Sep 9, 2013
Messages
178
Reaction score
40
First Language
German
Primarily Uses
RMMV
It might be screenX() and screenY() and then multiply by the size of each tile (48x48 by default)

Thanks I will test that out.


Why not just use the picture as the event sprite?

What I'm trying to do is offering the player the choice where to move, when stepping on junctions. In the example picture below the code was:
Code:
$gameScreen.showPicture(98, "arrow_right", 1, $gameMap.event($turn_number)._realX*48, $gameMap.event($turn_number)._realY*48, 100, 100, 255, 0);
$gameScreen.showPicture(99, "arrow_down", 1, $gameMap.event($turn_number)._realX*48, $gameMap.event($turn_number)._realY*48, 100, 100, 255, 0);





Edit:
It might be screenX() and screenY() and then multiply by the size of each tile (48x48 by default)
Thanks it works perfectly fine now! Although I didn't need to multiply the value.

 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

Who would have thought making interesting birds would be so difficult/fun?

Randomly spawning anywhere on map (sometimes even flying), having a chance of landing on a different spot on map when flying. Also chance of flying off screen if spooked/sees the player

I think I got it!
Since I started in this world of make games, It's hard for me to enjoy playing a game. It's like, coding and make it work, sounds like I'm playing and have fun o_O
Not sure if it's true (and I won't judge or blame anyone if it is, really), but I heard from confident sources that you guys (and girls) really really like to
How is this new year for everyone? Hope you are well. Still deep in Covid in the US. Its like a vampire and refuses to die with even more strains. I need some holy water to kill it with.
in my game, what's known as HeadSpace is combining with the real world...

Forum statistics

Threads
107,670
Messages
1,031,316
Members
139,791
Latest member
Ender570
Top