Page 1 of 1

Need help with a macro please

Posted: Sat Apr 22, 2023 7:36 pm
by Jimmyjimjames
I am trying to make a macro that will target the nearest enemy and then use X ability, I am able to do this but I run into the problem of the target nearest enemy part continuing to cycle thru enemies, does anyone know a way to make it so I am able to target nearest enemy(or anything similar) and continue to use the ability in the macro without changing targets to something else until my target dies?

Re: Need help with a macro please

Posted: Sat Apr 22, 2023 8:52 pm
by Ravenstone
What have you got? You could try this at the beginning and else the rest of your current macro.

Code: Select all

/script if UnitExists("target")

Re: Need help with a macro please

Posted: Sat Apr 22, 2023 8:59 pm
by Jimmyjimjames
/run TargetNearestEnemy()
/cast Serpent Sting(Rank 1)

That's what the macro is. I tried adding the script but it gave me an error, I'm not using any macro addons if I needed one for that to work

Re: Need help with a macro please

Posted: Sat Apr 22, 2023 9:29 pm
by Ravenstone
Try

Code: Select all

/script if UnitExists("target") cast Serpent Sting(Rank 1) else run TargetNearestEnemy()
Shouldn't need any addons.

Re: Need help with a macro please

Posted: Sat Apr 22, 2023 9:39 pm
by Jimmyjimjames
its giving me an error, that sounds like what I would want tho

Re: Need help with a macro please

Posted: Sat Apr 22, 2023 9:50 pm
by Ravenstone
I can't log in to check, but thinking about it, is this not default behaviour anyway? Casting Serpant Sting should automatically cast at the nearest one no?

Re: Need help with a macro please

Posted: Sat Apr 22, 2023 10:11 pm
by Jimmyjimjames
I was thinking that too, it seems to only work with some abilities, it works for my raptor strike but when I try to do it with sting even next to a target it wont do it

Re: Need help with a macro please

Posted: Sun Apr 23, 2023 7:57 am
by Jimmyjimjames
bump?

Re: Need help with a macro please

Posted: Sun Apr 23, 2023 8:37 am
by Ravenstone
Try this:

Code: Select all

/script if not UnitExists("target") then TargetNearestEnemy() end
/cast Serpent Sting(Rank 1)

Re: Need help with a macro please

Posted: Sun Apr 23, 2023 9:09 am
by Jimmyjimjames
it seems to working the way i wanted, thank you for taking the time to help me. means a lot

Re: Need help with a macro please

Posted: Sun Apr 23, 2023 9:52 am
by Jimmyjimjames
is there a way after my target dies to allow the macro to go to another target if the current one is dead?

Re: Need help with a macro please

Posted: Sun Apr 23, 2023 10:28 am
by Ravenstone

Code: Select all

/script if UnitHealth("target")==0 and UnitExists("target") then ClearTarget() end
/script if not UnitExists("target") then TargetNearestEnemy() end
/cast Serpent Sting(Rank 1)

Re: Need help with a macro please

Posted: Mon Apr 24, 2023 4:46 am
by Jimmyjimjames
It works perfectly, thank you. I found the command to add a pet attack with it, I think its good to go :)