Nameplates - Cast Bar Spell Icons Not Reliably Appearing - WoWInterface
Thread Tools Display Modes
01-10-19, 05:37 PM   #1
A Kobold Labourer
Join Date: Jan 2019
Posts: 1
Nameplates - Cast Bar Spell Icons Not Reliably Appearing

Hello modders!

I'm trying to create a nameplates addon for my personal use by taking code from other addons, and it's working somewhat well so far. But for some reason, the cast bar spell icon is not reliably appearing.

For a lot of classes, such as monks, priests, mages, etc., their casted spells (heals, channels, damage spells, etc.) will appear without a hitch. The casted spells of other NPCs, such as the Feeding Frenzy of the Saltfin Swimmer, will also appear without a hitch.

However, spell icons for spells like steady shot and aimed shot will rarely show up for hunters, and the Uber Strike casted by the Dungeoneer's Training Dummy will never show up. The differences between the two situations can be seen in this imgur gallery: https://imgur.com/a/HKcjvEH

Here is the code snippet for reference:

The full addon:

I suspect it has to do with the simplistic way that I'm handling events, and that perhaps I need to be refreshing the generation of nameplates. But I wouldn't even know where to start with that, and it boggles my mind that this script would work so well with so many spells and units, and yet fail to work with other spells and units.

I would appreciate any pointers and guidance!

EDIT: After debugging the code a bit by configuring it to display a black box whenever it runs through to the end of the function, I noticed that the whole function is being run when a spell is being casted no matter what. However, icon.Show() simply refuses to work as intended. I don’t know why. The icons aren't showing up on hunters, elite mobs, and the foxes and crabs near Boralus. However, it works fine on some mobs like Saltfin Swimmers, and I'm not having issues with players of non-hunter classes for some reason. Weird, huh?

EDIT2: I found a solution, though I don't particularly understand why this is necessary. In place of line 12, I wrote:

plate.castBar:HookScript("OnUpdate", function ( ... )
if not plate.castBar.Icon:IsShown() then

Last edited by Rouslan : 01-11-19 at 01:23 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Nameplates - Cast Bar Spell Icons Not Reliably Appearing

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off