The musicSelectTrack event occurs when new music is needed after a playing music track ends, or the combat situation changes. It allows you to select your own music for the current conditions by setting eventData.music. The event can be blocked, which prevents a new explore or battle track from being chosen randomly. Blocking only works if
eventData.music is not set.
--- @param e musicSelectTrackEventData local function musicSelectTrackCallback(e) end event.register(tes3.event.musicSelectTrack, musicSelectTrackCallback)
This event supports blocking by setting
true or returning
false. Blocking the event prevents vanilla behavior from happening. For example, blocking an
equip event prevents the item from being equipped.
An event can be claimed by setting
true, or by returning
false from the callback. Claiming the event prevents any lower priority callbacks from being called.
music(string): Optional. If set to the path of a given track (relative to Data Files/music), it will play the given path instead of a random one.
situation(tes3.musicSituation): Read-only. Maps to
tes3.musicSituation, indicating combat or non-combat music.