NPC Testing Macros

Forum rules
Treat others with respect. Report, don't respond. Read the complete forum rules.
User avatar
Wain
The Insane
The Insane
Posts: 12261
Joined: Tue Jul 27, 2010 1:54 am
Gender: Male

NPC Testing Macros

Unread post by Wain » Mon Sep 10, 2018 10:04 am

For checking creatures for Petopia, the following macro will give you the NPC ID and pet family (if it exists) for a targeted NPC:

Code: Select all

/run print("Target NPC Family: ", UnitCreatureFamily("target"), " ID: ", strmatch(UnitGUID("target"),"-(%d*)-%x*$"))

The following macro will do the same thing, but it also opens a dressing room window that shows the NPC in one of its randomly-chosen looks / colours (thanks to Xota):

Code: Select all

/run local npcid = tonumber(strmatch(UnitGUID("target"),"-(%d*)-%x*$")) print("Target NPC Family: ", UnitCreatureFamily("target"), " ID: ", npcid) ShowUIPanel(DressUpFrame) DressUpModel:SetCreature(npcid)
If the NPC can appear in multiple colours / looks, then repeatedly hitting the button for that macro will eventually reveal all of them. Note that the chance of it displaying a particular look is the same as in the game, so if an NPC colour is set to only appear rarely, say 1 in 10 times, then the same will be true of this macro. There seems to be only a few NPCs with looks that do that, though.
Shaman avatar by Spiritbinder.

Xota
Master Hunter
Master Hunter
Posts: 1013
Joined: Sat Sep 18, 2010 3:08 pm
Realm: Ner'zhul (US)

pet preview macro(s)

Unread post by Xota » Wed Feb 05, 2020 4:22 pm

Back when we were looking which hexed beasts kept their drustvar spookiness, I shared a macro that would preview what the pet would look like post tame. Since then, Blizzard changed how the Dressing Room code worked, so the code no longer works. And if there's a way to do it using the current Dressing Room code, I don't know it. So here's a quick and dirty substitute, it shows your current target's model, with the special effects it will probably keep when tamed (not 100% accurate, but a good approximation), on the side of your screen. It also prints out the npcid, so you can look up the npc on wowhead or report it here if it's noteworthy.

The code is too long to fit in one macro :( You can adjust the width, height, and location (I put it -100 from the right edge of the screen, up 100 from the bottom). If you don't get "preview set up" the first time you run it, then the name I give the preview model is taken. Just change all the 'ppm' to a different name, like 'ppm1'.

Setup:

Code: Select all

/run if (not ppm) then ppm = CreateFrame("PlayerModel") ppm:SetHeight(300) ppm:SetWidth(200) ppm:SetPoint("BOTTOMRIGHT",WorldUI,"BOTTOMRIGHT",-100,100) ppm:SetRotation(.5) print("preview set up") end 
Show target:

Code: Select all

/run  if (ppm) then if UnitIsVisible("target") then local npcid = tonumber(strmatch(UnitGUID("target"),"-(%d*)-%x*$")) print(npcid) ppm:SetCreature(npcid) ppm:Show() else ppm:Hide()  end else print("run setup macro") end
edit: changed setup macro to rotate model about 30 degrees.
Attachments
playermodel.png
playermodel.png (681.2 KiB) Viewed 2188 times
Last edited by Xota on Sat Feb 15, 2020 1:49 pm, edited 1 time in total.

User avatar
Wain
The Insane
The Insane
Posts: 12261
Joined: Tue Jul 27, 2010 1:54 am
Gender: Male

Re: pet preview macro(s)

Unread post by Wain » Fri Feb 14, 2020 9:53 am

Xota wrote:
Wed Feb 05, 2020 4:22 pm
Back when we were looking which hexed beasts kept their drustvar spookiness, I shared a macro that would preview what the pet would look like post tame. Since then, Blizzard changed how the Dressing Room code worked, so the code no longer works. And if there's a way to do it using the current Dressing Room code, I don't know it. So here's a quick and dirty substitute, it shows your current target's model, with the special effects it will probably keep when tamed (not 100% accurate, but a good approximation), on the side of your screen. It also prints out the npcid, so you can look up the npc on wowhead or report it here if it's noteworthy.
Thank you so much for this workaround! I was wrestling with the old macro, trying to find a workable fix for 8.3 but I had no luck. Your code will allow us to keep going :)

There is a kind of other way, though it's inconvenient. You can go to the PTR and mouse over an NPC and hit the F6 button (or was it F12? whatever the bug report button is) and it'll bring up a dressing room window in a random colour for that NPC. You can spam it to see all the colours an NPC can come in, much like our macro, but it's annoying to have to go to the PTR just to do that.
Shaman avatar by Spiritbinder.

Xota
Master Hunter
Master Hunter
Posts: 1013
Joined: Sat Sep 18, 2010 3:08 pm
Realm: Ner'zhul (US)

Re: NPC Testing Macros

Unread post by Xota » Fri Feb 14, 2020 4:44 pm

If anyone else wants to experiment, and is lua inclined, this can save you a little time (although I could be wrong about some of it).
The DressUpFrame went from using a DressUpModel to using a ModelScene with a bunch ModelSceneActor's, which doesn't derive from any of the old Model types. One ModelSceneActor is your character, and to get a handle on it you run DressUpFrame.ModelScene:GetPlayerActor(). It can change if you close and re-open the dress up window. There are a few functions that let you set the model of a model scene actor.
SetModelByUnit(UnitID), where UnitID is a string like "target". If it isn't a player character, this crashes wow for me. Very frustrating, because I keep testing thinking I must have gotten it wrong. I don't know if it's because ModelSceneActor is initialized differently for players than npcs and vehicles, and I'm co-opting an actor that's not ready for an npc, or if you just can't use that on any actor for npcs. My guess is the second, because the following function does work: SetModelByCreatureDisplayID(DisplayID). I don't think anyone's figured out if you can get the DisplayID from a unit through the game, the places I've seen people talking about DisplayID's, they just get them off of wowhead's javascript. I expect that if a unit shapeshifts/polymorphs/etc, that it would have a different DisplayID.

Here's a list of the functions on the relevant object types.
https://wow.gamepedia.com/Widget_API#ModelScene

For testing, I use Hexed Craghopper, npcid: 143929, displayid: 88290

User avatar
Wain
The Insane
The Insane
Posts: 12261
Joined: Tue Jul 27, 2010 1:54 am
Gender: Male

Re: NPC Testing Macros

Unread post by Wain » Sat Feb 15, 2020 12:36 pm

Thanks :) Anything macro that directly uses the display ID of the target would probably be out (for my use, anyway) because that means we wouldn't be able to use it to see all the possible random looks the NPC can come in. It would have to be something that works by creature ID :/ I'll investigate further in my spare time, anyway. Maybe someone in the dataminer hangouts might know of a simpler way of using the ModelScene with an NPC.
Shaman avatar by Spiritbinder.

Xota
Master Hunter
Master Hunter
Posts: 1013
Joined: Sat Sep 18, 2010 3:08 pm
Realm: Ner'zhul (US)

Re: NPC Testing Macros

Unread post by Xota » Sat Feb 15, 2020 1:49 pm

I've found a way to use the DressUpFrame, which will be useful for what you want (seeing random looks that the npc can possibly come in). I think you can do something slightly different to find it's current displayID, which I think might be most useful for dire beasts.

It still requires a one-time (per session) setup macro, because of the circuitous way to get the DisplayID'S (using a hidden PlayerModel) takes up a lot of characters out of the 255 we're allowed. I also had to trim the print formatting. The scale may be messed up, but you can zoom in/out, and rotate using the DressUpFrame, where you can't with the other code.

Setup:

Code: Select all

/run if (not ppm) then ppm = CreateFrame("PlayerModel")
display macro:

Code: Select all

/run local n=tonumber(strmatch(UnitGUID("target"),"-(%d*)-%x*$")) ShowUIPanel(DressUpFrame) ppm:SetCreature(n) DressUpFrame.ModelScene:GetPlayerActor():SetModelByCreatureDisplayID(ppm:GetDisplayInfo()) print(tostring(UnitCreatureFamily("target"))," ",n)
edit: this won't work if you have not looked at yourself in the dressing room at least once that session. easy enough to do.
Attachments
dressupframe.png
dressupframe.png (719.46 KiB) Viewed 2188 times
Last edited by Xota on Sun Feb 16, 2020 7:36 pm, edited 1 time in total.

User avatar
Wain
The Insane
The Insane
Posts: 12261
Joined: Tue Jul 27, 2010 1:54 am
Gender: Male

Re: NPC Testing Macros

Unread post by Wain » Sun Feb 16, 2020 11:34 am

Awesome! Thank you :) I'll check it out when I get a chance, but it sounds ideal.
Shaman avatar by Spiritbinder.

Post Reply