MZ - Cae_Tweaks - lots of little features

● ARCHIVED · READ-ONLY
Started by caethyril 72 posts Page 3 of 4 View original ↗
  1. caethyril said:
    Oh wow, I just completely forgot to test for nested choices. :kaoswt2:
    Ah, nested was the word! I wrote such a complicated explanation just because I couldn't find the right word lol.

    Replaced the code and now it's working perfectly, thanks!
  2. dropping another thank you for the support!
  3. You're all welcome! :kaohi:

    I haven't spent a lot of time on my own project lately, been more focused on playing games rather than devving. It's good to have people point out bugs & stuff, though...after all, I'd like to avoid bugs in my own game, too!

    Updated to v15~
    • M26: should no longer apply double to map followers.
    • Q03: fixed default parameter value for "Param Names" (it was still using the pre-v14 one, with "Language" in it).
    • Q08: was rendered inoperative by a typo in v14. That's been fixed.
    • Q09: addressed alignment issues with RTL text.
    • Q16: added parameters "Settings" (to configure the dynamic range compression) & "Invert Value" (so you can choose whether turning the option on turns the compressor on or off).
    • Q31: added parameter "Log Key Codes" for debugging - previously this was always on in playtest, but I was finding it annoying.
    • Q32: restructured code so hue data is cached on, and updated through, the character instead. This incidentally enables comment tags and allows hue data to persist through save/load. Added a "Hue Property" parameter: leave blank to restore the previous behaviour, where hue will reset on save/load.
    • Q47: fixed issues re booting into fullscreen with NWJS. This is a more elegant fix than what I posted a few days ago, and should also fix the position issue @SeaPhoenix mentioned.
    • Q49: fixed merged choices and choice help descriptions when choices are nested. Basically just an extension of the fix I posted here.
    • Q50: fixed mini-help position conflicts on the name input scene, including accounting for inherited mini-help data on that scene. Also made minor edits to default mini-help texts.
    • D21: now uses a request system to avoid mid-frame load. Prompted by this:
      caethyril said:
      I wonder if it's related to the scene update cycle: if the load can complete part-way through a scene update, that could cause a temporary mismatch between $dataMap and $gameMap, giving this kind of error.

      I think it should be possible to work around that with a plugin that implements a "request" system, e.g.
      • Request "load game" in the event;
      • At the end of the update cycle, if load was requested, start loading;
      • Skip main updates while a load operation is in progress.
    New addition:
    • D26: lets you define custom initial/default values for the core options. E.g. so you can set BGM Volume to start at 20% rather than 100%.
  4. Just tested the fix for Q47: fullscreen and it works perfectly now. Thank you!
  5. I think this needs to be renamed to Cae's Overhaul soon xD

    Seriously tho, this is beyond amazing. You saved me from having like 20 extra plugins xD
  6. Caethyril can you help me? In your plugin have a tweaks to change Exp gauges can you help me giving me a plugin only with that
  7. @LeashaX - not easily, no, because:
    1. Feature Q46 does more than just add an EXP gauge, if that's really the only part you want.
    2. The plugin parameters may need to be edited, either:
      • Replaced with inline values, e.g. if the // Configure plugin section is removed; or
      • To account for a new file name and/or plugin parameter names.
    I don't think it would be worth the effort, personally, but if you want to edit it yourself then the code for that feature can be found by searching the plugin code for // Q46). Just remember it's MIT license, so the copyright notice should be included in an edited version.

    Note that if you only enable Q46 in the feature list, Cae_Tweaks will define a few utility functions but otherwise ignore the disabled features entirely. That's why I organised it like this, so stuff can be easily toggled on/off mid-development. File size for scripts is generally negligible compared to other game resources.

    (According to the update log Q46 hasn't been updated since v08; since that was the last version before I added plugin parameters/commands, a copy was retained: view/download Cae_Tweaks-v08 (Google Drive). Might be simpler to edit.)
  8. This has so much genius in this, such as Q35, way smarter than how I attempted to implement the same effect - and without touching spruite-method!

    I cannot get gauges to appear with Visustella, I'm assuming that is a compatibility issue?
  9. @Dark_Ansem - good to hear you're finding it useful!

    VisuStella's plugins are probably incompatible with various parts of this plugin, yes. I haven't done any testing on that front.
  10. for the animation on death, could you please add a couple parameter to limit it to enemies or not, and set a default death animation to play, without the need to notetag every enemy?

    this is what I did but I think yours works better


    JavaScript:
    /*:
     * @target MZ
     * @plugindesc Play animations when enemies die
     * @author Dark_Ansem
     *
     * @param defaultAnimation
     * @text Default Animation
     * @desc The ID of the animation to play when an enemy dies, if no notetag is specified.
     * @type animation
     * @default 1
     *
     * @help This plugin allows you to play animations when enemies die.
     *
     * To specify a custom animation for an enemy, use the following notetag in the enemy's note field:
     *
     * <deathAnimation:ID>
     *
     * Replace ID with the ID of the animation you want to play.
     *
     * If no notetag is specified, the default animation set in the plugin parameters will be played.
     *
     * To disable the animation for an enemy, use the following notetag in the enemy's note field:
     *
     * <noDeathAnimation>
     */
    
    (() => {
        const parameters = PluginManager.parameters('DeathAnimation');
        const defaultAnimation = Number(parameters['defaultAnimation']);
    
        const _Game_Enemy_performCollapse = Game_Enemy.prototype.performCollapse;
        Game_Enemy.prototype.performCollapse = function() {
            if (this.isEnemy()) {
                console.log(`Enemy ${this.enemyId()} died`);
                if (!this.enemy().meta.noDeathAnimation) {
                    const animationId = this.enemy().meta.deathAnimation || defaultAnimation;
                    console.log(`Playing animation ${animationId}`);
                    BattleManager._logWindow.push('showAnimation', this, [this], animationId);
                }
            }
            _Game_Enemy_performCollapse.call(this);
        };
    })();


    JavaScript:
    (() => {
        const pluginName = 'DeathAnimation';
        const parameters = PluginManager.parameters(pluginName);
        const defaultAnimation = Number(parameters['defaultAnimation'] || 1);
        const useDefault = parameters['useDefault'].toLowerCase() === 'true';
    
        // Override the die method of the Game_Enemy class
        const _Game_Enemy_die = Game_Enemy.prototype.die;
        Game_Enemy.prototype.die = function() {
            _Game_Enemy_die.call(this);
            // Store the death animation ID on the enemy object for later use
            this._deathAnimationId = this.deathAnimationId();
        };
    
        // Determine the ID of the death animation
        Game_Enemy.prototype.deathAnimationId = function() {
            // Check if the enemy has a deathAnimation notetag
            if (this.enemy().meta.deathAnimation) {
                // If it does, use the ID specified in the notetag
                return Number(this.enemy().meta.deathAnimation);
            } else if (useDefault) {
                // If it doesn't, but the useDefault parameter is true, use the default animation ID
                return defaultAnimation;
            } else {
                // If it doesn't and the useDefault parameter is false, don't play an animation
                return 0;
            }
        };
    
        // Override the updateEffect method of the Sprite_Enemy class
        const _Sprite_Enemy_updateEffect = Sprite_Enemy.prototype.updateEffect;
        Sprite_Enemy.prototype.updateEffect = function() {
            _Sprite_Enemy_updateEffect.call(this);
            if (this._effectType === 'collapse' && this._effectDuration % 20 === 19) {
                const animationId = this._battler._deathAnimationId;
                if (animationId > 0) {
                    this.parent.parent.startAnimation($dataAnimations[animationId], false, 0);
                }
            }
        };
    })();
  11. Dark_Ansem said:
    for the animation on death, could you please add a couple parameter to limit it to enemies or not, and set a default death animation to play, without the need to notetag every enemy?
    Just to put it out there, if caethyril doesn't have the time/desire to edit her work right now, you can easily do this with any plugin that allows you to add a notetag for when states are applied - such as my Eval Tags, or VisuStella's Skills and States.

    One notetag in state 1 with two lines of code.
  12. Oh because it's the death state?
  13. @Dark_Ansem - like Turan says, I'd suggest looking at a different plugin for that, particularly if you may want other checks with more complicated conditions. E.g. on apply for state 1:

    if (user.isEnemy()) $gameTemp.requestAnimation([user], 123);
    :kaohi:

    if you still want to add a default death animation to my plugin
    Find this part of my procDeathAnim function:
    JavaScript:
            if (a)
                $gameTemp.requestAnimation([target], a);
    ...and add an else clause starting on the next line, e.g.
    JavaScript:
            else
                $gameTemp.requestAnimation([target], 123);
    I.e. "if not tagged, play animation ID 123 on them instead".

    Alternatively, if you wanted the default to only play on enemies:
    JavaScript:
            else if (target.isEnemy())
                $gameTemp.requestAnimation([target], 123);
    [Edit: the suggestion in this spoiler is probably not a good idea, see my follow-up post.]
  14. caethyril said:
    @Dark_Ansem - like Turan says, I'd suggest looking at a different plugin for that, particularly if you may want other checks with more complicated conditions. E.g. on apply for state 1:

    if (user.isEnemy()) $gameTemp.requestAnimation([user], 123);
    :kaohi:

    if you still want to add a default death animation to my plugin
    Find this part of my procDeathAnim function:
    JavaScript:
            if (a)
                $gameTemp.requestAnimation([target], a);
    ...and add an else clause starting on the next line, e.g.
    JavaScript:
            else
                $gameTemp.requestAnimation([target], 123);
    I.e. "if not tagged, play animation ID 123 on them instead".

    Alternatively, if you wanted the default to only play on enemies:
    JavaScript:
            else if (target.isEnemy())
                $gameTemp.requestAnimation([target], 123);

    Thank you. Is the function self-contained?
  15. Dark_Ansem said:
    Thank you. Is the function self-contained?
    There's no function in her post. As she (and I) said, you'd put that code inside a notetag from a plugin that runs when a state is applied, such as my Eval Tags or VisuStella's Skills and States.
  16. ATT_Turan said:
    There's no function in her post.
    I should have clarified I meant in the original script.
  17. @Dark_Ansem - $gameTemp.requestAnimation is a core script method, and procDeathAnim uses it as such. Otherwise I don't know what you mean by "self-contained".

    Regardless, I've noticed that procDeathAnim, and thus the edit described in my spoiler, will process once per trait object: not a great idea. I recommend you go with Turan's suggestion~
  18. Updated to v16!
    • Added "Check for Duplicates" plugin parameter for Tag Names. If enabled, then during playtest this checks for duplicate tag identifiers when the plugin loads.
    • M08: the Popup Colour parameter now lets you enter a CSS colour via its Text tab, e.g.

      m08-css-colour.png
    • M11: now uses addCommand, not only splice. This is mainly to interface nicely with other patches, e.g. the new Q52.
    • M19: added an internal cache system, along with a corresponding plugin param in case you need to disable it for compatibility reasons.
    • M23: added Grow effect inversion, along with parameters to enable/disable this feature on a per-effect basis.
    • M28: added "Load Select Autosave" plugin parameter. After this thread I was suddenly aware of how annoying it is that the core game never auto-selects the autosave slot.
    • M29: now uses a regular expression to check cost body for "return". Slightly more robust, and now you can use local variables with return in the name. If that's what you want.
    • M35: adding a party command at Index = 0 now correctly positions it at the start of the list rather than the end.
    • M36: the "Retry" gameover command now checks for a save for this playthrough, and correctly checks the autosave timestamp.
    • Q01: made a micro-optimisation in the case that Step Size is set to 1.
    • Q12: like M28, this now uses addCommand, not just splice.
    • Q17: made the options window bounds calculation code a lot neater, and added a default description for new feature Q51.
    • Q26: now passes save errors on for further processing. Also now immediately hides the saving indicator if/when the save operation fails.
    • Q28: now uses StorageManager.exists; I guess I forgot that that function...exists. Also this feature now disables itself if the editor's "Skip Title Screen" option is enabled.
    • Q37: tidied up code for screen centre orbit calculation.
    • Q43: added safety checks for cases when the "Speed Values" parameter has fewer than 2 values.
    • Q45: like M08, the scrollbar colour now accepts CSS via the Text tab.
    • Q48: added "Idle Hide Time" parameter, allowing you to set the cursor to hide itself after remaining stationary for a certain time.
    • D12: added "Save Data" parameter. When enabled, the battle advantage flag is stored on $gameSystem instead of $gameTemp, allowing it to persist through save/load.
    • D17: the relevant accessor methods are now patched, rather than replaced. Might theoretically fix some compatibility problems (not that I've had any reports of such).
    • D21: added "Track Failed Saves" parameter. Effectively prevents the Save Count statistic from increasing if/when saving fails. Not sure why it took me so long to figure this one out, really.
    New additions:
    • M38: if a state has the <transform: 123> notetag, then when it is applied to an actor, the actor will "transform" into actor ID 123. When the state is removed, they'll revert. It's not a "real" transformation: basically it just changes a few properties like name, class, images.
    • Q51: adds an in-game Master Volume option.
    • Q52: adds a category window to the in-game options screen. Options are manually assigned a category via the plugin parameters. This doesn't change the display order of options, it just filters them.
    • Q53: adds the \T[phrase] message text code. This draws phrase as usual, but if you hover it with the cursor then it'll show the tip corresponding to that phrase, as defined in the plugin parameters. Also allows a button to cycle through available tips via the keyboard, default shift.
    • Q54: lets you customise the ON/OFF option text. Also lets you add gauges to the background of volume options (mostly because I wondered if it would look cool).
    • Q55: show state overlay graphics on battle enemies and/or map party members.
    • D27: make Move Toward and/or Move Away From type movements use pathfinding. Also allows changing the core pathfinding search limit.
    I also decided to attach a .txt file of the plugin's help section. :kaohi:
  19. A question; the command that allows animation playback on monster death, is it normal that only the animation plays but no sound as it gets overwritten by the collapse sound?
  20. Dark_Ansem said:
    A question; the command that allows animation playback on monster death, is it normal that only the animation plays but no sound as it gets overwritten by the collapse sound?
    If your animation SE and collapse SE are the same file then you can expect a conflict. That's core MZ: collapse SE is a system sound (Database -> System 1) which means that file is loaded into a static buffer, i.e. only 1 instance of that SE can play at a given time. If you play a static SE again while it's already playing, the SE will immediately stop and restart with the new volume, pitch, and pan settings.

    Otherwise, perhaps the collapse SE is drowning out the animation SE, or some other plugin you're using is interfering/conflicting in some way.