View Single Post
06-29-13, 05:42 AM   #9
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
I cleaned up the code in my post a little and added some comments to make it more readable.

You can use a different method for detecting the nameplates if you want, this is just how I did it in my example (mostly pulled out of my QuestPlates addon).

There isn't really any reason to use SetScript over HookScript since HookScript will create the script if it doesn't already exist, and you also might want to just create your own frame for the OnUpdate script just to be safe, although I can't think of a reason why that should break.

Oh one more thing, since we are iterating over the WorldFrame children, we might want to create our new frames under a different parent to save a little overhead, for example create a single frame under WorldFrame to use as the parent for all of the rest of the frames.

This gives you a reason to create a frame for the OnUpdate script and also allows you to toggle the visibility for all of the frames at once if you needed to.

Just make sure you factor in the scale if you parent them somewhere else.

Last edited by semlar : 06-29-13 at 06:08 AM.
  Reply With Quote