View Single Post
01-27-18, 05:30 PM   #4
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Wouldn't you just be able to do

lua Code:
  1. hooksecurefunc(Boss1TargetFrame, "SetPoint", function()
  2.     Boss1TargetFrame:SetPoint("TOPRIGHT",UIParent,"TOPRIGHT",-350,-470)
  3. end)

Though you might need a workaround like here, if you don't want it to just keep recursively calling itself (might make the game crash?):
https://us.battle.net/forums/en/wow/...9273821#post-5

One way to do it is to do a hooksecurefunc(ReputationWatchBar,"SetPoint",func). This will securely call func whenever anything does a ReputationWatchBar:SetPoint(). But since we want to do a SetPoint in this hook itself, we need to be careful it doesn't trigger itself indefinitely. Like this:

lua Code:
  1. hooksecurefunc(ReputationWatchBar,"SetPoint",function(self,_,_,_,_,_,flag)
  2.   if flag~="mbars" then
  3.     self:ClearAllPoints()
  4.     if level==100 then
  5.       self:SetPoint("BOTTOMLEFT",ActionButton1,"TOPLEFT",0,0,"mbars")
  6.     else
  7.       self:SetPoint("BOTTOMLEFT",MultiBarBottomLeftButton1,"TOPLEFT",0,0,"mbars")
  8.     end
  9.   end
  10. end)

Now whenever ReputationWatchBar:SetPoint() happens in the default UI (or another addon), this addon will immediately SetPoint again, passing the "mbars" flag (can be anything, something unique that only this addon knows about) so it knows not to do another SetPoint in response to this SetPoint.
This is for a different frame but I imagine it'd be the same concept.

Last edited by Ammako : 01-27-18 at 05:35 PM.
  Reply With Quote