The sounds of battle

into the fight we ride

Hi, everyone.

I thought it would be nice if the background music changed when the player started fighting. I know it's possible in a game where the player teleports to a different map when a battle starts, but I use the usual, real-time battle engine (like PoG).

So, is it possible? Would be fun 🙂

Why not? You could place it under "hit" or "miss", or maybe in the attack part of your player animation. Make a global - musicglobal.

Conditional: If encounter-in-progress = 1 AND
musicglobal = 0

then play music.

change musicglobal by add 1

Place in the animation of the player "default" a conditional

if encounter-in-progress = 0

then change musicglobal set 0

Ledorax, on Apr 23 2005, 08:25 PM, said:

Hi, everyone.

I thought it would be nice if the background music changed when the player started fighting.

So, is it possible? Would be fun 🙂
View Post

I think this is doable. In the NPC's "player contact" event put two "play music" actions. The first one will set music to "none" (turning off the music which was playing) and the second one will set music to "battle noise" or whatever you want to call it. Then in the NPC's "death event" you need two more "play music" actions to restore the background music which was originaly playing.

The only potential problem I can see is if the player is fighting more than one enemy at the same time. The first NPC to die will set the background music going again while the second NPC is still fighting. Maybe not, depending on how the engine interprets "contact."

Deb posted her idea while I was still typing. The two aproaches are very different. Her's is player oriented and uses globals, mine is NPC oriented and requires no globals. I'd be very interested in what you find works best.

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?

Well, for every map location, I have a global called "mapname" that changes to the name of the map whenever it loads. I've done this for the testers. You could do that and then identify the music. Or have a global for the name of the music for every map and then have a conditional if musicglobal = happy then play music. This would be good if you have perhaps four music playing throughout your realm. You would need to make only one event for this, after you've placed it in your locations, and then call the event.

Debra, on Apr 24 2005, 01:25 PM, said:

Well, for every map location, I have a global called "mapname" that changes to the name of the map whenever it loads. I've done this for the testers. You could do that and then identify the music. Or have a global for the name of the music for every map and then have a conditional if musicglobal = happy then play music. This would be good if you have perhaps four music playing throughout your realm. You would need to make only one event for this, after you've placed it in your locations, and then call the event.
View Post

It works!
Perfectly, too. And automated. Now I won't even have to change the battle events when I have added a new area. It sets "Gb_Music" to the name of the music, and then it will play "Gb_Music".

Thanks for the help 🙂