#define musType skill1
#define musID skill2
int nMusicVol = 100; //Must be handled by the Game-Settings later.
int nMusicHandle = 0; //Mediahandle for all things related to music.
STRING* sMusicTitle;
///////////////////////
//
//PICKING AND PLAYING THE MUSIC
//
///////////////////////
function playMusic() {
if (media_playing(nMusicHandle)==0) { //Only play me if there is no music
nMusicHandle = media_play(sMusicTitle, NULL, nMusicVol);
}
}
function pickMusic(){
if (event_type ==EVENT_SCAN && you==player) { //The Player entity has scanned me
switch(my.musID) { //musID-Skill determines, which song to play
case 1:
sMusicTitle = "Musik\\stealth2.mp3";
break;
case 2:
sMusicTitle = "Musik\\stealth1.mp3";
break;
case 3:
sMusicTitle = "Musik\\scene1.mp3";
break;
default: //Fallback: If something goes wrong, we play the most generic stealth
sMusicTitle = "Musik\\stealth1.mp3"; //music we have. Can't be too inappropriate.
}
playMusic();
}
}
// skill1: musType 0
// help: default 0 = Ambient, 1 = Scene, 2 = Action
// skill2: musID 1
// help: Refer to the tracklist I gave you
action triggerMusic() {
my.emask |= ENABLE_SCAN; //I will react when being scanned
my.event = pickMusic;
my.skill60 = 20; //me is some kind of trigger. me happy.
set (my,INVISIBLE);
set (my,PASSABLE);
}