Nameplate threat texture
Hi guyz.
I want to show and change the color of the Threat Region of nameplates, that texture that glows with aggro changes etc. Once I have intercepted the nameplate, I get the Threat Region and then I do a SetVertexColor(0, 1, 0, 1) on it and a Show() to show it in green, but when I do it, nothing happens, the texture doesn't appears. I'm sure I get the region correctly (I saw it on LibNameplate's source code). I also get other regions correctly (name, level, etc). This is basically what I do Lua Code:
Anybody that has worked with nameplates knows why? |
Quote:
If 'TheNameplate' is a stock UI nameplate, is SetScript not a bit dangerous? HookScript does the same as SetScript if no function already exists for the handler in question with the added bonus of not inadvertently removing the script set by Blizz (or another addon). If it's your own nameplate, sorry for misunderstanding. In your example, is 'TheNameplate' the same object as 'Plate'? If so... Lua Code:
If it were me, I'd use print to test the code to make sure you're on the right track. Notably, I'd definitely check the return value of GetThreatRegion(). Lua Code:
I'm not sure, but using the first return from GetRegions (from the first return of GetChildren) seems a bit off. |
Quote:
Anyway, the whole GetThreatRegion() function is extremely inefficient. You should identify all of the nameplate's children and regions once -- the first time you see the nameplate -- and attach them to the nameplate as table key/value pairs, eg. nameplate.threatRegion = x so you can get a reference to each region from a simple table lookup, instead of needing to do a whole chain of function lookups every time. See http://www.wowinterface.com/forums/s...ad.php?t=44971 for an example. |
I tried playing with the threat frame when I did my nameplate stuff. Afaik the threatplate aswell as the newly introduced tapped coloring are done via OnUpdate or the like outside of Lua.
You can show it but it will hide itself on the next update because you have no threat state and Blizzard only shows orange or red threat state. Adding any hook to the threat plate does not work. I tried hooking the SetVertexColor function of the threat texture since that had to fire when the threat plate changed threat color. It never did. I would not bother playing with that. |
Quote:
Plate is a reference, yes, but I was asking what object was actually getting passed to the func. |
Quote:
Lua Code:
Quote:
Quote:
Quote:
|
All times are GMT -6. The time now is 04:03 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI