tag on target by ID
Hello everyone, I took the macro as a basis
Lua Code:
It is necessary that an automatic tag be placed on NPS ID 205089 Lua Code:
|
TargetUnit() is a protected function and can't be called autonomously. Additionally, it only accepts a name or valid UnitID (same goes for the /target commands).
|
Quote:
|
No, unitID is a variable that has to hold one of the predefined unit values such as player, target, focus, pet etc. As the unit id link posted by SDPhantom explains.
But as was said, you can target by name such as /target Fel Reaver - although you might have to put quotes around the name. I've never used named targetting in macros so can't be 100% sure there. Maybe you can explain what you are hoping to achieve with this project. |
Quote:
ID NPC 205089 |
Ah, then nope, not possible to do that.
Not sure where that ID you are talking about comes from as the GUID value which is a short term unique id for everything in the game is much longer than a single number. "Creature-0-1465-0-2105-448-000043F59F" Which is an example provided on https://warcraft.wiki.gg/wiki/API_UnitGUID page. Unless you have already extracted the ID element from the GUID. The ID for that creature is 448 with the three immediately before referencing the server, instance and zone they are in. I cannot see a reverse equivalent except for players (https://warcraft.wiki.gg/wiki/API_GetPlayerInfoByGUID). So, the nearest you could get ( assuming it is the GUID you are talking about ) is to cycle through all the possible targets via the /target ( or more precisely in this case /targetenemy) command or tab target and use the PLAYER_CHANGED_TARGET or UNIT_TARGET events to identify a target switch or use the UPDATE_MOUSEOVER_UNIT event to identify an entity under the mouse when you move it. see the following pages for more info: https://warcraft.wiki.gg/wiki/UNIT_TARGET https://warcraft.wiki.gg/wiki/PLAYER_TARGET_CHANGED https://warcraft.wiki.gg/wiki/UPDATE_MOUSEOVER_UNIT and use UnitGUID to get their unique ID and check it against the one(s) you want. Once you have identified the correct target you could then use ( https://warcraft.wiki.gg/wiki/API_SetRaidTargetIcon ) to set an icon on that entity so people can see it. I am assuming this is so that everyone targets the same entity. I obviously haven't tried this myself, but it would be my first steps in attempting such a task. There is no way to do this without you utilising a hardware action ( keypress, slash command, mousemove etc ) for each target change. |
Quote:
I found another macro that determines the NPC by ID (based on the example of achievement Something's Not Quite Right....). Lua Code:
Is this how it will work? Lua Code:
|
It won't work exactly like that. This, theoretically, is what you want to use. You might have to tweak it but I think it's coded up the way you need it to be.
Lua Code:
UnitGUID("target") will only return a value if you have physically targetted a mob - I mentioned PLAYER_TARGET_CHANGED event being the one to watch for that happening to do your work. Unless you are only ever going to need that one single creature then you will have to edit your addon, reload your UI so you can do it again for the next target of interest. And when they rebuild the GUIDs you will likely have to change the numbers again. It depends on whether these are special entities that keep their GUID permanently like players. However, you could add in a slash command that allows you to type in the id of the next npc if you will need to repeat this for each npc you will be going after and to cater for GUID changes. I will leave that task up to you, but all you will need to do in that block of code is grab the id you typed and set that to the variable set up for it. |
Hello thank you very much. You helped me.
Is it possible to remake the code in which it is not necessary to target NPCs? Like, for example, in a number of addons for scanning rare monsters (they put a mark even if you didn’t target the NPC). |
You might be able to use "mouseover" instead of "target" and the event "UPDATE_MOUSEOVER_UNIT" but it is still reliant on the mouse moving over the mob and will trigger whenever you mouse over anything with a 3d model.
https://warcraft.wiki.gg/wiki/UPDATE_MOUSEOVER_UNIT nUI uses mouseover if I remember rightly. At least I remember the odd rare message pop up as I moved around the world with my mouse. |
Thanks for the tip. I'm a beginner in this business. Will that work?
Lua Code:
|
Not quite, give this a go. Hopefully despite the functions having the word target in them they will work on mouseover too.
Lua Code:
|
Thank you very much, I will test this code today.
|
All times are GMT -6. The time now is 03:52 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI