Thread Tools Display Modes
06-10-09, 10:46 AM   #1
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Help with a threat function issue please ?

Allright so, here's a small threat function, working just fine but not exactly the way i want it to work.
Code:
caelPanels.UNIT_THREAT_SITUATION_UPDATE = function(self)
	local status = UnitThreatSituation("player", "target")
	for i = 1, 7 do
		local panel = panels[i]
		if panel then
			if (status and status > 0) then
				local r, g, b = GetThreatStatusColor(status)
				panel:SetBackdropBorderColor(r, g, b)
			else
				panel:SetBackdropBorderColor(0, 0, 0)
			end
		end
	end
end
As you can see local status = UnitThreatSituation("player", "target")

It will only show my threat toward my current target, but my goal was to have it change color if i have aggro from any mob, not just my target, let's take a quick example, i target a mob in a pack of 10 and start using Volley, and get aggro from one of the mob but not the one i'm targetting...

I've tried to do local status = UnitThreatSituation("player", unit) but that doesn't seems to work.

Any idea ?
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
  Reply With Quote
06-10-09, 11:47 AM   #2
Hirsute
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 14
Someone in your party will need to be targetting the mob, I believe. This is a limitation of Blizzard's threat implementation.
  Reply With Quote
06-10-09, 12:13 PM   #3
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by Hirsute View Post
Someone in your party will need to be targetting the mob, I believe. This is a limitation of Blizzard's threat implementation.
Hmm no, here's for example how i use it in my oUF layout, unfortunately that won't work here.

local status = UnitThreatSituation(unit)
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
  Reply With Quote
06-10-09, 12:31 PM   #4
Hirsute
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 14
Originally Posted by Caellian View Post
Hmm no, here's for example how i use it in my oUF layout, unfortunately that won't work here.

local status = UnitThreatSituation(unit)
I'm no expert here. Is "unit" the unit token for one of your party members? Because according to here, that would query the threat of the Unit, and it takes a second argument to query the mob the unit has threat on specifically.

But like I said, I'm not expert with the threat system. My understanding was that you cannot query the threat table of any mob that someone in your party is not targetting.

Last edited by Hirsute : 06-10-09 at 12:33 PM.
  Reply With Quote
06-10-09, 02:53 PM   #5
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
Under details one the page it reads:
If the second argument is omitted, this function will return 3 if the unit has aggro on something, or 0 otherwise. Needs confirmation/additional testing.
I'm no expert of the thread system either, but as you only want to query thread info about the player (based on your oUF-code and the wowwiki-page), you basically just have to use:
Code:
local status = UnitThreatSituation("player")
Just omit the "unit" as you're replacing it with the player-unitID and didn't define it before. So, if "unit" is anything other than 'nil', it likely causes the function to fail.
__________________
« Website | GitHub »

Oh hai!

Last edited by xConStruct : 06-10-09 at 02:57 PM.
  Reply With Quote
06-10-09, 03:45 PM   #6
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by Cargor View Post
Under details one the page it reads:


I'm no expert of the thread system either, but as you only want to query thread info about the player (based on your oUF-code and the wowwiki-page), you basically just have to use:
Code:
local status = UnitThreatSituation("player")
Just omit the "unit" as you're replacing it with the player-unitID and didn't define it before. So, if "unit" is anything other than 'nil', it likely causes the function to fail.
Works, as simple as that, thanks !
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Help with a threat function issue please ?


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