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,168
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
37,033
Reaction score
10,029
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
44,935
Reaction score
15,991
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);

25hixww.jpg




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.

o59aaf.jpg
 
Last edited:

Latest Profile Posts

War and Wonder is a 100% choice-based open-world visual novel.
1664821313732.png
1664821466359.png
1664821547746.png
Going live soon on Twitch, and will continue Fortunastreet's game "Verloren". For those who are curious, you are welcome to join ;)

-> Franz' Twitch channel
still cursed with having an issue then solving it myself as soon as someone else explains it to me/is trying to help.

sure hope nobody thinks im weird not responding to them after they're only trying to help.
Erecting a giant stone monolith and inscribing the words "keep it simple stupid" upon it.

Forum statistics

Threads
125,746
Messages
1,173,186
Members
164,901
Latest member
one_games
Top