Originally Posted by Kygo
Did try to add "and unitClass == "WARLOCK" or unitClass == "PALADIN" or unitClass == "MONK" for the classIcons and "if unit == "player" and unitClass == "DRUID" in the EclipseBar, but with the "unitClass" segments they wont load at all.
|
You need to enclose multiple class checks in parentheses, or it won't work as intended. The way you've written it will only load if you're playing a warlock, since it's the equivalent of this:
Code:
if (unit == "player" and unitClass == "WARLOCK") or (unitClass == "PALADIN") or (unitClass == "MONK") then
Writing it this way should fix it:
Code:
if unit == "player" and (unitClass == "WARLOCK" or unitClass == "PALADIN" or unitClass == "MONK") then
On a side note, based on the name you gave it, I'm guessing you're defining
unitClass inside your Spawn callback for each frame. This means that it will be
nil for most frames, since information about other units' classes may not be available yet when the frames are being created, or the unit might not exist at all yet (for example, you can't have a target while logging in). Since the player frame is the only one where you're creating some elements conditionally, you should just define a class variable once for the player unit at the top of your file and refer to that:
Code:
local _, playerClass = UnitClass("player")