From b201c3a6378ad9b0a7a0b84399c08a7e57c1e115 Mon Sep 17 00:00:00 2001 From: kanym Date: Wed, 30 Sep 2026 13:03:58 +0200 Subject: [PATCH] fix(trenta): the Muspell's idle loops instead of freezing The Elder's "Unarmed Idle" clip is not a looping clip (loop=False, 1.90s), so after standing up or attacking the form played it once and froze on the last frame. The state is now cross-faded into itself just before its end while the form stands idle. --- JotunnModStub/Trenta/TrentaMuspell.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/JotunnModStub/Trenta/TrentaMuspell.cs b/JotunnModStub/Trenta/TrentaMuspell.cs index 1ae8011..9b1a6bb 100644 --- a/JotunnModStub/Trenta/TrentaMuspell.cs +++ b/JotunnModStub/Trenta/TrentaMuspell.cs @@ -290,6 +290,8 @@ namespace RacesOfValheim TrySet(() => formAnim.SetFloat("sideway_speed", playerAnim.GetFloat("sideway_speed"))); } + LoopIdle(); + if (!isGrounded || !RaceInput.Allowed) return; if (RaceInput.AttackDown(0)) // Stomp @@ -302,6 +304,31 @@ namespace RacesOfValheim } } + private const string IdleClip = "Unarmed Idle"; + private const float IdleRestartAt = 0.9f; + private const float IdleCrossFade = 0.2f; + + /// + /// Keeps the idle going. The Elder's "Unarmed Idle" clip is not a looping clip (dumpanim: + /// loop=False, 1.90s), so after the stand-up or any attack the form played it once and + /// froze on its last frame. The boss never showed it, being hardly ever idle; a player in + /// the form is idle most of the time. The clip's flag lives in the game's asset, so the + /// state is restarted from here instead, cross-faded into itself just before its end so + /// the seam does not show. + /// + private void LoopIdle() + { + if (formAnim.IsInTransition(0)) return; + + AnimatorClipInfo[] clips = formAnim.GetCurrentAnimatorClipInfo(0); + if (clips.Length == 0 || clips[0].clip == null || clips[0].clip.name != IdleClip) return; + + AnimatorStateInfo state = formAnim.GetCurrentAnimatorStateInfo(0); + if (state.normalizedTime < IdleRestartAt) return; + + formAnim.CrossFadeInFixedTime(state.fullPathHash, IdleCrossFade, 0, 0f); + } + private static void TrySet(System.Action set) { try { set(); } catch { }