View Single Post
01-10-21, 09:34 PM   #5
Shabblahabbla
A Murloc Raider
Join Date: Jan 2021
Posts: 5
Originally Posted by Kanegasi View Post
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.
Hey thank you!
That looks good, Im starting to understand more. But it still doesnt set those frames ingame to alpha 0.
Im starting to wonder if just having those lines after "then" with the bars/frames name (taken from /framestack) is not enough or is not the same. Since I can do /run eBar_bar_4:SetAlpha(0) in game and it works there.
And if it is the same thing as /run then Im missing something even more basic. Also if its not the same thing then I wonder how I can make the addon so that it do the /run lines on each frame for me without me typing it in a macro each time party3 exists and then alpha 1 lines when party3 does not exists.
Even if this is clunkier and ugly. I do not care, im just about the practicality of make it work, means to an end.
Thank you anyway!