MusicBackgroundChangeDay(object, int)

From NWN Lexicon
Jump to navigationJump to search

Changes the background daytime music for the area specified.

void MusicBackgroundChangeDay(
    object oArea,
    int nTrack
);

Parameters

oArea
Area to change the music of.
nTrack
TRACK_* ID to change to. This is just an index into ambientmusic.2da.


Description

This function changes the daytime background music for the area.


Remarks

This will also turn on the music if it is currently off. However changing a track as one is already playing may not work as intended, see the second example, which may be more reliable.

The TRACK constants are just indexes into ambientmusic.2da, or 0 for no track.


Version

1.29

Example

// this would change the daytime music for the area the
// object is in to 'Theme Morag'
object oArea = GetArea(OBJECT_SELF)
MusicBackgroundChangeDay(oArea, 55);
void main()
{
    // Immediately changes the playing track to TRACK_BATTLE_DESERT and starts it playing
    object oArea = OBJECT_SELF;
    MusicBackgroundStop(oArea);
    MusicBackgroundChangeNight(oArea, TRACK_BATTLE_DESERT);
    MusicBackgroundChangeDay(oArea, TRACK_BATTLE_DESERT);
    MusicBackgroundPlay(oArea);
}


See Also

Music Effects Functions



 author: Michael Nork, editor: Charles Feduke, additional contributor(s): Tyson McCann