I have a code, given by another player on the wow forum. This code makes my target frame only show when my target is hostile, or rather, hides my target frame when my target is friendly.
Code:
local f=CreateFrame("Frame")
f:SetScript("OnEvent",function()
local hide = UnitIsPlayer("target") or (UnitExists("target") and UnitReaction("player","target")>3)
PitBull4_Frames_target:SetAlpha(hide and 0 or 1)
end)
f:RegisterEvent("PLAYER_TARGET_CHANGED")
It's functioning correctly except for one thing. The first friendly target that I target when I log in, will not hide the target frame. After that, it works. Then, if I don't have a target for 3 seconds or so, and I target somebody friendly, the target frame appears.
Now I don't know if experts can look at codes and know exactly what they do, but I hope someone who is bored and have time on their hand, or want to take on the challenge, help me with these.
I want it so my first initial target won't show the frame and complete fix the 3 second issue.