WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   HELP: An eccho issue with a sound addon (https://www.wowinterface.com/forums/showthread.php?t=48867)

Nuru0190 01-24-14 02:00 PM

HELP: An eccho issue with a sound addon
 
Hi,

Recently, i downloaded for my monk an addon called "hokuto no monk". It's a simple addon with no interface that adds sounds for certain "spells". For example, when using "fists of fury", it will trigger a Bruce Lee-like "aaaaatatatatata" kind of sound, among others.
I wasn't satisfied with the overall sound quality or the few amount of sounds (5 or 6 total), so i decided to download and use my own. I modified the LUA file accordingly in order to add all my new sound files (16 total directly ripped from the PS2 Hokuto no Ken game).

Everything is working well, except for the aforementioned "aaaaaatatatata" sound associated with "fists of fury". That particular sound file for that particular spell is ALWAYS ecchoed, whatever the sound file i choose to associate with "fists of fury". It does that only for that spell, and not for any other. It was also doing that with the original sound file chosen by the mod's author.
When i checked the LUA file, there was no difference that i could tell between say... the "fists of fury" line, and the "paralysis" or "touch of death" lines... They're exactly the same, except for the spell name.


So my question is: why is there an eccho with the sound file associated with "fists of fury"? And also, how to remove it? I literally looked over the internet for 2 days now, i completely uninstalled and reinstalled all my addons, deleted the WTF and cache folders, tried to tweak the LUA file again and again.... and it just doesn't seem to fix the problem.


Any help would be REALLY appreciated!


Below, you'll find a copy of the LUA file (it's quite short):
(the forum won't let me copy paste it exactly the way it is, but any person familiar with LUA files will understand i guess)


local frame = CreateFrame("FRAME", "okutonomonk");
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");


local function eventHandler(self, event, ...)
if event=="COMBAT_LOG_EVENT_UNFILTERED" then
local timestamp, type, hideCaster, sourceGUID, sourceName, sourceFlags, sourceFlags2, destGUID, destName, destFlags, destFlags2 = select(1, ...)
local player = UnitGUID("player")
if type=="SPELL_CAST_SUCCESS" then
local spellId, spellName, spellSchool = select(12, ...));
local spellLink = GetSpellLink(spellId)
if spellName=="Fists of Fury" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Fists of Fury.ogg", "SFX")
end
if spellName=="Blackout Kick" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Blackout Kick.ogg", "SFX")
end
if spellName=="Expel Harm" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Expel Harm.ogg", "SFX")
end
if spellName=="Flying Serpent Kick" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Flying Serpent Kick.ogg", "SFX")
end
if spellName=="Grapple Weapon" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Grapple Weapon.ogg", "SFX")
end
if spellName=="Resuscitate" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Resuscitate.ogg", "SFX")
end
if spellName=="Rising Sun Kick" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Rising Sun Kick.ogg", "SFX")
end
if spellName=="Spear Hand Strike" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Spear Hand Strike.ogg", "SFX")
end
if spellName=="Spinning Crane Kick" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Spinning Crane Kick.ogg", "SFX")
end
if spellName=="Tiger Palm" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Tiger Palm.ogg", "SFX")
end
if spellName=="Touch of Karma" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Touch of Karma.ogg", "SFX")
end
if spellName=="Zen Meditation" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Zen Meditation.ogg", "SFX")
end
if spellName=="Paralysis" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Paralysis.ogg", "SFX")
end
if spellName=="Fortifying Brew" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Fortifying Brew.ogg", "SFX")
end
if spellName=="Touch of Death" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Touch of Death.ogg", "SFX")
end
if spellName=="Tigereye Brew" and sourceGUID==player then
PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Tigereye Brew.ogg", "SFX")
end
end
end

end

frame:SetScript("OnEvent", eventHandler);

semlar 01-24-14 02:05 PM

Fists of Fury is firing multiple SPELL_CAST_SUCCESS events while it channels, and you're playing the sound effect each time.

You also don't really need the combat log for this, there are UNIT_SPELLCAST events that fire for the player that might be more reliable.

Nuru0190 01-24-14 02:12 PM

Wow, thanks for the answer, that was fast!
It makes sense, i understand.

However, i have no idea how to fix this in the LUA file. Would you be so kind as to rewrite for me the lines that need to be fixed in order to remove the eccho, please?

semlar 01-24-14 02:20 PM

