View Single Post
01-10-21, 09:09 PM   #4
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
Lua Code:
  1. local f=CreateFrame("frame")
  2. f:RegisterEvent("GROUP_ROSTER_UPDATE")
  3. f:SetScript("OnEvent",function()
  4.     if UnitName("party3") then
  5.         eBar_bar_4:SetAlpha(0)
  6.         eBar_bar_5:SetAlpha(0)
  7.         eBar_bar_6:SetAlpha(0)
  8.         eBar_bar_7:SetAlpha(0)
  9.         LoseControlparty1:SetAlpha(0)
  10.         LoseControlparty2:SetAlpha(0)
  11.     else
  12.         eBar_bar_4:SetAlpha(1)
  13.         eBar_bar_5:SetAlpha(1)
  14.         eBar_bar_6:SetAlpha(1)
  15.         eBar_bar_7:SetAlpha(1)
  16.         LoseControlparty1:SetAlpha(1)
  17.         LoseControlparty2:SetAlpha(1)
  18.     end
  19. end

Assuming you made the addon correctly, that code by itself only runs once when the UI loads. You need to have it run every time your group changes, so you create a frame, register it for the group change event, and then set the code to run with the OnEvent frame script. If you are unsure if you made the addon correctly, you can go to https://addon.bool.no to easily make it with this code.

Also, "GetPartyMember" doesn't exist, not sure where you got that, so we'll use UnitName here to check if party3 exists. Keep in mind that in a party, not a raid, a full group of players will be you with the unit "player", then the other four members as "party1", "party2", "party3", and "party4". This code is checking if the party has a fourth member. In a raid, "player" still exists, but you will also have a "raid#" unit with no guarantee which number.