MusicLevel

Category: Music
Since engine version: 1.0 OC

Description

Sets the volume for playback of background music (see Music).

Syntax

int MusicLevel(int level);

Parameter

level:
Desired volume (0-100).

Example

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.
See also: Music
PeterW, 2003-02