MV Stop the Victory Animation from looping?

Hello everyone,

So I'm sorting out some custom animations for my Sv_battlers and its going well, but for one of my characters, I would like to make it so their victory animation does not loop, but instead stops on the last frame of the animation.
For the record I'm using the standard Yanfly battle suite of plugins, and the victory aftermath plugins.

I'm also using Yami's SV_Battler plugin for more frames of animation.

Does anyone know how to do this? Ideally I could leave some characters victory animations looping while turning it off for others, but failing that I would settle for just stopping them all from looping.

Thanks for any help 🙂
You can copy this function from the core scripts:
Code:
Sprite_Actor.MOTIONS = {
    walk:     { index: 0,  loop: true  },
    wait:     { index: 1,  loop: true  },
    chant:    { index: 2,  loop: true  },
    guard:    { index: 3,  loop: true  },
    damage:   { index: 4,  loop: false },
    evade:    { index: 5,  loop: false },
    thrust:   { index: 6,  loop: false },
    swing:    { index: 7,  loop: false },
    missile:  { index: 8,  loop: false },
    skill:    { index: 9,  loop: false },
    spell:    { index: 10, loop: false },
    item:     { index: 11, loop: false },
    escape:   { index: 12, loop: true  },
    victory:  { index: 13, loop: true  },
    dying:    { index: 14, loop: true  },
    abnormal: { index: 15, loop: true  },
    sleep:    { index: 16, loop: true  },
    dead:     { index: 17, loop: true  }
};

Paste it into a text editor, save it as a *.js file, include as a plugin.

Try changing victory to "loop: false".
That's an object: you only need to change the appropriate property, i.e. a single-line plugin:
JavaScript:
Sprite_Actor.MOTIONS.victory.loop = false;
That's nice and simple, but it will affect everyone equally. If you want to affect only one actor, you'll need a different approach. Maybe something like this (untested):
Spoiler: plugin code
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc <no victory loop> notetag for Actors.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/162530/
 * @help Free to use and/or modify for any project, no credit required.
 */
;void (function(alias) {
'use strict';
  const TAG_NAME = "no victory loop";

  Sprite_Actor.prototype.startMotion = function(motionType) {
    // perform usual method
    alias.apply(this, arguments);
    // special handling for victory motion
    if (motionType === "victory" && this._battler.actor().meta[TAG_NAME]) {
      // shallow-copy the assigned static record
      this._motion = Object.assign({}, this._motion);
      // modify copy
      this._motion.loop = false;
    }
  };

})(Sprite_Actor.prototype.startMotion);
[Edit: an alternative could be to target the updateMotionCount method instead.]
That's an object:
Well, so it is. Pssh, details 😛
Thanks guys for your responses 🙂

I tried this plugin Caethyril but it didn't seem to work. I even tried it at the top of the plugin list but no dice. Not sure why, I made sure it was on and the actor had the correct notetag.

I've also tried the simple turn off all victory loops plugin you kindly provided and I can't get that to work either :/ I wonder if its an existing plugin stopping this from working?

Thanks again for your help, guys.
Ah, OK. I tested in MV and noticed that, by default, simply setting the victory motion loop to false (with either approach) makes it perform one cycle and then revert to "wait". 😴

Here's an adjusted version that suppresses the refresh at the end of a non-looping victory motion:
Spoiler: plugin code v2
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc <no victory loop> notetag for Actors (v2).
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/162530/
 * @help Free to use and/or modify for any project, no credit required.
 */
;void (function() {
'use strict';
  const TAG_NAME = "no victory loop";

  const PROP = "_isVictoryMotion";

  void (function(alias) {
    Sprite_Actor.prototype.startMotion = function(motionType) {
      // perform usual method
      alias.apply(this, arguments);
      // special handling for victory motion
      if (motionType === "victory" && this._battler.actor().meta[TAG_NAME]) {
        // shallow-copy the assigned static record
        this._motion = Object.assign({}, this._motion);
        // modify copy
        this._motion.loop = false;
        // flag for non-refresh
        this[PROP] = true;
      } else
        // remove flag
        delete this[PROP];
    };
  })(Sprite_Actor.prototype.startMotion);

  void (function(alias) {
    Sprite_Actor.prototype.refreshMotion = function() {
      if (!(PROP in this))
        alias.apply(this, arguments);
    };
  })(Sprite_Actor.prototype.refreshMotion);

})();
It seems to work for me in MV with no other plugins active. 👋

If that's not what you're seeing, here are some ideas:
  1. The <no victory loop> tag has to be in the Note box of each relevant Actor. It is also case-sensitive.

  2. Remember to save your project to apply Plugin Manager changes before testing.

  3. It might be a plugin conflict: try turning off all other plugins, save your project, then test. If it works with the other plugins disabled, you could try rearranging the load order to see if that helps; again, remember to save your project to apply Plugin Manager changes before testing.

  4. Press F8 during test (or F12 if that fails) to open the dev tools window. Check the Console tab of that window for any red text (errors). If a plugin throws an error while loading, the game will ignore the entire plugin.
Also, just to note: to make sure a plugin applies its changes, put it at the bottom of the list. If plugin A loads after plugin B, then A can replace changes made by B. That's why it's usually recommended to load smaller, more specific plugins after larger, more general ones.

Edit:

