help me configure target/player frames fade in/outs
Hello there,
I don't have any clue about coding. Just want PlayerFrame and TargetFrame to fade in/out in some conditions so I've searched for an addon, they mostly do more than i want like ElvUI. I can't use those compilation AddOns because i am using some others for each particular one like; KuiNameplates for nameplates, Bartender4 for action bars, Bagnon for inventory etc. So I've searched for codes to use them in addon.bool.no to be able to implement it to my game. Found a code as this; Code:
PlayerFrame:SetAlpha(0.05) Code:
PlayerFrame:SetAlpha(0.05) Code:
TargetFrame:HookScript("OnShow", function(self) So my problem with PlayerFrame still exists. I just want its Alpha to be on value(1) when i target myself to be able to see my health etc. because i am playing the game almost out of ui and things appear on my screen when I am in combat like this; if you look carefully you can see my PlayerFrame, action bars etc. there on alpha value(0.05). They pop up when I hover my cursor over them. like this; into this on combat; Thanks for any helps in advance. |
It'll probably help to consolidate the logic into a single function that evaluates the entire list of conditions in which you want the UnitFrames to show. Additional "handlers" were added to link the events and mouse actions to the visibility logic.
Lua Code:
PS: EventRegistry can be a little confusing as its a shared system that can handle both internal callbacks and frame events. That being said, frame events require the event to be registered through EventRegistry:RegisterFrameEvent() in order for your callback registered with EventRegistry:RegisterCallback() to run. You can do both in a single call with EventRegistry:RegisterFrameEventAndCallback(). My guess is since this wasn't an issue for you, some other code (possibly not yours) is already using those events and had registered them properly. You shouldn't rely on this as it might not always be the case and EventRegistry runs a counter on how many functions are linked to any specific frame event. If those counters get out of sync by incomplete registrations, you may find yourself randomly no longer getting event triggers. |
Thanks for insightful and kind reply which helps me to understand the coding more.
Quote:
Also, at first; copy-pasted all of the codes you provided, it does nothing. Should I add something ? this "local" code is whole new thing for me, sorry if the question is a stupid one. |
I had a semicolon in a bad spot. I ended up rewriting the code to use OnUpdate because each UnitFrame has a lot of children that made the OnEnter/OnLeave scripts fire erratically.
Lua Code:
For future reference, script errors are turned off by default. You can enable them by typing this command into chat. Code:
/console scriptErrors 1 |
All times are GMT -6. The time now is 01:23 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI