Display creature macro issue

Since 8.2 I’ve been unable to get this macro to work. It used to display the targeted creature:

/run local npcid = tonumber(strmatch(UnitGUID(“target”),"-(%d*)-%x*$")) print("Target ID: ", npcid) ShowUIPanel(DressUpFrame) DressUpModel:SetCreature(npcid)

It gives a LUA error: Message: [string "local npcid = tonumber(strmatch(UnitGUID(“t…”]:1: attempt to index global ‘DressUpModel’ (a nil value)

The bit where it prints the NPC ID still works, but it’s failing to display the creature in the dressing room window.

I’ve tried other methods but been unable to find anything that works. It looks like DressUpModel is gone, and there’s no SetCreature() on other templates and I’m completely lost. Any help would be greatly appreciated. Thanks! :slight_smile:

There is ModelSceneActor:SetModelByUnit() but it will crash when used on non-player units
See also Dressing room macro 2.0

1 Like

There actually is ModelSceneActor:SetModelByCreatureDisplayID() but you will need to map from npc id to creaturedisplayid

You can look it up from wowhead page source, but if you wanted to do that in-game you’d need something like this for retail
https://github.com/ketho-wow/ClickMorph/blob/master/Data/NpcDisplayIdsClassic.lua

Thanks for your replies! :slight_smile:

I did discover SetModelByUnit() earlier and experienced those crashes. I wasn’t sure if it was due to a bug or me misusing it. Hopefully it’s the former and it’ll be fixed.

Unfortunately SetModelByCreatureDisplayID() won’t really work for me. This is because of the reason I use the macro. Essentially, when testing things to add to Petopia I could spam my old macro a bunch of times on a mob, and in the process find out all of the colours it can come in. This is because it selected a random display ID from the possible display IDs for that creature each time it was used. SetModelByCreatureDisplayID() would circumvent that, sadly :frowning:

I can dump a list of all 8.2.5 random CreatureDisplayIds for you if you want, rather than just the first one as in my previous example. Then you don’t even need to spam a macro

Thank you but I’m more after ongoing stuff, 8.3 onwards :slight_smile: I can datamine minipets etc. from CreatureXDisplay, but that doesn’t seem extend to filler NPCs / wild beasts. How do you gather your data on these? :slight_smile:

You need to use a scanning tooltip for querying NPCs to creaturecache.wdb and then use a binary template (courtesy of Simca) to parse the display ids
https://paste2.org/WwsC1fa9

e.g. for Li Li it would be something like this

local tt = CreateFrame("GameTooltip", "SomeScanTooltip", UIParent, "GameTooltipTemplate")
tt:SetOwner(UIParent, "ANCHOR_LEFT")
tt:SetHyperlink("unit:Creature-----56138")

OK thanks :slight_smile: It sounds like I’d have to encounter a number of wild NPCs in order to build up a cache of their display IDs. In most cases that’s fine. I had hoped I could find a way of finding all the ids by examining just one creature, but it may not be possible from the API anymore :confused:

I really appreciate all the help you’ve given me. Thanks again! :slight_smile: