MZ [Solved] Pinning an event's image to screen's XY coordinates

I would like to help the player keep track of the drink orders by showing which customer ordered which drink. Thus, I would like to place event's sprite next to the picture of the drink ordered. I tried illustrating the situation using the screenshot below.

But I do not know how to pin an event's sprite to the very specific window coordinates (i.e. here the X:Y are 26:61).

Please could you help me with advice on how to accomplish this task?

All suggestions are welcome! Thank you!

Illustration.png
You can't, without changing scripts.

Event sprites use map coordinates. Pictures use screen (window) coordinates.

How are you displaying the drink? Display the character in the same way. This might mean you need to create a file in the Pictures folder for each character, using just a single frame rather than a 3x4 grid.
two ways:
you can either use a HUD-type plugin, or you can use a show picture on parallel process.

the parallel process is usually the bad solution because it causes lag when excessively used, or have the display flicker if you try to reduce lag in a wrong way. But in some simpler cases it is easier to handle than a HUD type plugin.
You can't, without changing scripts.

Event sprites use map coordinates. Pictures use screen (window) coordinates.

How are you displaying the drink? Display the character in the same way. This might mean you need to create a file in the Pictures folder for each character, using just a single frame rather than a 3x4 grid.

Thank you. Indeed, the fallback plan is to cut the sprites up into single face files and to display these files as pictures next to the drinks.

I was wondering if there are API methods allowing something like:

JavaScript:
let img = $magic.magic.event(10).get_image(2)
$gameScreen.showPicture(..., img, ...)

//Pseudocode! Not actual code! This doesn't work and not supposed to work!
The image file name is saved on the event, but the sprite grabs the appropriate frame from that image on the fly. And IIRC, the link goes from the sprite to the event but not the other way around (if you have the sprite object, you can go back to the event it belongs to, but if you have the event, you can't figure out which sprite belongs to it).

I guess you could get the image associated with the event, then pull out the centre top pixels. But Show Picture expects a file in the Pictures folder so you'd have to write code to get around that. Like I said ... you can't do it without changing scripts.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Re-opened at OP's request.

Alright, so, one can get a character sprite "pinned" to the screen, just like any regular image:

Untitled.png


The code is:

JavaScript:
var spr = new Sprite(ImageManager.loadCharacter('Actor1'))
SceneManager._scene.addChild(spr)
spr.texture.frame = new Rectangle(0, 0, 50, 50)
spr.x = 20
spr.y = 20

Spoiler: Link to the tutorial I learned it from


And here are the actual JS bits that produce the screenshot above:
Spoiler: My Screen
JavaScript:
let spr_w = 48
let spr_h = 48
let spr_count_x = -999
let spr_count_y = -999

spr_count_x = 1
spr_count_y = 0
var spr1 = new Sprite(ImageManager.loadCharacter('Actor1'))
SceneManager._scene.addChild(spr1)
spr1.texture.frame = new Rectangle(spr_w*spr_count_x, spr_h*spr_count_y, spr_w, spr_h)
spr1.x = 20
spr1.y = 20

spr_count_x = 7
spr_count_y = 0
var spr2 = new Sprite(ImageManager.loadCharacter('Actor1'))
SceneManager._scene.addChild(spr2)
spr2.texture.frame = new Rectangle(spr_w*spr_count_x, spr_h*spr_count_y, spr_w, spr_h)
spr2.x = 20
spr2.y = 68

spr_count_x = 1
spr_count_y = 4
var spr3 = new Sprite(ImageManager.loadCharacter('Actor1'))
SceneManager._scene.addChild(spr3)
spr3.texture.frame = new Rectangle(spr_w*spr_count_x, spr_h*spr_count_y, spr_w, spr_h)
spr3.x = 118
spr3.y = 20

spr_count_x = 4
spr_count_y = 4
var spr4 = new Sprite(ImageManager.loadCharacter('Actor1'))
SceneManager._scene.addChild(spr4)
spr4.texture.frame = new Rectangle(spr_w*spr_count_x, spr_h*spr_count_y, spr_w, spr_h)
spr4.x = 118
spr4.y = 68

$gameScreen.showPicture(10, "_Notes_CRP", 0, 20, 10, 40, 40, 255, 0)
$gameScreen.showPicture(11, "_Beer_CRP", 0, 65, 30, 50, 30, 255, 0)
$gameScreen.showPicture(12, "_Beer_CRP", 0, 65, 78, 50, 30, 255, 0)
$gameScreen.showPicture(13, "_Beer_CRP", 0, 165, 30, 50, 30, 255, 0)
$gameScreen.showPicture(14, "_Beer_CRP", 0, 165, 78, 50, 30, 255, 0)

//The code above is a sample for tinkering.
//The actual production code, naturally, consists of classes, loops and dictionaries.
//And launched from the backend :)

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-pinning-an-events-image-to-screens-xy-coordinates.146328/