#Help - Trying to create aura to call out mechanic on self with custom code

40 messages · Page 1 of 1 (latest)

hazy quiver
#

hi!! i dont know anything about coding, and ive been trying to decipher the wiki for the past.. hour or so?? trying to mash together a weakaura for fun. i have the idea, i just.. dont really know how to put it together. i have a code already from an eating WA that lets out a random output of text when im in an instance, and i want to replicate that but when i'm targeted by ky'veza's twilight massacre mechanic. problem is, i want to be able to have the code draw out the player's name instead of me just inputting my name in case my guildies want it. i dont really know how to do that. is there anyone that's a bit more knowledgeable in the department that'd be willing to help?

#

[self] and [ky'veza's attack] are just placeholders because i have no clue what im doing LOL

#

local bagels = {
"[self] has [ky'veza's attack] on them and hates this boss.",
"[self] is targeted by [ky'veza's attack] and is likely going to send it through the entire raid.",
"[self] forgot to pay their taxes and now tax collectors are [ky'veza's attack]ing them for it.",
"[self] taunted the Shadow Government™ and is now being [ky'veza's attack]ed in a back alleyway.",
}
local ran = math.random(1, #bagels)
SendChatMessage(bagels[ran], "EMOTE")

#

posting to emotes is also temporary since ive been testing it repeatedly in the open world to see if ive made any progress.. which i havent :(

velvet harness
#

Use the chat message function of weeakauras. %unitName %c

hazy quiver
#

it removes the RNG factor of the outputs though if i do that way, as (i think) i'll only be able to have one output
the custom code section doesnt have compatibility with the WA functions either, only the basic forms

#

this might make more sense for what im going for-

sharp heart
#

so if you want to put the name of the spell targetting them then you'll need to grab that info from the trigger. What do you have so far?

#

!linkit

dark canopyBOT
#

WeakAuras doesn't show anything by default, it's just the framework that lets you import or create "Auras" to display things. If you're having an issue with an Aura, and/or want opinions on it, then you need to share the specific Aura. The best way to do this is to link it through https://wago.io/.

If you only imported the aura, you may right click the aura in-game and select Copy URL and paste it here. If you have modified the aura or created your own, you may instead select Export to string... and upload the string to https://wago.io/. This does not require an account.
You can now paste the import string directly into Discord (with no other text, only the string) and a bot will import it for you and link the wago.

hazy quiver
#

i've been testing it with a separate aura thats the same, except the spellid is instead living flame in the trigger so it.. actually triggers something

velvet harness
#

The %c mist be wrpaeed in a function and return the choose. Text

sharp heart
#

Yeah you could have the randomization while using the built-in like spaten is suggesting

hazy quiver
#

how do i wrap it into a function?

#

that sounds like a good solution

sharp heart
#

I came up with this.
Message:

%unitName %c1 %{n}%c2

Custom Code:

function()
    local c1 = {
        "has",
        "is targeted by",
        "forgot to pay their taxes and now tax collectors are",
        "taunted the Shadow Government™ and is now being",
    }
    local c2 = {
        " on them and hates this boss.",
        " and is likely going to send it through the entire raid.",
        "ing them for it.",
        "ed in a back alleyway.",
    }
    local ran = math.random(1, #c1)
    return c1[ran], c2[ran]
end
#

I think %n is wrong

#

not sure if aura trigger has the buff name as part of the info

hazy quiver
#

with the test runs using living flame, these are the results

#

ahhhh its doing the RNG for both halves instead of keeping them together as a concise sentence

sharp heart
#

shouldn't be

#

math.random is called once and stored in ran

hazy quiver
sharp heart
#

I might have just ordered them wrong

#

you have exactly what I put?

hazy quiver
#

mhm

sharp heart
#

yeah idk cus I dont get that behaviour at all

hazy quiver
sharp heart
#

You put it into a different aura. The triggers could be different

hazy quiver
#

lemme see here

sharp heart
#

hmm no it is giving me a differnt ran now. guess i was just getting lucky

#

I think i know the problem

#

each of the c1 and c2 are run seperately.

hazy quiver
#

yeah thats what i was thinking

sharp heart
#

so I need to keep it between them

#

Custom message Code

function()
    local c1 = {
        "has",
        "is targeted by",
        "forgot to pay their taxes and now tax collectors are",
        "taunted the Shadow Government™ and is now being",
    }
    local c2 = {
        " on them and hates this boss.",
        " and is likely going to send it through the entire raid.",
        "ing them for it.",
        "ed in a back alleyway.",
    }
    
    if not aura_env.isRanSet then
        aura_env.ran = math.random(1, #c1)
        aura_env.isRanSet = true
        return c1[aura_env.ran], c2[aura_env.ran]
    else
        aura_env.isRanSet = false
        return c1[aura_env.ran], c2[aura_env.ran]
    end
    
end

On Init Custom:

aura_env.isRanSet = false
#

probably a smarter way to do this but this works.

hazy quiver
#

seems to be working for me :O