TheCrowKnight Posted February 16 Share Posted February 16 (edited) I'm trying to have a music track play when encountering the end boss of a dungeon using the below script: Scriptname CJ03MalkiferCombatMusicScript extends Actor MusicType property CJ03MusBossMalkifer Auto Event OnCombatStateChanged(Actor akTarget, int aeCombatState) if (akTarget == Game.GetPlayer()) if (aeCombatState != 0) CJ03MusBossMalkifer.Add() endif endif endEvent Event OnDying (Actor akkiller) CJ03MusBossMalkifer.Remove() endEvent The music reliably plays when combat starts (yay!) but often persists when the boss dies (boo!), which is a huge problem, because with the boss dead the music no longer has a trigger to ever stop. I'm a complete novice at scripting who basically can only repurpose existing scripts. Any insights on ways to make this script more reliable? Any help is appreciated. Thanks! Edited February 16 by TheCrowKnight fixed formatting Link to comment Share on other sites More sharing options...
xkkmEl Posted February 17 Share Posted February 17 Is the music being re-added because there is a final OnCombatStateChanged after OnDying? Try adding a !IsDead() condition in OnCombatStateChanged. Also, try using OnDeath instead of OnDying. It may be that IsDead won't return true while he's dying. Link to comment Share on other sites More sharing options...
Sphered Posted February 19 Share Posted February 19 Could add a silent track when applicable. There is one called _None that you can invoke after removing yours (Game.GetForm(0x1BA72) as MusicType).Add() Or ofc attach the _None music record as a property. Might as well Alternatively, combat music in the game uses conditions. Could definitely play with that instead/also Link to comment Share on other sites More sharing options...
Recommended Posts