Originally Posted by Eungavi
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.
|
Thanks so much for the prompt replies I really do appreciate you taking the time to try and help me. I've tried exactly what you said and it doesn't seem to be working. This is currently what I have written in cod.lua
-- This file is loaded from "ZeldaShop.toc"
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("C:\Program Files (x86)\World of Warcraft\Interface\AddOns\ZeldaShop")
else
StopMusic()
end
elseif event == "MERCHANT_SHOW" then
PlayMusic(C:\Program Files (x86)\World of Warcraft\Interface\AddOns\ZeldaShop)
elseif event == "MERCHANT_CLOSED" then
StopMusic()
end
end)
I placed the Zeldashop.mp3 into the Addon folder and set the path to it.