Ok, thanks for the help.
It begins very nicely - in the "walk" anim of the NPC graphic, it calls an event which changes the music:
If combatmusic is equal to 1 or encounterinprogress is equal to 0 end event, else do change combatmusic to 1 and play the music.
However, I am not quite sure how to make it end. I tried to put in the NPCs death event:
If encounterinprogress equals 0 change music back to the exploration music.
However, when the last NPC dies, the encounter is still in progress, so that won't work. I thought of adding the event to the player's walk anim instead, but that wouldn't work either since there are different music for the different areas.
Any ideas?