1. #1
    Deleted

    [FIXED] Very strange Event action. Need help.

    For some reason the following event does the opposite of what it says:

    if event == "PLAYER_TARGET_CHANGED" then
    if SUFUnittarget:IsVisible() then
    self:SetAlpha(1)
    else
    self:SetAlpha(0)
    end
    end

    I want a frame to show if SUFUnittarget:IsVisible however instead it hides and then shows when the unit frame is not visible which does not make any sense to me.

    I have to swap around the self:SetAlpha lines around in the wrong place to get it to work.
    How is this possible?

    Edit: I found out why but I want it to not appear when I have no target and appear when I select a target however it only works for changing the target. I cannot find an event for just selecting a target though. I do not want to parent/anchor the frame to it since I need to use a script for it to change and apply to the focus frame at some point.

    ---------- Post added 2012-09-20 at 12:27 PM ----------

    Never mind, I have fixed the issue
    Last edited by mmoc2c0e080e79; 2012-09-20 at 11:41 AM.

  2. #2
    Deleted
    There is a bug with that event. It does not fire on all occasions...

    I had it when applying a targeting sound to my target frame. The event does not fire correctly all the time. I circumvented it by hooking the Show event of my target health frame. If that became visible I ran the script. My code for this is:
    Code:
        --sound
        self:RegisterEvent("PLAYER_TARGET_CHANGED", playTargetSound)
        self.Health:SetScript("OnShow",function(s)
          playTargetSound(self,"PLAYER_TARGET_CHANGED")
        end)

    You can do UnitExists("target") for unit checking aswell.

    --------------------------

    Sidenote on editing:

    Do not just write you fixed it. Write down how! If others find your post via Google they will find no solution to an already solved problem. Which is bad.
    Last edited by mmoc48efa32b91; 2012-09-20 at 01:43 PM.

  3. #3
    Deleted
    It's also possible that your event handler fires before SUF's does - meaning SUFUnittarget is not yet shown when your handler fires. I'd propose hooking OnShow/OnHide as suggested above.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •