Originally Posted by WhirlyTV
Thank you so much for the help, I really appreciate it. I'm not a competent programmer unfortunately so I have no idea where to begin to make this happen. Is there also a way to tell when your character opens up a vendor? I'm currently watching youtube tutorials to try and learn how to create this.
|
https://addon.bool.no/
This site would help you creating an addon.
Type in your addon's name into
AddOn folder name field.
(Let's say PlayZeldaMusic)
Copy and paste the following code into
lua file field
(This version will also play/stop music on vendor)
Lua Code:
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_UPDATE_RESTING")
f:RegisterEvent("MERCHANT_SHOW")
f:RegisterEvent("MERCHANT_CLOSED")
f:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_UPDATE_RESTING" then
if IsResting() then
PlayMusic("path to your music")
else
StopMusic()
end
elseif event == "MERCHANT_SHOW" then
PlayMusic("path to your music")
elseif event == "MERCHANT_CLOSED" then
StopMusic()
end
end)
Press
Create my AddOn and give me my files! button.
You will get a zip file which contains two files called
PlayZeldaMusic.toc and
code.lua
Un-zip it, place your sound file into that folder then open
code.lua and change "path to your music" to your own.