Targeting Macro Help

I’m new to macro’s and am wondering why I can’t get mine to work.

My end goal is a macro that targets players first, then hostile attackable npc’s if you don’t already have a target, then if the ability doesn’t cast it targets the nearest hostile npc to cast the attack and switches the target back to the first target.

So far I have a macro that tries to target enemy players, and then depends on melee auto-targeting to pick up npc’s. The first /targetenemyplayer commands seems to cancel out any subsequent /targetenemy commands. Is this not possible, or am I just doing something wrong?

Works:                                    Doesn't Work:
#showtooltip Festering Strike             #showtooltip Festering Strike
/cleartarget [help][dead]                 /cleartarget [help][dead]
/targetenemyplayer [noexists]             /targetenemyplayer [noexists]
/cast Festering Strike                    /targetenemy [noexists]
                                          /cast Festering Strike

I also have another macro that un-targets the current target to cast an ability on the nearest npc and then re-targets the prior enemy that I can’t seem to get to work right at all…

#showtooltip Death Strike
/cleartarget
/targetenemyplayer
/cast Death Strike
/targetlastenemy

I really don’t get it, the ability only goes through when nothing is targeted in the first place. When testing with a melee range enemy and targeting far enemy It will more often than not still target and initiate combat with the closer NPC even though the ability doesn’t work. Sometimes when spamming the button the ability works on the current target, I have no idea what the hell is going on.

Lastly, I have no idea how to not target neutral attackable mobs that aren’t currently attacking you or you manually click/tab to and I’m pretty sure it’s not possible. That said, I’m no expert so I wanted to hear from them.

Are my goals attainable with or without add-ons, and can you help me figure out why my interim setups aren’t working?

1 Like

Appears you may have forgotten the macro itself.

Some commands have a one command per macro limit. I think specific targeting commands have this rule.

I tested /target with two different mobs with different names that were walking together. I added two seperate targetmarkers on them in the macro in order to visually confirm that it works. And while it did work i found that it didn’t work all the time, even when both were in front of me and easily within range.

Not sure when you’d need to target two different mobs in the same macro but it is doable even if it may not always be reliable.

I think what some people try to do is /target a bunch of mobs in a single macro in an attempt to scan for a target that they are after. That should work.

I’m pretty sure there’s a variation of target macro that only can work once in a macro, though. Like /targetenemy and /targetenemyplayer.

Terribly embarrassing, I barely finished writing this and went off to do more research on my issue before committing to a post but it seems I hit the wrong key at some point… I will update ASAP with the full narrative.

1 Like
#showtooltip
/cleartarget [help][dead]
/targetenemyplayer [noexists]
/targetenemy [noexists]
/cast Festering Strike

Line 1: Shows a tooltip of line 5’s ability.
Line 2: Clears your target if they are helpful or dead.
Line 3: Targets an enemy player, if no target exists. This will not fire if line 2 doesn’t clear the target, because it was harmful.
Line 4: Targets an enemy, if no target exists. Line 2 and 3 will go first, so this will not fire if an enemy player target is nearby or you already have a harmful target.
Line 5: Cast ability at the target.

1 Like

That is how I’d like it to work yes, but in this instance the 4th line never seems to trigger. It’s hard to tell since it will still pick up on npc’s due to melee abilities inherent auto-targeting.

In this case it’s a bit of a “Whatever, it works” scenario but in terms of my overall goal here it’s a bit of an issue since as a DK I’d like my spells to be able to do this same mechanic but not not target neutral attackable mobs.

I was looking to know why one can’t use two /targetenemy commands in a row when melee abilities targeting seems to fire anyway, or if there was just some quirky way I had to do it. I’ve experimented with even placing two small macro’s on another hotbar and calling the buttons individually from a main macro, one for targeting players the other targeting enemies. It didn’t work.

I’ve given the macro a shot, except with Smite on my priest. It seems to work properly. I don’t have auto-target enabled.

I believe anything that you can heal is considered as helpful, but anything you can attack isn’t. I’m not certain if you can filter out neutral enemies from hostile ones if they are flagged as something you can attack.

Your macro seems more of the type that prioritizes targeting pvp flagged enemy players above all else.

Can you tell me where that auto-target setting is? I just tried it on my priest with and without the macro and it seems to work either way.

