lordvalinar

Lord of the Damned
Veteran
Joined
Mar 31, 2013
Messages
331
Reaction score
196
First Language
English
Primarily Uses
RMMZ
I know for MV, there were plugins that could play the animation based on XY coordinates (could even play them in battle), but since MZ uses Effekseer - and I tried looking at that code but that goes all the way back in js/libs/effekseer.min.js and I can't figure out how to use that knowledge to my advantage...

I know the function (and line) in which I think it's being used in.. and I know there's an update coming (or came?) allowing MV animation support in the editor which is nice.. (special thank you for that <3) but... is there a way to target MZ effekseer animations to a specific location?

Weird example: If there's an animation made for a watering can(farming system?) and you want it to play just in front of the player's position (so let's say facing right, $gamePlayer.x + number, $gamePlayer.y)

Any ideas how to do that?
 

NaosoX

Veteran
Veteran
Joined
Feb 28, 2013
Messages
524
Reaction score
300
First Language
English
Primarily Uses
RMMZ

Theres a plugin command to do just that.

Weird example: If there's an animation made for a watering can(farming system?) and you want it to play just in front of the player's position (so let's say facing right, $gamePlayer.x + number, $gamePlayer.y)
If you already have a character holding a watering can as a sprite, you may just want to animate the sprite.
 
Last edited:

lordvalinar

Lord of the Damned
Veteran
Joined
Mar 31, 2013
Messages
331
Reaction score
196
First Language
English
Primarily Uses
RMMZ

Theres a plugin command to do just that.


If you already have a character holding a watering can as a sprite, you may just want to animate the sprite.
As awesome as that is, doesn't really help in this scenario. I'm trying to learn how to do it :p And VisuMZ code are obfuscated/minified, so I can't take a peek either.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,901
Reaction score
2,219
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi there!

Well, I have to say, I'm not so sure about that. I also have trouble understanding
But it seems to me that the Spriteset_Base is the one that handles the creation and the "start" of the animations.

JavaScript:
Spriteset_Base.prototype.updateAnimations
Spriteset_Base.prototype.processAnimationRequests
Spriteset_Base.prototype.createAnimation
Spriteset_Base.prototype.createAnimationSprite
etc...

If you take a look at the Game_Interpreter that does the Play Animation command, it sends a request to the Game_Temp with the character object and animation id
1637902800708.png

This request is retrieved on the Spriteset_Base
1637902856569.png

Then it process to the creation of the Sprite Animation and target sprites, which are set as "target objects" on the created animation.

1637903059675.png

Honestly, I think there are too many steps to play an animation.
So, my point is: if you want to play an animation on an X Y position, even if you don't understand(like me xD) how the whole process work, you can just create an invisible and temporary Character Object and Sprite, put them at the X Y position, and request an animation to play on them, with the below function:

$gameTemp.requestAnimation([character], animationId)

When the animation is finished, you can delete this character and his sprite.

BUT, if you want to take a look and understand better, I think CT Bolt made a plugin for MZ that does that (and it is not obfuscated, I believe).
 

lordvalinar

Lord of the Damned
Veteran
Joined
Mar 31, 2013
Messages
331
Reaction score
196
First Language
English
Primarily Uses
RMMZ
EDIT2: Looks like they just created new/temporary events at the location they wanted before calling the animation request o_O I mean... I guess I could do that (would make it a dependent plugin though, and I try to avoid that that unless its' specifically an add-on) but it would work at least...

EDIT: I'll also take a look at that plugin :)

I believe the answer lies somewhere in updateEffectGeometry() but as I mentioned in the OP it goes all the way back to js/libs/effekseer.min.js with the handler.setLocation() function.

Mainly because this is the function called when creating those target sprites, but as you can see from it below that it's quite different from the MV function that has x and y values..

JavaScript:
Sprite_Animation.prototype.updateEffectGeometry = function() {
    const scale = this._animation.scale / 100;
    const r = Math.PI / 180;
    const rx = this._animation.rotation.x * r;
    const ry = this._animation.rotation.y * r;
    const rz = this._animation.rotation.z * r;
    if (this._handle) {
        this._handle.setLocation(0, 0, 0);
        this._handle.setRotation(rx, ry, rz);
        this._handle.setScale(scale, scale, scale);
        this._handle.setSpeed(this._animation.speed / 100);
    }
};

JavaScript:
Sprite_AnimationMV.prototype.updatePosition = function() {
    if (this._animation.position === 3) {
        this.x = this.parent.width / 2;
        this.y = this.parent.height / 2;
    } else if (this._targets.length > 0) {
        const target = this._targets[0];
        const parent = target.parent;
        const grandparent = parent ? parent.parent : null;
        this.x = target.x;
        this.y = target.y;
        if (this.parent === grandparent) {
            this.x += parent.x;
            this.y += parent.y;
        }
        if (this._animation.position === 0) {
            this.y -= target.height;
        } else if (this._animation.position === 1) {
            this.y -= target.height / 2;
        }
    }
};
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

Only 3 more days to get your copy of Move That Box! with -15% discount!
1660090657213.png
Mistakes will be made.
After three years, it was awesome to be back at Gen Con!
Words of Wisdom: You can be honest and alone. Or dishonest and together.
Working on mapping using RPGTools to create parallax maps using PVgames tiles/assets. It's super cool... but mapping is still something I drag my feet on getting done. I hate this but love the math parts of design, which is the opposite of a lot of dev's around, I think. It really do be different strokes for different folks.

Forum statistics

Threads
124,381
Messages
1,163,226
Members
163,180
Latest member
Viking
Top