Target closest enemy and cast ability

Trying to make a macro to cast Rampage on 1) mouseover target, 2) closest enemy

is it

/cast [@mouseover, exist, nodead] Rampage
/cleartarget
/targetenemy [noexists][dead]
/cast Rampage

or

/cast [@mouseover, exist, nodead] Rampage
/startattack
/cast [exist, nodead] Rampage

I’d go with

#showtooltip
/startattack
/cast [@mouseover,harm,nodead] [] Rampage

One thing to note, neither this macro nor the ones you posted will set your mouseover to your current target, they’ll just cast Rampage on it.

Ya i know that, but what I have right now with just
/cast [@mouseover, ham, nodead] [harm, nodead] Rampage is that sometimes my character is stuck there not able to Rampage anything, not sure why.

Do you have a solution to set my mouseover target to the closest target?

Okay, here’s the deal.

Target is a unit.
Mouseover is a unit.
Focus is a unit.
Raid3 is a unit.
Party4 is a unit.
Arena1 is a unit.
Pet is a unit.
Player is a unit.

Concatenated combinations of these are units.

TargetPet is a unit. (the pet of your target)
TargetPetTarget is a unit. (the target of the pet of your target).

“Mousever target” is the target of your mouseover unit.

I think part of this is that in conflating what some of these words mean, you’ve lost the narrative of what you want.

There is no way to “set” your mouseover unit to anything. It’s only and always the unit under your cursor.

If you want to set your TARGET unit to be your MOUSEOVER unit you’re going to have to move your cursor to the unit you want to be your target and click on it.

You COULD use a macro for that but it’s pointless. Just click the unit you’ve moused over and there you go. You’d still have to move your mouse over the unit you want to be your target and click the button the macro is on (far less intuitive).

If you want to target the nearest enemy in your forward cone then this will do it, but it’s irrelevant what your “mouseover” unit or even your current target is.

/cleartarget
/targetenemy

If you want to ensure that it’s a PLAYER that you’re targeting, use this instead.

/cleartarget
/targetenemyplayer

Those will drop your current TARGET UNIT and then replace it with the nearest enemy/enemy player in your forward cone.

If I understand the problem correctly, sometimes you are in combat, you can’t tell who or what is closest to you, your current target has died so you’re not actually attacking anything at all, and you can’t figure out who or what is in front of you because the scrum is too dense.

If that’s true, let me know.

I have a solution but I don’t want to post it if I’m solving the wrong problem.

Yes that is true, in a intense pack with 5-10 mobs, with what i am currently using
/cast [@mouseover, ham, nodead] [harm, nodead] Rampage

my character just stand there doing nothing. I know i can solve it by tabbing or clicking on units in front of me, but again i am just so overwhelmed that i don’t have the reaction time to do those things, and I hope my macro can just target closest enemy in my forward cone and hit it.

ur solution is better than
/cleartarget
/targetenemy

?

Assuming all of your Targeted Attacks are written like this:

/cast [@mouseover,harm,nodead][harm,nodead][]Targeted Attack

You can change them to this:

/cleartarget [help][noharm,exists][dead][mod]
/targetenemy [help][noexists][noharm][dead][mod]
/cast [@mouseover,harm,nodead][harm,nodead][]Targeted Attack

What that will do is this:

If your target unit is helpable, not harmable, dead, or you have a mod key held down, you’ll clear your target and move the closest enemy unit in your forward cone into your target unit.

If none of that is true, you’ll keep your currently targeted, harmable, living enemy unit in as your target.

If you have a harmable, living unit as your mouseover unit, you’ll attack it. If not, you’ll attack your harmable, living target unit, otherwise you’ll act as if you’d clicked the ability out of your spellbook with no target.

Ideally you’ll do this with ALL of your targeted attacks, but you could just do it with your FIRST attack ability (the one you use first on a new target).

1 Like

holy crap thats so cool.

how would this be used to work in pvp too?

Just change /targetenemy to /targetenemyplayer

I mean, you don’t have to change it at all, but if you absolutely want to hit only players, that’ll do it.

so targetenemy will target both npc and players, but targetenemyplayer will ONLY target players?

Yes, and there’s a CVAR you can set to make TargetEnemy prioritize one or the other routinely but I don’t remember what it it. I think Elvenbane knows.

/startattack will target the nearest enemy if you don’t already have one targeted.

/targetenemy works the same as tab targeting.

/targetenemyplayer is a legacy command from before they revamped the targeting logic and I wouldn’t recommend ever using it.

/run C_CVar.SetCVar("TargetPriorityPvp",3)

Also, I strongly recommend against using /cleartarget rotationally as it may reset your swing timer causing you to lose significant dps from auto attacks.

I personally wouldn’t use mouseovers on melee characters except for abilities like taunt, charge, intervene, and ranged abilities like heroic throw.

oh…so…

/targetenemy [help][noexists][noharm][dead][mod]
/cast [@mouseover,harm,nodead][harm,nodead][]Targeted Attack

is this good?

Ehiz’s version isn’t clearing your target if you’re targeting an enemy (unless you hit a modifier) so you should be good to use it as-is.

If you want to trim the redundancy:

#showtooltip
/cleartarget [mod] [help] [dead]
/startattack
/cast [@mouseover,harm,nodead] [] SPELL

It is if your enemy is dead or charmed, but no. The intent is that you continue attacking your current enemy unless it dies, is made unharmable, or you have a mod key held.

another problem that comes up is when my current target is out of range.
In a multi-mob pack, sometimes my selected target is just slightly out of my melee range and I stand there being stuck spamming my abilities.

Now, is the only way to remedy that to /cleartarget (without any conditionals)? which would cause the swing timer reset/loss of auto attack dps that Elvenbane mentioned?

What’s what the [mod] on the /cleartarget is for. Hit the macro with one or more of CTRL/SHIFT/ALT held down and it’ll clear ur current target then select the closest one.

Note that keybinds take priority over macro modifiers and CTRL 1-6 and SHIFT 1-6 are bound by default. So you’ll need to unbind them to use them as modifiers on those keys.

The whole reason for making this macro is to spam the button without worrying about tabbing or clicking/switching targets. Holding down a mod is to me more trouble than just me clicking on a diff target. Also, in the heat of a pull, i often don’t realize that i am out of range of my currently selected target until a few seconds later when my character is stuck.

Yeah… that’s not possible. I suggest you get something that clearly tells you when you’re not in melee range.