Need help with spell activation overlay
Hi all, new here!
First time trying to make an addon and wanted to make something that in my mind seems simple. Seems that it's not as simple as I thought. Basically I want to make an addon that shows a texture when Hammer of Wrath procs or is useable (like when Blade of Justice procs). This is the code I have atm but it doesn't seem to work. local f = CreateFrame("Frame") local spellID = 24275 --Hammer of Wrath f:RegisterEvent("SPELL_ACTIVATION_OVERLAY_SHOW") f:RegisterEvent("SPELL_ACTIVATION_OVERLAY_HIDE") f:SetScript("OnEvent", function(self,event, spellID, ...) if event == "SPELL_ACTIVATION_OVERLAY_SHOW" then if (arg1 == "24275") then print("Hello, WoW!") end end if event == "SPELL_ACTIVATION_OVERLAY_HIDE" then if (arg1 == "24275") then print("Bye") end end end) Could anyone give me some advice on how to check when Hammer of Wrath procs/is useable? Thanks alot in advance! |
You are referencing arg1 when it should be spellID and you are checking the wrong events. Give this a shot:
Lua Code:
|
Quote:
|
Alright seems like I know nothing about textures in wow.
If I understand correctly I need an xml file to show textures? How would I go about showing a texture whenever the spell activation overlay glow happens for hammer of wrath and make it dissapear when the overlay is hidden? Also is there a way to make the texture 50% transparent when out of range? Don't really understand how to link xml and lua, sorry very new to this haha |
First off .. a link worth visiting and looking at the introduction pages and then start with something simple.
https://wow.gamepedia.com/Wowpedia:I..._customization You can use xml or lua to create texture objects. These are the pages that explain the different elements to create a texture for a frame https://wow.gamepedia.com/UIOBJECT_Frame https://wow.gamepedia.com/API_Frame_CreateTexture https://wow.gamepedia.com/API_Texture_SetTexture Start with those and make sure you look at SetPoint ( Anchoring ) to place the frame on the screen in relation to another frame. There are options to Hide() and Show() any frame but they can't be done during combat without special secure code access, I don't think you're ready for that quite yet but you can use it for non combat testing just to see how it works. SetAlpha(1) will make the frame visible and SetAlpha(0) will make it invisible with numbers between variable transparency. Take your time and slowly expand your knowledge as and when you find the need/wish. I'm sure others will provide what knowledge they have to assist you in more detail but Vruls response is a good starting point to expand on. Quote:
|
Lua Code:
|
Quote:
|
Quote:
|
Alright, so tried to do the final piece of the addon which is checking for cooldown.
Here is the code, it seems to not work all the time and I got no clue what's wrong with it. Do I have to check for cds in the update script? local SPELL_ID = 24275 -- Hammer of Wrath local SPELL_NAME = GetSpellInfo(SPELL_ID) local UPDATE_INTERVAL = 0.1 local frame = CreateFrame("Frame", nil, UIParent) frame:SetPoint("CENTER", UIParent, "CENTER", 0, -200) frame:SetSize(64, 64) frame:Hide() local texture = frame:CreateTexture() texture:SetAllPoints(frame) texture:SetTexture([[Interface\AddOns\PallyProc\Textures\HolyGlow.tga]]) frame:SetScript("OnEvent", function(self, event, spellID) if event == "SPELL_ACTIVATION_OVERLAY_GLOW_SHOW" then if spellID == SPELL_ID and HasFullControl() and IsUsableSpell(SPELL_NAME) and GetSpellCooldown(SPELL_NAME)==0 then frame:Show() else frame:Hide() end elseif event == "SPELL_ACTIVATION_OVERLAY_GLOW_HIDE" then if spellID == SPELL_ID then frame:Hide() end end end) frame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW") frame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_HIDE") frame:RegisterEvent("SPELL_UPDATE_COOLDOWN") local timer = UPDATE_INTERVAL frame:SetScript("OnUpdate", function(self, elapsed) timer = timer + elapsed if timer < UPDATE_INTERVAL then return end timer = 0 if IsSpellInRange(SPELL_NAME, "target") == 1 then frame:SetAlpha(1) else frame:SetAlpha(0.5) end end) frame:SetScript("OnHide", function(self) timer = UPDATE_INTERVAL end) |
Little update, I seem to have figured out that the proc event won't update when there is a cooldown so is there any event that triggers when a spell is usable or goes on cooldown? I head something about combat log unfiltered but can't find how to properly use it so it triggers on Hammer of Wrath becoming usable and being used. Any clues?
|
All times are GMT -6. The time now is 05:33 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI