#Show aura if 'x' ability hits 3+ targets- writing the custom code

28 messages · Page 1 of 1 (latest)

median berry
#

Good morning!!
Here's the custom trigger code i have so far with Check on: Every Frame

-----Custom Trigger-----
function()
local combatLogEvent = select("SPELL_AURA_APPLIED" );
if event == "SPELL_AURA_APPLIED" and spellId == 121253 then
local targetsHit = WeakAuras.GetData("TargetsHit", 0) + 1;
WeakAuras.SetData("TargetsHit", targetsHit);

    if targetsHit >= 3 then
        return true;
    end
end

end

-----Custom Untrigger----

function()
if event == "UNIT_SPELLCAST_SUCCEEDED" and spellId == 121253 then
local targetsHit = WeakAuras.GetData("TargetsHit", 0) + 1;
WeakAuras.SetData("TargetsHit", targetsHit);

    if targetsHit < 3 then
        return true and WeakAuras.SetData("TargetsHit", 0);
    end
end

end

The aura does not show, and im not certain why. Can you please advise, ty.

hollow marten
#

That looks like some ChatGPT bullshittery

median berry
#

correct its what i used

hollow marten
#

WeakAuras.GetData exists and does not do what chatGPT is hallucinating. It could have messed up your saved Auras.

compact ivy
#

mess up your saved auras
(that was once true but not anymore)

hollow marten
#

👍

median berry
#

i see, how would you approach this lua code, anything you would adjust?

hollow marten
#

Well combat log events are probably what you'll need but there aren't really short cuts. Hmm, the more I look at the ChatGPT stuff the more I see. This is hard to ignore. But suffice it to say, you can't salvage any of that.

#

!CLEU

frigid bluffBOT
#

https://warcraft.wiki.gg/wiki/COMBAT_LOG_EVENT

function(event, timestamp, subEvent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)

You can use this Aura, https://wago.io/CLEU-IN-ETRACE (works fine in all game versions, not just retail), to add the detailed info into the Etrace tool.
For more info on Events and Etrace see #pins message

hollow marten
#

!starterkit

frigid bluffBOT
hollow marten
#

With combat log events you get a lot of arguments (pieces of info) and half the battle is managing the ones you need without being overwhelmed.

You'll need to set your trigger to track the event CLEU with the subEvents SPELL_CAST_SUCCESS and either SPELL_AURA_APPLIED (if the spell you're interested in applies a debuff) or SPELL_DAMAGE (if it causes damage)

#

You would check the sourceGUID on these subEvents to ensure it's you that's causing them and not some other nearby unit, along with checking the spellID is the one you want.

#

On the SPELL_CAST_SUCCESS you'd probably set a flag in aura_env

#

!aura_env

frigid bluffBOT
hollow marten
#

Then on subsequent APPLIED or DAMAGE events you'd increment a count.

median berry
#

i really appreciate your time to put in this info, im going to review it and try to draft the aura.
Thanks Asakawa
& Thanks Rivers

hollow marten
#

Feel free to ask any followups as you try to get this created

median berry
#

I am unsuccessful.
Im trying to use an if-then statement to judge if ability 121253 hit 3 or more targets.

I think im not able to get the addon to count the number of targets hit.
Ive failed to find relevant examples in the github database. I've also looked through a few youtube videos but they do not address this specific argument.
There's no errors in what i have produced but the aura does not light up when i hit 3 targets with 121253.

function(CombatLogEventUnfiltered, SPELL_DAMAGE)
if type == "SPELL_DAMAGE" and spellId == 121253 then
if targetsHit >= 3 then
return true;
end
end
end

hollow marten
#

Okay, first thing, if you set your trigger to track CLEU:SPELL_DAMAGE then WA is sending the args in to the function, you don't need to use CombatLogEventUnfiltered at all.

Next, you're misunderstanding functions and args in Lua.
You're defining a function for WA to run when the combat log events fire. WA will send in the name of the event and any args that the event carries in to your function. So the args you define in your function will be filled with the info from the firing event.

See the CLEU bot response I popped earlier. The args listed in the example function line are what you'll be needing.

#

Once you've wrangled the function and args, the thing you need to understand is that the combat log events will fire separately for each instance of damage. targetsHit doesn't exist. You didn't create it anywhere and the game isn't sending that info. You need to create a variable that will exist across separate runnings of this function (i.e. in aura_env) which you will increment yourself when the matching event occurs.

dense vale
#

!bugsack too, because there are errors.

frigid bluffBOT
#

If you are having errors we need a copy of the entire error's text to be able to help.
See this message #pins message for details on getting detailed Lua errors

hollow marten
#

I think that could run without errors. == checks on nil won't ever get to the >= check that would error.

#

But yeah, never start a project like this without bugsack.

#

It was in the starterkit above though