TheCrowKnight Posted Sunday at 04:44 PM Share Posted Sunday at 04:44 PM (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 Sunday at 04:46 PM by TheCrowKnight fixed formatting Link to comment Share on other sites More sharing options...
xkkmEl Posted Monday at 11:13 AM Share Posted Monday at 11:13 AM 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 Wednesday at 10:00 PM Share Posted Wednesday at 10:00 PM 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