make blizz frames appear when damaged
so i want to make the blizz player,target,and pet frames disapear when im out of combat but also have my player frame appear when im damaged.
so the code i have here can hide them out of combat but i dont know what to put to make it appear when im damaged also. im also trying to make a toggle switch that if i need to make them visible i can press a macro to unhide and hide manually. RegisterStateDriver(PlayerFrame,"visibility","[combat][exists] show; hide") RegisterStateDriver(TargetFrame,"visibility","[combat][exists] show; hide") RegisterStateDriver(PetFrame,"visibility","[combat,@pet,exists] show;hide") thats what i got so far after searching the internet for a solution for hours. help me o lua gods your my only hope. |
:Show() and :Hide() are protected in combat iirc (which means they can't be called), so I believe you can't have the frame jump to shown when damaged, as taking damage throws you in combat
|
Removing [exists] will hide while not in combat.
You could Code:
RegisterStateDriver(PlayerFrame,"visibility","[combat][noexists:target] show; hide") Someone else might have better. |
Quote:
So what this does so far will hide it if I知 out of combat and show if I知 in combat or have a target. I want to make it so that it also makes it stay visible if I知 not at full health. I知 still new at writing code so if any knows how to add that to what I got I appreciate your efforts. |
Quote:
https://github.com/kaytotes/Improved...yer.lua#L25-39 This block of code decides whether or not to hide the Blizzard PlayerFrame; The variable "hide" comes from their event handler here: https://github.com/kaytotes/Improved...er.lua#L84-114 And the event(s) that will fire that function are here: https://github.com/kaytotes/Improved...r.lua#L122-130 Basically, they fire an event any appropriate time (PLAYER_ENTERING_WORLD for initial login, and any time the player sees a loading screen, any time you enter/exit a vehicle, etc..) to check the status of the PlayerFrame healthbar. Then, inside that function they check a couple of small things: Do you have a target? Are you regenerating heatlh? If either of these things are true, then it DOES NOT hide the frame. If BOTH of these things are FALSE, then it DOES hide the frame. The actual hiding function checks a couple of other things once more: Is your health actually full? (It's actually possible for you to NOT be at max health, be OUT of combat and NOT have Regen for a brief period, this works around that.) Is your target actually empty? (It's possible to have targetted something between when the event handler fired and when the hide function runs, this fixes that) As a small caveat, you could add a function to toggle a variable between true and false. Then your macro to force show the unit frame could use /run FunctionName(); to toggle that variable, and you could add a conditional to the hide code that makes sure that variable is false before hiding. |
Quote:
|
Is it as simple as copy/paste the lines that mention player frame and such and hope it works?
|
If you only care about its visibility and not whether you can interact with it, you can show and hide the player frame whenever you want by just setting its alpha via PlayerFrame:SetAlpha(0) and PlayerFrame:SetAlpha(1).
You will not be able to click through it (unless you want to remove mouse interaction altogether), but you can easily toggle its visibility. |
Quote:
https://drive.google.com/open?id=12Z...rigsW8rhsGlzL0 Put: Code:
/run TogglePlayerFrameHide() I should note, this only does the PlayerFrame. Just add the other frames you desire with Show() and Hide() in the appropriate places. |
Quote:
|
This should get you started at least:
Code:
local frame, forceShow, inCombat, queue = CreateFrame("Frame") Code:
/run ToggleUnitFrameForceShow() |
All times are GMT -6. The time now is 02:10 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI