no, you didnt get me, there is a condition where, if we trigger that condition, i want to play a track with increasing gain, then when we get out of that condition, we decrease the gain of the track until it reaches 0, then we stop the track, just altho its volume is 0, it still plays in the background.
now i have this code:
GML:
if (e)
{
if (!battlechase)
{
battlechase=1;
if (!audio_is_playing(mp3battlechase)) {scrplaymsc(mp3battlechase, global.volmsc*.5, 5000)};
else {audio_sound_gain(mp3battlechase, global.volmsc*.5, 3000)};
}
} else
{
if (battlechase)
{
battlechase=0;
if (audio_is_playing(mp3battlechase)) {audio_sound_gain(mp3battlechase, 0, 3000)};
}
}
if (audio_is_playing(mp3battlechase)) {if (audio_sound_get_gain(mp3battlechase)<=0) {audio_stop_sound(mp3battlechase)}};
the situation is basicly we encounter an enemy, track starts playng, gains volume, we exit the encounter, track starts stopping, loses volume until 0 then we stop it.
code works fine, but only the first time, after that no track plays, i see it thru the audio debug mode.
so enemy sees us, "e" is true, track starts playng, we kill enemy or escape, "e" becomes false, track starts fading out, at volume 0 track stops entirely. but after the first encounter none of this happens.
GML:
/// @desc scrplaysfx();
/// @arg track
/// @arg loop
/// @arg gain
if (global.volmsc<=0) {exit};
var s=-4;
if (audio_exists(argument0))
{
s=audio_play_sound(argument0, 0, argument1);
if (argument2)
{
audio_sound_gain(s, 0, 0);
audio_sound_gain(s, global.volmsc, argument2);
}
}
return s;