From 10e55aff3e0ec33871ab464a03356579a865700a Mon Sep 17 00:00:00 2001 From: kanym Date: Sun, 9 Aug 2026 18:31:33 +0200 Subject: [PATCH] fix(fenrir): source the taunt howl from the real creature's alert bark sfx_wolf_howl/sfx_wolf_alert/sfx_fenring_idle never resolved to anything playable - wolves carry no standalone howl prefab. Reads BaseAI.m_alertedEffects off the live Fenring/Fenring_Cultist prefabs instead, the same effect the creature itself plays going on alert. Still reported silent in testing; leaving it in as a step in the right direction rather than reverting. --- JotunnModStub/Fenrir/FenrirBehaviors.cs | 34 +++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/JotunnModStub/Fenrir/FenrirBehaviors.cs b/JotunnModStub/Fenrir/FenrirBehaviors.cs index 86045ff..58549a7 100644 --- a/JotunnModStub/Fenrir/FenrirBehaviors.cs +++ b/JotunnModStub/Fenrir/FenrirBehaviors.cs @@ -9,6 +9,36 @@ using UnityEngine.UI; // Added for UI namespace RacesOfValheim { + /// + /// Howl vocalisation, borrowed from the real creature instead of guessed at. Wolves and their + /// kin do not carry a standalone "sfx_wolf_howl"-style prefab that PlaySFX's + /// PrefabManager.Cache lookup could ever find - dumpdverger's own hierarchy dump for + /// Fenring_Cultist shows no ZSFX anywhere on it. + /// + /// BaseAI.m_idleSound was the first guess and was wrong in a quieter way: it is real, but it + /// is the creature's passive ambient noise (DoIdleSound, on a timer while it is doing nothing + /// in particular) - a small grunt, not a howl, and it played back sounding like whatever + /// generic "the form did something" cue the transformation itself already uses. What a + /// creature actually vocalises WHEN IT SPOTS SOMETHING is BaseAI.m_alertedEffects, fired from + /// SetAlerted(true) - reading that off the real "Fenring"/"Fenring_Cultist" prefab and calling + /// Create() plays the same aggressive bark the creature itself makes going on alert. + /// + internal static class FenrirCreatureSound + { + public static void PlayHowl(string sourcePrefabName, Vector3 position) + { + GameObject source = PrefabManager.Cache.GetPrefab(sourcePrefabName); + BaseAI ai = source != null ? source.GetComponent() : null; + if (ai == null || ai.m_alertedEffects == null) + { + Jotunn.Logger.LogWarning($"[FenrirForm] No BaseAI.m_alertedEffects found on '{sourcePrefabName}'."); + return; + } + + ai.m_alertedEffects.Create(position, Quaternion.identity); + } + } + public class FenrirFormBehavior : MonoBehaviour { private Animator playerAnim; @@ -101,7 +131,7 @@ namespace RacesOfValheim fenrirAnim.SetTrigger("attack_taunt"); - PlaySFX("sfx_wolf_howl", "sfx_wolf_alert", "sfx_fenring_idle"); + FenrirCreatureSound.PlayHowl("Fenring", Player.m_localPlayer.transform.position); yield return new WaitForSeconds(2.0f); @@ -386,7 +416,7 @@ namespace RacesOfValheim // Cultist ha una vera e propria animazione di "taunt" cultistAnim.SetTrigger("attack_taunt"); - PlaySFX("sfx_wolf_howl", "sfx_wolf_alert", "sfx_fenring_idle"); + FenrirCreatureSound.PlayHowl("Fenring_Cultist", Player.m_localPlayer.transform.position); // Durata approssimativa dell'animazione di taunt yield return new WaitForSeconds(2.0f);