Thread Tools Display Modes
Prev Previous Post   Next Post Next
01-29-23, 03:48 AM   #1
Shateiel
A Defias Bandit
Join Date: Jan 2023
Posts: 2
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)
EventRegistry:RegisterCallback("PLAYER_REGEN_DISABLED", function() 
	PlayerFrame:SetAlpha(1)
end)

EventRegistry:RegisterCallback("PLAYER_REGEN_ENABLED", function() 
	PlayerFrame:SetAlpha(0.05)
end)

PlayerFrame:HookScript("OnEnter", function(self)
	self:SetAlpha(1)
end)

PlayerFrame:HookScript("OnLeave", function(self)
	if not InCombatLockdown() then
		self:SetAlpha(0.05)
	end
end)
This was working perfectly fine then I thought "why don't i use this also for Target Frame and added some codes with trial and error and it happened to be like;

Code:
PlayerFrame:SetAlpha(0.05)
EventRegistry:RegisterCallback("PLAYER_REGEN_DISABLED", function() 
	PlayerFrame:SetAlpha(1)
end)

EventRegistry:RegisterCallback("PLAYER_REGEN_ENABLED", function() 
	PlayerFrame:SetAlpha(0.05)
end)

PlayerFrame:HookScript("OnEnter", function(self)
	self:SetAlpha(1)
end)

PlayerFrame:HookScript("OnLeave", function(self)
	if not InCombatLockdown() then
		self:SetAlpha(0.05)
	end
end)

TargetFrame:SetAlpha(0.2)
EventRegistry:RegisterCallback("PLAYER_REGEN_DISABLED", function() 
	TargetFrame:SetAlpha(1)
end)

EventRegistry:RegisterCallback("PLAYER_REGEN_ENABLED", function() 
	TargetFrame:SetAlpha(0.2)
end)

TargetFrame:HookScript("OnEnter", function(self)
	self:SetAlpha(1)
end)

TargetFrame:HookScript("OnLeave", function(self)
	if not InCombatLockdown() then
		self:SetAlpha(0.2)
	end
end)
This was also working perfectly fine but there was a problem which is PlayerFrame and TargetFrame was not fading in when i target myself out of combat. I still couldn't figure it out how I can implement it in this addon. Tried a lot of code groups for "PLAYER_CHANGED_TARGET" and "UNIT_TARGET" with if UnitIsUnit conditions. They didn't work. Tried some HookScript with "OnEvent" tags, that didn't work neither. maybe it was just me who doesn't know anything about coding and made some mistakes on punctuation marks etc. but I quite learn quick and made it work for this code here;

Code:
TargetFrame:HookScript("OnShow", function(self)
    if UnitIsUnit("targettarget", "player") then
      self:SetAlpha(1)
    else
      self:SetAlpha(0.2)
    end
end)
Which makes TargetFrame's Alpha to stay at value 1.0 but i can't use it for PlayerFrame because PlayerFrame doesn't goes to "hide" situation even its Alpha value is (0.05).

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.

Last edited by Shateiel : 01-29-23 at 03:55 AM. Reason: Addition and extra information about hovering the cursor over
  Reply With Quote
 

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » help me configure target/player frames fade in/outs


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