oh, I didn't notice that it only changed after being attacked. In your current method, check to see if the currently playing BGM is the/one of the battle musics. If you can't do that with RMXP, set a variable to true whenever you're attacked. I'm guessing the music changes back after a fixed amount of time, so just set the switch to false after that and re-play the map's previous BGM (if there isn't a way to resume that, set a variable with the old BGM). Hope that helps x.x