Skip to content

addSound⚓︎

This event is triggered when a sound is played by the game or when tes3.playSound() is called.

--- @param e addSoundEventData
local function addSoundCallback(e)
end
event.register(tes3.event.addSound, addSoundCallback)

Tip

This event can be filtered based on the sound event data.

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⚓︎

  • flags (number): Read-only. A flag whether the sound is looping or not. 0 means the sound doesn't loop, 1 means the sound loops.
  • isVoiceover (boolean): A flag whether the sound is a voiced line, which are usually found in the Sound\Vo data folder.
  • pitch (number): The pitch-shift multiplier. For 22kHz audio (most typical) it can have the range [0.005, 4.5]; for 44kHz audio it can have the range [0.0025, 2.25].
  • reference (tes3reference, nil): The reference which is emiting the sound. Not all sounds are played on a reference, such as (un)reading weapon, book-up, and wind sounds.
  • sound (tes3sound): The sound going to be played.
  • volume (number): The volume of the sound. In range [1, 250].

addTempSound