Stuf + Threat + Power Text
I am currently wanting to make a small threat meter using Stuf's custom LUA text option.
All I want it to do is just show My current Threat% (without the % sign please) on my target, the color being Stuf's HP Red Color. If someone could offer assistance, I would appreciate it greatly! *~Lily.Petal~* =============== For anyone who happens to search for similar effects for their own layouts, code will be listed below. Link for other lua codes(provided by Cantises): Lua Stuf examples This code makes your power into a percent(without the %); if you are using energy/mana, the text will only show if you are under 100% (otherwise hidden). If you use RunicPower or Rage, the text will not show up unless you are above 1%. Code:
function(unit) Code:
function(unit) |
Quote:
Code:
self.ttelapsed = 0 |
Quote:
|
Quote:
|
LuaTexts can be set to run (a slightly throttled, iirc) OnUpdate if you check the "frequent updates" box.
|
Quote:
Code:
local _, _, threatpct, _, threatvalue = UnitDetailedThreatSituation(unitid, mobunitid) |
Quote:
Do I need to change unitid to player? |
Quote:
unitid = "player" mobunitid = "target" |
If you put it in as a LuaText for your player frame, it will pass your "player" unitid to the function as the first(?) argument.
|
Thank you Nib and Seerah, was great help!
Hm having a different problem now, with all my classes I use: Quote:
Is there someway that I can have it show Quote:
Quote:
|
Quote:
Code:
local _, power_token = UnitPowerType(unit) -- Lua Texts usually pass the unit arg, so leaving unit as is should work |
Quote:
Quote:
|
Hm, using stuf it says when I switch to LUA:
Quote:
Quote:
|
What is it you're trying to achieve, exactly? Just showing the Power in standard format?
|
Quote:
And the opposite if they do use said powertypes, where if it's at 0% said text will hide. Basically: if power≤99% show if not DK/Bear/Warrior as CurMP% and if power≥1% show if DK/Bear/Warrior as CurMP% Does this help? :< EDIT: it's just REALLY annoying when I'm playing my DK/Warrior that I see a 0 in the middle of my power bar when I have no power at all. |
Quote:
Barebones: Code:
local _, pToken = UnitPowerType(unit) |
Do I still need to do something with:
Quote:
Quote:
EDIT: let me try changing unit to "player" EDIT2: ugh Dx darn you stuf... darn you... (didn't work) |
Hmm, same error again? It must behave different to Pitbull's Lua Text. Maybe it needs an extra return.
Code:
local _, pToken = UnitPowerType(unit) |
Well it's not giving me an error, it's just not showing up at all. I don't really understand it.
|
Quote:
Code:
local _, pToken = UnitPowerType(unit) |
Quote:
|
Quote:
What if you try just: Code:
return "Hello World" As for me, I'm late for an appointment with my bed :p |
Quote:
|
Cant remember where i got this from but it might help with the showing of power/mana issue for stuf...
Code:
local pType, pTypeStr = UnitPowerType(unit) |
It's because you're not using a function. Just an if statement. ;)
|
Quote:
|
Quote:
|
Omoshiroi. In that case:
Code:
function(unit) |
Quote:
EDIT: Still didn't work or show up :< Going to try the one Canites posted real fast EDIT2: Tried the link (s)he gave: Code:
function(unit) |
Quote:
|
Woops, my bad, I left some Pitbull code in my examples :(
Code:
function(unit) |
You. Are. Simply. Amazing.
Thank you for all your hard work everyone; Nib, Seerah, Canities. I will make sure to edit my 1st post to show the correct examples as well as a link that Canities posted for anyone who searches for this :) EDIT: I forgot about my Threat bar! ROFL :> |
Or for some extra features:
Code:
function(unit) Edit: I wonder if Stuf supports MouseOver. In Pitbull you can just say If IsMouseOver() then and do cool things, like showing different values on mouseover. |
Quote:
Gonna see if I can get your threat bar to work now :> |
2 Attachment(s)
Something seemed odd earlier today when I was in a group...
My party members definitely did not have 1% mana lol :P Even after mana went down (2nd image) the text didn't change. Same thing with Hunter Focus :< |
Sounds like I forgot a *100. xPer lines need to read: xPer = ceil((xCur / xMax) * 100)
Code:
function(unit) |
Thank you nib~
|
Sorry about the necro threading, but the actual reason of this thread wasn't done :P While it's awesome to get my Power Text like this, my threat question wasn't finished ;D Any ideas?
Quote:
|
Code:
function(unit) Quote:
|
And you're still a God! Thank you Nib, I'll test this asap~
Quote:
|
Or for threat colored text.
Code:
function(unit) |
All times are GMT -6. The time now is 04:15 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI