local f = CreateFrame("Frame")
local inCombat = false --need own variable becuase of event timings
f:RegisterEvent("PLAYER_REGEN_DISABLED") -- entered combat
f:RegisterEvent("PLAYER_REGEN_ENABLED") -- left combat
f:SetScript("OnEvent", function(self, event, ...) -- hides/shows frames when leaving/entering combat
if event =="PLAYER_REGEN_DISABLED" then
inCombat = true
PlayerFrame:Show()
TargetFrame:Show()
TargetFrameToT:Show()
else
inCombat = false
PlayerFrame:Hide()
TargetFrame:Hide()
TargetFrameToT:Hide()
end
end)
PlayerFrame:Hide() -- hides frames when client has loaded
TargetFrame:Hide()
TargetFrameToT:Hide()
--Make sure frames stay hidden while out of combat
PlayerFrame:SetScript("OnShow",
function()
if (inCombat == false) then
PlayerFrame:Hide()
end
end)
TargetFrame:SetScript("OnShow",
function()
if (inCombat == false) then
TargetFrame:Hide()
end
end)
TargetFrameToT:SetScript("OnShow",
function()
if (inCombat == false) then
TargetFrameToT:Hide()
end
end) This will hide blizzard's player, target, and target of target frames while out of combat and show them while in combat.
use https://addon.bool.no to turn this script into an addon and put it into your WoW client folder.
Lastly, if you use custom frames from an addon (since you mentioned frames that look exactly like blizzard's), you should use the /fstack command in-game to find out their names. You can use those names in above script.
Let me know if it works, and if it's what you were looking for! :)