You could try something like this..
Lua Code:
  1. local Channeled = { ['Fists of Fury'] = true }
  2. local Instants = {
  3.     ['Blackout Kick'] = true,
  4.     ['Expel Harm'] = true,
  5.     ['Flying Serpent Kick'] = true,
  6.     ['Grapple Weapon'] = true,
  7.     ['Resuscitate'] = true,
  8.     ['Rising Sun Kick'] = true,
  9.     ['Spear Hand Strike'] = true,
  10.     ['Spinning Crane Kick'] = true,
  11.     ['Tiger Palm'] = true,
  12.     ['Touch of Karma'] = true,
  13.     ['Zen Meditation'] = true,
  14.     ['Paralysis'] = true,
  15.     ['Fortifying Brew'] = true,
  16.     ['Touch of Death'] = true,
  17.     ['Tigereye Brew'] = true,
  18. }
  19.  
  20. local f = CreateFrame('frame')
  21. f:RegisterUnitEvent('UNIT_SPELLCAST_CHANNEL_START', 'player')
  22. f:RegisterUnitEvent('UNIT_SPELLCAST_SUCCEEDED', 'player')
  23.  
  24. f:SetScript('OnEvent', function(self, event, unit, spellName, ...)
  25.     if (event == 'UNIT_SPELLCAST_CHANNEL_START' and Channeled[spellName])
  26.     or (event == 'UNIT_SPELLCAST_SUCCEEDED' and Instants[spellName]) then
  27.         PlaySoundFile('interface/addons/hokutonomonk/sounds/' .. spellName .. '.ogg', 'SFX')
  28.     end
  29. end)

It's drycoded so let me know if it doesn't work.

Nuru0190 01-24-14 02:23 PM

I have close to 0 knowledge when it comes to LUA coding. However, if i understand, the only thing that needs to be changed is "if type=="SPELL_CAST_SUCCESS" then..." Am i correct?
What should i write instead?

Nuru0190 01-24-14 02:25 PM

Ok, i will put that in the LUA file, but where do i put the lines for sound files associated with spells?

Oh, nevermind, i think i get it...
Let me try it.

semlar 01-24-14 02:27 PM

That should be the entire script, assuming every sound file just has the same name as the spell it's associated with.

Nuru0190 01-24-14 02:30 PM

I pasted it exactly as you wrote it, and it doesn't work. No sound is playing.
Did i do anything wrong?

Yes, every sound file has the exact same name as the skill it is associated with.

semlar 01-24-14 02:39 PM

I changed it slightly after I wrote it so you might have to recopy it, if it still doesn't work try putting "print(event, spellName)" above PlaySoundFile and see if it's even getting to that point.

Nuru0190 01-24-14 02:40 PM

Ok, copying and trying now.
Question: when i copy your code, every line is shifted 4 columns to the right. Does it matter?

semlar 01-24-14 02:42 PM

Also make sure you restart the client or it might not load the sounds.

Nuru0190 01-24-14 02:50 PM

I restart the client everytime, yes.

I got no result with the code, and when i put " Print(event, spellName) ", i get a LUA error message in game.
However, since i'm really ignorant with coding, i'm not sure i did things right.

I typed like this:

or (event == 'UNIT_SPELLCAST_SUCCEEDED' and Instants[spellName]) then
Print(event, spellName)
PlaySoundFile

Print(even, spellName) and PlaySoundFile lines both start below "then" fom the line above.

semlar 01-24-14 02:51 PM

Lowercase P, it's just "print".

Nuru0190 01-24-14 02:54 PM

Ok, trying now.

Ok, so now i got no LUA error anymore and in my chat window, i got messages saying:
UNIT_SPELLCAST_SUCCEEDED "spell name"

I got no sound playing.

semlar 01-24-14 03:01 PM

Well there are pretty much two possibilities: either your sound is off for that channel (sound effects) or the path to the sound files is wrong.

Nuru0190 01-24-14 03:06 PM

The path is correct:
D:\PC Games\MMORPG\World of Warcraft\Interface\AddOns\Hokutonomonk\sounds

The spell names are correct, i checked and double checked them.

However, i don't get what you mean by "your sound is off for that channel (sound effects)". Are you talking about settings i should change in the options?

semlar 01-24-14 03:11 PM

I mean in the sound options under the system menu in-game, make sure Sound Effects is checked and the volume is up since that's the channel "SFX" is telling it to play on.

I might have typed the path wrong to the files but I thought I wrote what you had.

Try replacing the PlaySoundFile I have with one of yours like
Lua Code:
  1. PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\Tigereye Brew.ogg", "SFX")

to see if it'll play that, if it does then there must be some problem with how I've written the path.

Nuru0190 01-24-14 03:18 PM

Nice, it works with the spell name i typed. I checked directly with "Fists of Fury", and there is no eccho.
How can i do now to have all 16 sounds working?

semlar 01-24-14 03:21 PM

Try this?
Lua Code:
  1. PlaySoundFile("Interface\\AddOns\\HokutoNoMonk\\sounds\\" .. spellName .. ".ogg", "SFX")

It should be literally the same thing I wrote earlier but maybe there's some quirk to it.

Nuru0190 01-24-14 03:25 PM

You sir, are a genius! It works perfectly.
However, i've got one last question: it doesn't trigger the sound file for one spell only: "Flying Serpent Kick".
I think it comes from the game that doesn't recognize the spell when typed like this, even though it is the complete name with the right spelling. Would you happen to know how to fix that as well?


All times are GMT -6. The time now is 12:47 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI