Assuming you are using the default party frames:
OnLoad
Code:
-- Change this value for each frame to match the party unit ID:
self.id = 1
-- Don't need to edit below here.
self:RegisterEvent("PLAYER_TARGET_CHANGED")
self.unit = "party"..self.id
self.frame = _G["PartyFrame"..self.id]
self.frame:HookScript("OnEnter", function()
self:Show()
end)
self.frame:HookScript("OnLeave", function()
if not UnitIsUnit("target", self.unit) then
self:Hide()
end
end)
OnEvent
Code:
self:SetShown(self:IsMouseOver() or UnitIsUnit("target", self.unit))