I've moved this thread to Plugin Support (from MV Support). Thank you.

Since you're using Yami's SV battler plugin from the DLC folder, it's instructions say:
Spoiler
Actors & Enemies Notetags

* <Sideview Battler Motion>
* Name: NAME
* Index: INDEX
* Loop
* Frames: X
* Speed: Y
* </Sideview Battler Motion>
* Add new motion (pose) for current battler.
* Loop is for looping motion.
* Frames and Speed is for custom frames and speed from the default ones.
* Loop, Frames and Speed can be omitted.

* Notes
*
* 1. Frame will be started from 0 (first frame of the pose).
* 2. All default motions to be setup:
* walk wait chant guard damage
* evade thrust swing missile skill
* spell item escape victory dying
* abnormal sleep dead
* 3. All battlers should have the motion "walk". If any of default motions is
* not setup, the "other" motion will be used, "walk" will be used instead
* if "other" hasn't been setup.
* 4. Current version only support animated enemies with Yanfly's Animated
* Sideview Enemies. This will be standalone on next version.
* 5. When using with Yanfly's Animated Sideview Enemies, the sprite width and
* height should be set manually instead of 'auto'.

The way I understand that is that you can set a basic motion to not loop? Haven't used it myself though.
Since you're using Yami's SV battler plugin from the DLC folder, it's instructions say:
Spoiler
Actors & Enemies Notetags

* <Sideview Battler Motion>
* Name: NAME
* Index: INDEX
* Loop
* Frames: X
* Speed: Y
* </Sideview Battler Motion>
* Add new motion (pose) for current battler.
* Loop is for looping motion.
* Frames and Speed is for custom frames and speed from the default ones.
* Loop, Frames and Speed can be omitted.

* Notes
*
* 1. Frame will be started from 0 (first frame of the pose).
* 2. All default motions to be setup:
* walk wait chant guard damage
* evade thrust swing missile skill
* spell item escape victory dying
* abnormal sleep dead
* 3. All battlers should have the motion "walk". If any of default motions is
* not setup, the "other" motion will be used, "walk" will be used instead
* if "other" hasn't been setup.
* 4. Current version only support animated enemies with Yanfly's Animated
* Sideview Enemies. This will be standalone on next version.
* 5. When using with Yanfly's Animated Sideview Enemies, the sprite width and
* height should be set manually instead of 'auto'.

The way I understand that is that you can set a basic motion to not loop? Haven't used it myself though.

That plugin was actually the first place I looked to try and stop the victory loop, and while you can set how something loops and even make it loop, it doesn't seem like you can stop something that loops by default from looping.
In other words, you can switch on loops, but you can't switch it off with that plugin (as far as I can tell 😛)

Ah, OK. I tested in MV and noticed that, by default, simply setting the victory motion loop to false (with either approach) makes it perform one cycle and then revert to "wait". 😴

Here's an adjusted version that suppresses the refresh at the end of a non-looping victory motion:
Spoiler: plugin code v2
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc <no victory loop> notetag for Actors (v2).
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/162530/
 * @help Free to use and/or modify for any project, no credit required.
 */
;void (function() {
'use strict';
  const TAG_NAME = "no victory loop";

  const PROP = "_isVictoryMotion";

  void (function(alias) {
    Sprite_Actor.prototype.startMotion = function(motionType) {
      // perform usual method
      alias.apply(this, arguments);
      // special handling for victory motion
      if (motionType === "victory" && this._battler.actor().meta[TAG_NAME]) {
        // shallow-copy the assigned static record
        this._motion = Object.assign({}, this._motion);
        // modify copy
        this._motion.loop = false;
        // flag for non-refresh
        this[PROP] = true;
      } else
        // remove flag
        delete this[PROP];
    };
  })(Sprite_Actor.prototype.startMotion);

  void (function(alias) {
    Sprite_Actor.prototype.refreshMotion = function() {
      if (!(PROP in this))
        alias.apply(this, arguments);
    };
  })(Sprite_Actor.prototype.refreshMotion);

})();
It seems to work for me in MV with no other plugins active. 👋

If that's not what you're seeing, here are some ideas:
  1. The <no victory loop> tag has to be in the Note box of each relevant Actor. It is also case-sensitive.

  2. Remember to save your project to apply Plugin Manager changes before testing.

  3. It might be a plugin conflict: try turning off all other plugins, save your project, then test. If it works with the other plugins disabled, you could try rearranging the load order to see if that helps; again, remember to save your project to apply Plugin Manager changes before testing.

  4. Press F8 during test (or F12 if that fails) to open the dev tools window. Check the Console tab of that window for any red text (errors). If a plugin throws an error while loading, the game will ignore the entire plugin.
Also, just to note: to make sure a plugin applies its changes, put it at the bottom of the list. If plugin A loads after plugin B, then A can replace changes made by B. That's why it's usually recommended to load smaller, more specific plugins after larger, more general ones.

Edit: Moved to: Plugin Support (from MV Support)

And just like that, it works! Thank you so much!

Seriously guys, thank you everyone who took the time out of their day to comment and help and even write plugins for me, a dunce who can't code.
I really appreciate everything you do 😀 This might seem like a small thing, but it really helps bring my game's characters to life.
Great, you're welcome!

Original thread: https://forums.rpgmakerweb.com/threads/stop-the-victory-animation-from-looping.162530/