Skip to content

musicSelectTrack⚓︎

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)

Tip

This event supports blocking by setting e.block to true or returning false. Blocking the event prevents vanilla behavior from happening. For example, blocking an equip event prevents the item from being equipped.

Tip

An event can be claimed by setting e.claim to true, or by returning false from the callback. Claiming the event prevents any lower priority callbacks from being called.

Event Data⚓︎

  • 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.

musicChangeTrack