MZ - [SOLVED] Help with Chrono Engine animations

● ARCHIVED · READ-ONLY
Started by AmeerAshourDraws 19 posts View original ↗
  1. Hello there! For the past few days, I've been working on porting Moghunter's Chrono Engine (mainly the Chrono Mode) into MZ. So far, I got everything working without the need for Fossil, but I have an issue with the animations.

    After tempering around with the code, I got the attacks and spells themselves working, but the animations wouldn't even play, and there's a good chance it would throw in an error because of this part of the code:
    Screenshot 2025-03-24 004636.png
    Now, before anyone says anything, I know what command212 is, it's the interpreter command for showing the animations, but it always shows an error message of "Cannot Read Property '0' Unidentified", which is strange, because from what I've researched, this is supposed to be how it's laid out, unless I'm missing something because I am porting an MV plugin into MZ. I tried some ideas with it in hopes of fixing it and showing the animations, but I couldn't think of anything.

    If anyone knows the solution behind this, I'd gladly appreciate it.
  2. (Untested) I assume that you have to pass a params parameter for the function since MZ does not use ._params:
    JavaScript:
    const _mog_chrono_gint_command212 = Game_Interpreter.prototype.command212;
    Game_Interpreter.prototype.command212 = function(params) {
        if (params[0] === 0 && this._eventTool[1]) {
            this.setCommand212Tool();
            return true;
        }
        _mog_chrono_gint_command212.call(this, params);
        return true;
    };
  3. bass2yang said:
    (Untested) I assume that you have to pass a params parameter for the function since MZ does not use ._params:
    JavaScript:
    const _mog_chrono_gint_command212 = Game_Interpreter.prototype.command212;
    Game_Interpreter.prototype.command212 = function(params) {
        if (params[0] === 0 && this._eventTool[1]) {
            this.setCommand212Tool();
            return true;
        }
        _mog_chrono_gint_command212.call(this, params);
        return true;
    };
    I tried that after some research, but it didn't work when I tried it. I'm give it another shot tomorrow though
  4. bass2yang said:
    (Untested) I assume that you have to pass a params parameter for the function since MZ does not use ._params:
    JavaScript:
    const _mog_chrono_gint_command212 = Game_Interpreter.prototype.command212;
    Game_Interpreter.prototype.command212 = function(params) {
        if (params[0] === 0 && this._eventTool[1]) {
            this.setCommand212Tool();
            return true;
        }
        _mog_chrono_gint_command212.call(this, params);
        return true;
    };
    Okay, I gave this one a shot, and it thankfully didn't give me an error. This one showed me that I forgot to add the params argument to the command212.call function at the end. Now it's working without errors, but the actual animations are still not working, but it's definitely an MZ issue.

    Thanks anyway!
  5. You should be able to reference game command 212 tool and edit it as well:
    JavaScript:
    const _mog_chrono_gint_command212 = Game_Interpreter.prototype.command212;
    Game_Interpreter.prototype.command212 = function(params) {
        if (params[0] === 0 && this._eventTool[1]) {
            this.setCommand212Tool(params);
            return true;
        }
        _mog_chrono_gint_command212.call(this, params);
        return true;
    };
    Game_Interpreter.prototype.setCommand212Tool = function(params) {
        this._character = this._eventTool[1];
        if (this._character) {
            $gameTemp.requestAnimation([this._character], params[1]);
            if (params[2]) {
                this.setWaitMode('animation');
            };
        };
    };

    (Untested - not at a computer, but give it a shot)
  6. bass2yang said:
    You should be able to reference game command 212 tool and edit it as well:
    JavaScript:
    const _mog_chrono_gint_command212 = Game_Interpreter.prototype.command212;
    Game_Interpreter.prototype.command212 = function(params) {
        if (params[0] === 0 && this._eventTool[1]) {
            this.setCommand212Tool(params);
            return true;
        }
        _mog_chrono_gint_command212.call(this, params);
        return true;
    };
    Game_Interpreter.prototype.setCommand212Tool = function(params) {
        this._character = this._eventTool[1];
        if (this._character) {
            $gameTemp.requestAnimation(this._character, params[1]);
            if (params[2]) {
                this.setWaitMode('animation');
            };
        };
    };

    (Untested - not at a computer, but give it a shot)
    I implemented this, and now the sound effects and flash effects are working, but the animation sprites themselves aren't playing/visible... I have no idea what the reason could be
  7. AmeerAshourDraws said:
    I implemented this, and now the sound effects and flash effects are working, but the animation sprites themselves aren't playing/visible... I have no idea what the reason could be
    I forget how to circumvent the MZ effekseer animations - I think you need MV compatible animations for it or you need to activate it in the database system. Sorry, I don't have MZ. Glad the code is partially working though.

    Or you can mess around with the MZ side and see if you can come up with a proper solution for it. Hope all goes well!
  8. bass2yang said:
    I forget how to circumvent the MZ effekseer animations - I think you need MV compatible animations for it or you need to activate it in the database system. Sorry, I don't have MZ. Glad the code is partially working though.

    Or you can mess around with the MZ side and see if you can come up with a proper solution for it. Hope all goes well!
    That's okay, you were a huge help, either way, and I can't thank you enough! I'll do my best to see how to handle the other stuff :]
  9. AmeerAshourDraws said:
    That's okay, you were a huge help, either way, and I can't thank you enough! I'll do my best to see how to handle the other stuff :]
    Hmm, I forgot one thing. Try putting [this._character] under the game temp request animation. I think it needs to be an array. My mistake. I'll change it above as well.
  10. bass2yang said:
    Hmm, I forgot one thing. Try putting [this._character] under the game temp request animation. I think it needs to be an array. My mistake. I'll change it above as well.
    Just tried it, and nothing has changed
  11. Just thinking through this - have you forced an animation with just the normal command 212?

    Also, for this line:
    JavaScript:
    $gameTemp.requestAnimation([this._character], ...
    Do
    Code:
    console.log(this._character)
    to see if anything shows. Then, change [this._character] to [$gamePlayer] to see if you can force an animation on the player.

    I wonder if this._eventTool[1] has anything in it. Let me know if you track anything else down.
  12. bass2yang said:
    Just thinking through this - have you forced an animation with just the normal command 212?

    Also, for this line:
    JavaScript:
    $gameTemp.requestAnimation([this._character], ...
    Do
    Code:
    console.log(this._character)
    to see if anything shows. Then, change [this._character] to [$gamePlayer] to see if you can force an animation on the player.

    I wonder if this._eventTool[1] has anything in it. Let me know if you track anything else down.
    Okay, I followed your advice and did what you said, and when I replaced [this._character] to [$gamePlayer], the sprite animations and the MZ Effekseer animations are now visible only on the player. I think the engine was having a hard time figuring out who to target the animation on.
  13. AmeerAshourDraws said:
    Okay, I followed your advice and did what you said, and when I replaced [this._character] to [$gamePlayer], the sprite animations and the MZ Effekseer animations are now visible only on the player. I think the engine was having a hard time figuring out who to target the animation on.
    Got it - it does look like there is a hiccup somewhere to where this._eventTool[1] is coming up as null since we are setting this._character to it.

    Console log injections to the code at specific functions and timings (espcially when things are being assigned to the this._eventTool array) should give you what you need.
  14. bass2yang said:
    Got it - it does look like there is a hiccup somewhere to where this._eventTool[1] is coming up as null since we are setting this._character to it.

    Console log injections to the code at specific functions and timings (espcially when things are being assigned to the this._eventTool array) should give you what you need.
    Well, I've been trying to find a fix for this, but I'm unable to find it. I did check the console, and everything looks fine, it even detected where the target event was (sorry about the image, was taken from my phone as a reference).
    1000034435.jpg
    I'm not exactly sure what I'm doing wrong, or where to look to hunt the error down. I tried searching for similar _eventTool lines in the script, and they're around the same area for the other commands.
  15. bass2yang said:
    Got it - it does look like there is a hiccup somewhere to where this._eventTool[1] is coming up as null since we are setting this._character to it.

    Console log injections to the code at specific functions and timings (espcially when things are being assigned to the this._eventTool array) should give you what you need.

    Well, great news! I've managed to find the solution to the problem! It took me a lot of fiddling around and reading the code to find the solution, and what eventually worked was taking the "this.user().battler()._chrono.targets[0]" from the code's Game_Interpreter function that prototypes the targets and plop it into the requestAnimation code. I tested it out with both the player and the enemies, and I can confirm that it's working marvelously without an error!

    JavaScript:
    Game_Interpreter.prototype.setCommand212Tool = function (params) {
        this._character = this._eventTool[1];
        if (this._character) {
            $gameTemp.requestAnimation([this.user().battler()._chrono.targets[0]], params[1]);
            if (params[2]) {
                this.setWaitMode('animation');
            };
        };
    };
  16. Awesome!

    I am curious, what shows up in the console when you use this code? Something must be showing up for the condition to work.
    JavaScript:
    Game_Interpreter.prototype.setCommand212Tool = function (params) {
        this._character = this._eventTool[1];
        if (this._character) {
            console.log(this._character);
            $gameTemp.requestAnimation([this.user().battler()._chrono.targets[0]], params[1]);
            if (params[2]) {
                this.setWaitMode('animation');
            };
        };
    };
  17. bass2yang said:
    Awesome!

    I am curious, what shows up in the console when you use this code?
    JavaScript:
    Game_Interpreter.prototype.setCommand212Tool = function (params) {
        this._character = this._eventTool[1];
        if (this._character) {
            console.log(this._character);
            $gameTemp.requestAnimation([this.user().battler()._chrono.targets[0]], params[1]);
            if (params[2]) {
                this.setWaitMode('animation');
            };
        };
    };
    Well, given where the console command is placed here, it prints out what this._eventTool[1] is, which from my attempts, it's the ToolEvent being used when the animation is being played. I looked everywhere in it to see if there's anything of note there, I even found out that it found the targets it was going for no problem.

    I think my theory here for what went wrong was that since this was an MV plugin and MV's requestAnimation command didn't require the target to be specified when executing an animation like MZ does, the plugin was relying on the ToolEvent itself to handle where the target was and to execute the animation. MZ, on the other hand, requires you to be a lot more precise with the target, and I initially tried referencing the ToolEvent's target after looking up the console, something along the lines of "this._character.ToolEvent._tool.target" and other variations of it, but it would always say it was undefined. And after fiddling around, I managed to find the key I needed to solve this.
  18. Just some thoughts if you want to read:
    Spoiler
    Based on what I am seeing, it appears that MZ might not be seeing the Tool Event (this._character when assigned to this._eventTool[1]) as an actual event on the map. I am not sure if there will be issues down the line since the "target" and the "tool" tend to occur in the same vicinity/area, there won't be much (if any at all) of a difference to go directly to the target rather than the tool.

    Also, the 212 command tool seems to only affected by when you use the command "Show Animation" - this means all other .requestAnimation() functions in Chrono Engine are probably still based on the format character.requestAnimation() where the character is tied to the start of the function and not the MZ format $gameTemp.requestAnimation([character]...) where the character is an array parameter inside a game temp.

    The closest variation from the Tool Event to reference a character inside the command 212 function from Chrono Engine would be:
    JavaScript:
    this._character._tool.target
    What is interesting is that this._character._tool by itself yields the object containing everything, including the target. But if you were to reference the target directly as shown above, it returns null.
    I delayed the code with a setTimeout() by at least 1ms and it was able to obtain the target and work, but no longer "targets" the tool; it targets the enemy event (which is okay, there are plenty of workarounds with offsets, etc to make it work, and most the time, the tool will be on or near the target anyways).

    In any case, just a few things to consider when doing animations - most people will do "show animation" on this event (referring to the tool) or use the comment tool_animation_id : # to show the animation on the tool.
    I always say, if it is working and not breaking anything - keep it the same and look for optimizations later, if even needed.
  19. bass2yang said:
    Just some thoughts if you want to read:
    Spoiler
    Based on what I am seeing, it appears that MZ might not be seeing the Tool Event (this._character when assigned to this._eventTool[1]) as an actual event on the map. I am not sure if there will be issues down the line since the "target" and the "tool" tend to occur in the same vicinity/area, there won't be much (if any at all) of a difference to go directly to the target rather than the tool.

    Also, the 212 command tool seems to only affected by when you use the command "Show Animation" - this means all other .requestAnimation() functions in Chrono Engine are probably still based on the format character.requestAnimation() where the character is tied to the start of the function and not the MZ format $gameTemp.requestAnimation([character]...) where the character is an array parameter inside a game temp.

    The closest variation from the Tool Event to reference a character inside the command 212 function from Chrono Engine would be:
    JavaScript:
    this._character._tool.target
    What is interesting is that this._character._tool by itself yields the object containing everything, including the target. But if you were to reference the target directly as shown above, it returns null.
    I delayed the code with a setTimeout() by at least 1ms and it was able to obtain the target and work, but no longer "targets" the tool; it targets the enemy event (which is okay, there are plenty of workarounds with offsets, etc to make it work, and most the time, the tool will be on or near the target anyways).

    In any case, just a few things to consider when doing animations - most people will do "show animation" on this event (referring to the tool) or use the comment tool_animation_id : # to show the animation on the tool.
    I always say, if it is working and not breaking anything - keep it the same and look for optimizations later, if even needed.
    I decided to give this a shot because I do remember trying something similar to what you've suggested, but it didn't work. I tried going for what you've sent, and I get a message saying that the target was null. Yeah, it's pretty finicky how it works, I couldn't even reference the targets the eventTool was referencing without it bugging out.

    But that's fine, I already found the solution, but I figured that I'd try your suggestion because I'm not the brightest at scripting, but it was worth a shot regardless! Thanks for all the help you've given me, I truly couldn't have done this without you! ^^