UnitThreat not working - WoWInterface
Thread Tools Display Modes
04-24-18, 07:26 AM   #1
A Cliff Giant
Join Date: Jan 2017
Posts: 74
UnitThreat not working

can anyone tell, why does this code not working? Im trying to get the frame load if the party unit has threat >0

table.insert(self.__elements, function(self, _, unit, event, ...)
local status = UnitThreatSituation(unit)
if (unit == 'party1') or (unit == 'party2') or (unit == 'party3') or (unit == 'party4') then
if status and status >0 then


frame_3texture:SetPoint('CENTER', self, 'CENTER', 22, -2)
frame_3texture:SetTexCoord(1, 0, 0, 1)
But It just does nothing
  Reply With Quote
04-24-18, 08:58 AM   #2
A Frostmaul Preserver
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Could you use the LUA highlight capability of the forum?
Makes the snippets way easier to read.

You have a button in the toolbar.
[ highlight="Lua" ] [ /highlight ]

Hard to debug a piece of code in isolation and you didn't say exactly what is not working.

What I can tell you is that you need to register the Threat Events against a callback in order for you to see any updates.
Like so:

Lua Code:
  1. local function UpdateThreat(self, event, unit)
  2.  -- Do stuff here
  3. end
  5. frame:RegisterEvent("UNIT_THREAT_LIST_UPDATE", UpdateThreat)
  6. frame:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE", UpdateThreat)
My oUF Layout: oUF Lumen

Last edited by neverg : 04-24-18 at 09:01 AM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » UnitThreat not working

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