That points to either that abilities are auto-target on a case to case basis and not melee only as I suspected or that there is a per-character setting I’m missing.

Oh, sorry. I believe I was mistaken about the auto-target thing being an option. I play multiple games, of which I usually disable auto-target. I suppose WoW might not be one of those that has such an option outside of macros that behave as an auto-target.

For me the macro targets an enemy that is between my character and where my camera is looking towards. It always chooses an enemy player first, but selects an enemy NPC when there isn’t a player. I’m not really getting a situation where it’s randomly doing either of the two.

Maybe it’s because of your camera direction? It could also be because they aren’t within range of the targeting, as it is also range based.

I recommend running this scrip as it will prioritize enemy players when you have WM on, and they are in front of you, and they are in range of being targeted.

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

Here are the options:
1 = default
2 = all pvp targets
3 = players only

doing so you can use a shorter version of the previously mentioned macro

#showtooltip
/cleartarget [help][dead]
/targetenemy [noexists]
/cast Festering Strike

GL

3 Likes

Hi Vdirtymawg, thank you for the response. This seems like something that would definitely help. Do I need to install the AdvancedInterfaceOptions add-on for this to work? Do you know how can I check to see if it’s set correctly? And do I need to be running this in every attack macro, or is it something I just need to run once?

I ran it once and I’ve been doing some testing on unsuspecting AFK players in Maldraxxus with the player and I being in maybe a 20yd range at most with a npc in-between and it doesn’t seem to be working. I haven’t tested it in PvP yet though.

I was using this in a macro to test:

/cleartarget [help][dead]
/targetenemy [noexists]

You don’t need the addon for it to work.

That said i think its possible for you to run the scrip but have the addon supersede the scrip. You might try it out without that addon unistalled or just figure out where you can control that feature in it.

You set it once and do not need any addons to do so.
There’s smart quotes in the version VDM posted which is why it’s not working when you copy/paste it.

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

You can test that it’s set via

/dump C_Cvar.GetCVar("TargetPriorityPvp")
3 Likes

Thanks Elvenbane. I took out the smart quotes to my earlier post.

1 Like

Thank you for the clarification, everything seems to be in working order now!

I have been working with the second macro again and with the simplified targeting it seems to be almost working, it just can’t get back to the original target. Do you have any ideas on how to get this to work?

Currently it’s just this:

#showtooltip
/cleartarget
/targetenemy
/cast Death Strike
/targetlastenemy

I don’t personally see the point of that macro. What’s its intended use?

#showtooltip
/cleartarget
/targetenemy
/cast Death Strike
/targetlastenemy

Okay, so what you’re trying to do is get a macro that targets the closest enemy player to the center of your camera, then attacks them so that you can get a heal, then moves back to your original target. An issue with that is that clearing your target will actually be considered your last target, so you might not be able to “/targetlasttarget” after using "/cleartarget. “/targetlastenemy” considers your last enemy to be your “/targetenemy” target after you “/cleartarget”. I don’t really know if there’s a technique to get your original target back after that “/cleartarget” has been made. You’d need to do that on your own without a way to get back to it.

The “/targetlastenemy” can actually do something useful, but I’d move it above the “/cast”. What it does is that it makes sure you always have an enemy selected, even if you aren’t facing them. It would then give you the correct error message for not facing them.

Edit: I found a work around, but there’s one issue. It requires the usage of your focus target. Some people reserve that for other uses.

#showtooltip
/focus [harm]
/cleartarget
/targetenemy
/targetlastenemy
/use Smite
/target focus

Edit 2: One thing is that the targeting preference of the game sometimes seems a little off. The macro might need a little more testing when it comes to massive battles, but I’m going to be busy for a bit.

As is, this macro makes no sense.

/cleartarget
/targetenemy
/targetlastenemy

Unless you plan on adding a command after /targetenemy you can literally delete this portion of the macro, as it does nothing.

As Elvenbane said earlier its not clear what OP is trying to accomplish. If OP is really looking for a macro that temporarily targets a random enemy i’d recommend:

#showtooltip
/targetenemy
/cast Spell_Name
/targetlasttarget

If you want to attack or ‘kick’ a specific target without losing your current target i’d recommend that you use @mouseover, such as:

#showtooltip
/cast [@mouseover,harm,nodead] Spell_Name

I too have tried juggling targets with macros but i think you will find the they are prone to fail even when they should technically work.

GL