View Single Post
03-12-18, 04:34 AM   #3
jukx
A Murloc Raider
 
jukx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 7
Sure, here you go:

Lua Code:
  1. frame:RegisterEvent("UNIT_TARGET")
  2. frame:HookScript("OnEvent", powerBarHandler)
  3.  
  4. function powerBarHandler(frame, event, unit)
  5.     updatePowerBarVisibility(frame)
  6. end
  7.  
  8. function updatePowerBarVisibility(frame)
  9.     local unit = 'target'
  10.     if UnitPlayerControlled(unit) or UnitPowerType(unit) ~= 1 then
  11.         frame.Power:Show()
  12.     else
  13.         frame.Power:Hide()
  14.     end
  15. end
(simplified a tad)

The goal was to hide the target frame power bar for NPCs that don't use power. From testing it seems that they have assigned the power type 1 (i.e. 'RAGE').
  Reply With Quote