Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

API PlaySoundKitID

Last wiki revision 2017-08-31

Play any sound or music native to the game using the audio's ID. Other players will not hear the audio. local willPlay, soundHandle = PlaySoundKitID(ID, [channel[, forceNoDuplicates]])

  • ID: Number - The ID of the audio. According to Wowhead, IDs go up to 50973 as of build 20253. WoW database sites typically display the ID in the url address of the page for a sound file.
  • channel : String - "SFX","Music","Ambience" or "Master" (this will play the sound also with disabled sounds like before 4.0.1).
  • forceNoDuplicates: Boolean - If true, prevents multiple instances of this sound from playing at the same time. Defaults to true.
  • willPlay : Flag - true if the sound will be played, nil otherwise (prevented by a muted sound channel, for instance).
  • soundHandle : Number - identifier for the queued playback.

PlaySoundKitID(31749, "master", true); -- UI_PetBattle_Victory The following plays a random sound or music from the entire game by clicking SomeFrame, stopping the previous audio every click. SomeFrame can be any valid frame for SetScript. SomeFrame:SetScript('PostClick',function if soundhandle then StopSound(soundhandle) end local x=random(1,50973) local _,soundhandle=PlaySoundKitID(x) end)

Source

https://warcraft.wiki.gg/wiki/API_PlaySoundKitID · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.