MusicBackgroundChangeNight(object, int)

From NWN Lexicon
Jump to navigationJump to search

Changes the background nighttime music for the area specified.

void MusicBackgroundChangeNight(
    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 nighttime 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 nighttime music for the area the
// object is to 'City Night'
Object oArea = GetArea(OBJECT_SELF);
MusicBackgroundChangeNight (oArea, 21);
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