Ah, so you're looking to have some sort of "Battle Music" that'll only be around for when you're fighting.
Hmmmm... well, since there's no way to detect if the player has shot their weapon or not, you're kinda SOL.
However, Ply's Mod V1.06 has a "mouseclick=X" condition, which would allow you to determine if the player has left clicked. But again, you'll run into some problems... like, the music would still cue if the player left clicked when they don't have a weapon.
But, that seems to be your best bet for going that route.
Here's a thought:
- In all of your enemy scripts, if they spot the player and are currently engaging the player, then have them set a variable to 1 (All of them would use the same variable for this)
- Now, set up a script that will act as a control script for your battle music. It will constantly check if the variable used by your enemies is set to 1. If it is, then you know one of them has engaged the player and you can then fade in the proper music. (I would suggest fading from a music volume of -100 to 100)
- Now, your control script will set the variable back to 0 immediately and start up a timer. If the timer reaches 5 seconds, then it'll fade out the music and reset. However, if the variable goes BACK to 1 while the timer is still going, then reset the timer and set the variable back to 0. This will keep your music going during the fight.
To save you some effort, and because I'm feeling generous right now, here's the control script as I see it.... using Ply's Mod, but you can alter it to use the variables from the official updates, I chose to use Ply's Mod because of how simple the script will be with it:
(This code will have the music play for 1.5 seconds after the battle ends)
desc = Battle Music Control Script by Plystire
:state=0:dimvar=BattleStart,dimvar=MusicFade,state=1
:state=1,varequal=BattleStart 1:setvar=BattleStart 0,setvar=MusicFade -100,music=<your music here>,state=2
:state=2:musicvolume=%MusicFade,addvar=MusicFade 2
:state=2,varequal=MusicFade 100:etimerstart,state=3
:state=3,varequal=BattleStart 1:setvar=BattleStart 0,etimerstart
:state=3,etimergreater=1500:state=4
:state=4:musicvolume=%MusicFade,addvar=MusicFade -2
:state=4,varequal=BattleStart 1:state=2
:state=4,varequal=MusicFade -400:state=1
Now, whenever your enemies are shooting at the player, include this line of code (assuming you're using their Shoot AI for engaging the player):
:always:setvar=BattleStart 1
That should do it.
Maybe Conjured willl wander here at some point and make you an official update version of this.
The one and only,