View Single Post
05-26-18, 12:19 PM   #2
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
This is what Blizzard uses fwiw

lua Code:
  1. function CompactUnitFrame_UpdateInRange(frame)
  2.   if ( not frame.optionTable.fadeOutOfRange ) then
  3.     return;
  4.   end
  5.  
  6.   local inRange, checkedRange = UnitInRange(frame.displayedUnit);
  7.   if ( checkedRange and not inRange ) then  --If we weren't able to check the range for some reason, we'll just treat them as in-range (for example, enemy units)
  8.     frame:SetAlpha(0.55);
  9.   else
  10.     frame:SetAlpha(1);
  11.   end
  12. end

https://www.townlong-yak.com/framexm...tFrame.lua#648

frame.background doesn't seem to be a thing here, not sure where you got that code from but it could have been from an older version of the game and raid frames may have changed since, idk.

You can always override this by doing something like this:

lua Code:
  1. hooksecurefunc("CompactUnitFrame_UpdateInRange", function(frame)
  2.   if ( not frame.optionTable.fadeOutOfRange ) then
  3.     return;
  4.   end
  5.  
  6.   local inRange, checkedRange = UnitInRange(frame.displayedUnit);
  7.   if ( checkedRange and not inRange ) then  --If we weren't able to check the range for some reason, we'll just treat them as in-range (for example, enemy units)
  8.     frame:SetAlpha(0.3);
  9.   else
  10.     frame:SetAlpha(1);
  11.   end
  12. end)
  Reply With Quote