# MusicLevel

Music
5.1 OC
int
int level Desired volume (0-100).
Sets the volume for playback of background music (see Music).
global func FadeOutMusic() { AddEffect("FadeOutMusic", nil, 1, 1, nil, nil); }

global func FxFadeOutMusicTimer(object target, effect, int time) { var volume = 100 - time; MusicLevel(volume); if(volume <= 0) { Music(); return -1; } }
Script for a function which will fade out the background music. FadeOutMusic creates the effect whose timer function will be called each frame. The function decreases the volume step by step until it is 0. Then the music will be turned off and the effect removed.
Music
PeterW
2003-02