Delete the file ViperWarn.xml, open the ViperWarn.toc file and change 'ViperWarn.xml' to 'ViperWarn.lua', then change the full contents of the ViperWarn.lua file to:
local has = false
local e = CreateFrame('Frame')
e:RegisterEvent('PLAYER_AURAS_CHANGED')
e:SetScript('OnEvent',function()
if GetPlayerDebuffName('Viper Sting') then
if not has then
has = true
ZoneTextString:SetText('Viper Sting!')
ZoneTextFrame.startTime = GetTime()
ZoneTextFrame.fadeInTime = 0
ZoneTextFrame.holdTime = 2
ZoneTextFrame.fadeOutTime = 3
ZoneTextString:SetTextColor(1,0,0)
PVPInfoTextString:SetText('')
ZoneTextFrame:Show()
PlaySoundFile('Interface\\AddOns\\ViperWarn\\Sounds\\Viper Sting.wma')
end
else
has = false
end
end)
(Note: you can open all the files in Windows Notepad.)
The global function he used GetPlayerDebuffName("Spell Name") is not actually blizzard function, it's probably from a library or framework I think.
You would have to iterate through the players debuffs and use UnitDebuff, which doesn't sound very efficient.
Alternatively you could register for COMBAT_LOG_EVENT_UNFILTERED and work out which sub event is triggered by viper sting. Probably SPELL_PERIODIC_AURA_APPLIED_DOSE (guessing) but I would need a hunter to test with to identify it.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Viper sting warning mod. i guess it works by reading by checking if it shows "you have gained viper sting. "
it doesnt work for 2.4 and has not been updated
(Note: you can open all the files in Windows Notepad.)
\addons\viperwarn\viperwarn.lua:
8: attempt to call global
'Get playerDebuffName' (a nil value
You would have to iterate through the players debuffs and use UnitDebuff, which doesn't sound very efficient.
Alternatively you could register for COMBAT_LOG_EVENT_UNFILTERED and work out which sub event is triggered by viper sting. Probably SPELL_PERIODIC_AURA_APPLIED_DOSE (guessing) but I would need a hunter to test with to identify it.