Quantcast
WoWInterface - View Single Post - Warrior stance on unit frame
View Single Post
03-09-21, 01:31 AM   #3
jegarn123
A Defias Bandit
Join Date: Mar 2021
Posts: 2
Originally Posted by Kanegasi View Post
Replace everything you have here with the following:

Lua Code:
  1. local f=CreateFrame("frame")
  2. f:RegisterEvent("PLAYER_LOGIN")
  3. f.update=function(frame)
  4.     if frame and frame.unit=="player" and frame.portrait then
  5.         if frame.onHateList then
  6.             for i=1,GetNumShapeshiftForms() do
  7.                 local _,active,_,spellid=GetShapeshiftFormInfo(i)
  8.                 local _,_,icon=GetSpellInfo(spellid)
  9.                 if active and icon then
  10.                     SetPortraitToTexture(frame.portrait,icon)
  11.                     return
  12.                 end
  13.             end
  14.         end
  15.         SetPortraitTexture(frame.portrait,"player")
  16.     end
  17. end
  18. f:SetScript("OnEvent",function(self,event)
  19.     if event=="PLAYER_LOGIN" then
  20.         local _,class=UnitClass("player")
  21.         if class~="WARRIOR" then return end
  22.         self:RegisterEvent("PLAYER_REGEN_DISABLED")
  23.         self:RegisterEvent("PLAYER_REGEN_ENABLED")
  24.         self:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
  25.         hooksecurefunc("UnitFramePortrait_Update",self.update)
  26.     end
  27.     self.update(PlayerFrame)
  28. end)





It worked! Thank you so much for taking the time to help out! Appreciated!
  Reply With Quote