Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //::///////////////////////////////////////////////
- //:: aa_ex_music
- //:://////////////////////////////////////////////
- /*
- Use: Executed by an area
- Recursive script function that cycles through a series of songs.
- Local int: SONG_ID_01 (see: ambientmusic.2da)
- Local int: SONG_LENGTH_01 (list of lengths is in aa_music_read)
- Last two chars of each local variable are the index of the track.
- */
- //:://////////////////////////////////////////////
- //:: Created By: The Magus (2012 feb 13)
- //:: Modified:
- //:://////////////////////////////////////////////
- #include "aa_inc_time"
- void main()
- {
- object oArea = OBJECT_SELF;
- int nPCs = GetLocalInt(oArea, "PC_COUNT");
- int nNow = GetCurrentGameTime(TRUE);
- int nChange = GetLocalInt(oArea, "SONG_CHANGE_TIME");
- // only continue if one or more players are present
- if(nPCs>0 && nChange<=nNow)
- {
- int nTrack = GetLocalInt(oArea, "SONG_ID_CURRENT")+1;
- int nSongID, nSongLength; float fSongLength; string sTrack;
- if(nTrack<10)
- sTrack = "0"+IntToString(nTrack);
- else
- sTrack = IntToString(nTrack);
- nSongID = GetLocalInt(oArea, "SONG_ID_"+sTrack);
- if(!nSongID)
- {
- nTrack = 1;
- nSongID = GetLocalInt(oArea, "SONG_ID_01");
- nSongLength = GetLocalInt(oArea, "SONG_LENGTH_01");
- }
- else
- nSongLength = GetLocalInt(oArea, "SONG_LENGTH_"+sTrack);
- MusicBackgroundStop(oArea);
- MusicBackgroundSetDelay(oArea, 0);
- MusicBackgroundChangeDay(oArea, nSongID);
- MusicBackgroundChangeNight(oArea, nSongID);
- MusicBackgroundPlay(oArea);
- SetLocalInt(oArea, "SONG_ID_CURRENT", nTrack);
- SetLocalInt(oArea, "SONG_CHANGE_TIME", nNow+nChange);
- fSongLength = IntToFloat(nNow+nChange)+2.0;
- DelayCommand(fSongLength, ExecuteScript("aa_ex_music", oArea));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment