Thread Tools Display Modes
03-11-22, 04:09 AM   #1
Firesong
A Deviate Faerie Dragon
Join Date: Jan 2022
Posts: 19
Question Finding reactive spells like Overpower or Revenge

I'm making an addon that will have one button and it will show the correct spell to cast.

So far I have this code working:

local inRange, unit = 0, "target"
if UnitExists("target") and UnitIsVisible("target") and IsUsableSpell("Charge") then
inRange = IsSpellInRange("Charge", "target")
end
if inRange == 1 then
CommandExtra.texture:SetColorTexture(0,255,0)
message = "Charge"
else
CommandExtra.texture:SetColorTexture(255,0,0)
message = "Do nothing"
end

My plan is to have a long-ish if else function for my warrior. My question is how to identify from Lua spells like Overpower or Revenge which flash up on screen and should be used first?

All help appreciated.
  Reply With Quote
03-11-22, 04:20 AM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,359
I'm not sure what your end goal is precisely but just to save you some trouble let me remind that showing what spell to press next is possible.

Making a button that will "intelligently" decide what to show and let you press it to cast that thing is impossible

Addons cannot make combat decisions outside of what would be possible to do with a macro.

All priority / rotation helpers (like for example Hekili) work under that principle "show not do", you still have to press the buttons.
  Reply With Quote
03-11-22, 04:29 AM   #3
Firesong
A Deviate Faerie Dragon
Join Date: Jan 2022
Posts: 19
Smile

Thanks for your comment. I'm trying to learn Lua and have some fun.

My question is hwo to identify reactive spells that whose buttons flash when you should use them. TMW does it but I can't make sense of the code in there.
  Reply With Quote
03-11-22, 05:00 AM   #4
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,359
There is unfortunately no "one size fits all" answer.

If you wanted to piggyback on Blizzard's definition of reactive abilities you could potentially
1. Create a frame and Register for the COMBAT_TEXT_UPDATE event.
2. Use CombatTextSetActiveUnit("player") to set the unit to monitor to yourself.
3. Check for combattextType equals "SPELL_ACTIVE" in your event handler.
4. Get the ability with
Code:
local ability = GetCurrentCombatTextEventInfo()
If you want to be in control of what counts as reactive you'd have to do that on a case by case basis.
Does it give a buff? Check buffs.
Does it always happen after a crit/avoid/other combat event? Parse combatlog.
Etc.

An addon that tries something similar for the Classic client whose code might be easier to follow is ClassicSpellActivations.
Source code on github

Last edited by Dridzt : 03-11-22 at 05:03 AM.
  Reply With Quote
03-11-22, 07:50 AM   #5
Firesong
A Deviate Faerie Dragon
Join Date: Jan 2022
Posts: 19
Thumbs up

That's great - thanks!
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Finding reactive spells like Overpower or Revenge

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off