MZ Show animation based on the coordinates of a picture

Hello everyone, good afternoon.
I would like to know if anyone here knows of a plugin that shows animation based on the coordinates of a picture, I mean X and Y.
I'm using the plugin: CTB_AnimationMZ
But it still doesn't contain that function.
I tried this, but nothing happens, l just heard the sound of animation:

CTB.PlayAnimationXY($gameScreen.picture(1).x(), $gameScreen.picture(1).y(), 18)


Thanks.
on map or on battlescreen? Because the mentioning of the plugin points toward you trying to place it on battlescreen, and that is different from the map.
on map or on battlescreen? Because the mentioning of the plugin points toward you trying to place it on battlescreen, and that is different from the map.
Oh sorry, l mean on map
Don't know for sure, but maybe you are only hearing the sound because the animations were being played below the picture.

Can you try to make this again with your picture opacity to 0, just to confirm?
Don't know for sure, but maybe you are only hearing the sound because the animations were being played below the picture.

Can you try to make this again with your picture opacity to 0, just to confirm?
Actually this plugin is weird to me.
It only works like this: If I put X Y of an event.
Example: CTB.PlayAnimationXY(5, 10, 18)
X Y ID animation
It seems to only work with X Y of events, but not of the events screen.
plugin: CTB_AnimationMZ
CTB can be read as "Charge Time Battle", which would be a type of battlesystem and thereby only work on the battlescreen, not on the map.

That is what pointed out my question above - can you link to that plugin or confirm that it is supposed to work on the map at all? Because if it is meant to work only on the battlescreen in one specific battlesystem, it would also explain why it doesn't work on the map as you want it...
Actually this plugin is weird to me.
It only works like this: If I put X Y of an event.
Example: CTB.PlayAnimationXY(5, 10, 18)
X Y ID animation
It seems to only work with X Y of events, but not of the events screen.
Maybe it's probably because it takes tiles coordinates and not pixel/screen coordinates.

Try to make it again with your pictures, but put that instead:

JavaScript:
CTB.PlayAnimationXY($gameScreen.picture(1)._x/48, $gameScreen.picture(1)._y/48, animationId)

Which means, divide your picture coordinates by 48.

Also, like Andar said, it can be helpful if you put the plugin link here.
Maybe it's probably because it takes tiles coordinates and not pixel/screen coordinates.

Try to make it again with your pictures, but put that instead:

JavaScript:
CTB.PlayAnimationXY($gameScreen.picture(1)._x/48, $gameScreen.picture(1)._y/48, animationId)

Which means, divide your picture coordinates by 48.

Also, like Andar said, it can be helpful if you put the plugin link here.
Almost!

1631047394149.png



PLugin : https://ct-bolt.itch.io/rmmz-animationmz-plugin
CTB can be read as "Charge Time Battle", which would be a type of battlesystem and thereby only work on the battlescreen, not on the map.

That is what pointed out my question above - can you link to that plugin or confirm that it is supposed to work on the map at all? Because if it is meant to work only on the battlescreen in one specific battlesystem, it would also explain why it doesn't work on the map as you want it...
Works on map also, because there is a command to show on events
It was supposed to play above that blue monster?

So taking a look at the code, I guess that the function you are using have 5 arguments:

JavaScript:
Game_Temp.prototype.playAnimationXY = function(x, y, animationId, mirror = false, abovePictures = false) {
        const id = $gameMap._animationEventId;
        $gameMap.event(id)._x     = x; $gameMap.event(id)._y    = y;
        $gameMap.event(id)._realX = x;$gameMap.event(id)._realY = y;
        this.playAnimationOnEvents(id, animationId, mirror, abovePictures);
    };

But still don't know exactly how this works. I believe it creates a custom event and use it to play the animation on the screen.

So, as you can see, the last argument of the function is for you to decide if you want to play the animation above the pictures(which is set as false by default).

And since the function seems to place this event in the coordinates X and Y inserted as arguments, maybe you can try something like that:

JavaScript:
const picture = $gameScreen.picture(1)
const x = Math.floor(picture._x/48)
const y = Math.floor(picture._y/48)

CTB.PlayAnimationXY(x, y, animationId, false, true)
It was supposed to play above that blue monster?

So taking a look at the code, I guess that the function you are using have 5 arguments:

JavaScript:
Game_Temp.prototype.playAnimationXY = function(x, y, animationId, mirror = false, abovePictures = false) {
        const id = $gameMap._animationEventId;
        $gameMap.event(id)._x     = x; $gameMap.event(id)._y    = y;
        $gameMap.event(id)._realX = x;$gameMap.event(id)._realY = y;
        this.playAnimationOnEvents(id, animationId, mirror, abovePictures);
    };

But still don't know exactly how this works. I believe it creates a custom event and use it to play the animation on the screen.

So, as you can see, the last argument of the function is for you to decide if you want to play the animation above the pictures(which is set as false by default).

And since the function seems to place this event in the coordinates X and Y inserted as arguments, maybe you can try something like that:

JavaScript:
const picture = $gameScreen.picture(1)
const x = Math.floor(picture._x/48)
const y = Math.floor(picture._y/48)

CTB.PlayAnimationXY(x, y, animationId, false, true)
IDK if l did correctly...

1631139310314.png

1631139321467.png

But still shows far from pic
IDK if l did correctly...

View attachment 200779
View attachment 200780
But still shows far from pic

You need to replace both first "0, 0" with the "x, y"
1631146742512.png
Unfortunately did not work 🙁
But l thank you for the help!

Original thread: https://forums.rpgmakerweb.com/threads/show-animation-based-on-the-coordinates-of-a-picture.140231/