Jump to content

Add Boss Music Using a Script


TheCrowKnight

Recommended Posts

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 by TheCrowKnight
fixed formatting
Link to comment
Share on other sites

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

image.png.10f8b5f369348b7eb0c85909e3aad6c0.png

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...