+ Reply to Thread
Results 1 to 2 of 2

Thread: Player target changed?

  1. #1
    Soulwalker
    Join Date
    Dec 2010
    Posts
    18

    Default Player target changed?

    Hi,
    I am a bit confused regarding what the current best practice is for being notified when the player target has changed. Some threads mention LibUnitChange but this information might be old?

    Also, is the event handler guaranteed to complete before the target can change again?

    Thank you very much.

  2. #2
    Rift Disciple
    Join Date
    Sep 2013
    Posts
    131

    Default

    Quote Originally Posted by Arioc View Post
    Hi,
    I am a bit confused regarding what the current best practice is for being notified when the player target has changed. Some threads mention LibUnitChange but this information might be old?

    Also, is the event handler guaranteed to complete before the target can change again?

    Thank you very much.
    LibUnitChange is, afaik, the best way to go about being notified of any unit changes. My addon is notified of target and target of target changes through:

    Command.Event.Attach(Library.LibUnitChange.Registe r("player.target"), CCD.OnUnitChanged, "OnTargetChanged")
    Command.Event.Attach(Library.LibUnitChange.Registe r("player.target.target"), CCD.OnUnitChanged, "OnTargetOfTargetChanged")

    Handler:

    function CCD.OnUnitChanged(Handle, UnitId)
    -- UnitId is the ID of the new target/target of target or nil if no target/target of target exists
    end

    Your second question may not be technically correct but yes you can assume the target won't change until the next event fires.

    I'm by no means expert on Rift's API but hopefully that pushes you in the right direction.
    Last edited by Pancakedrawer; 11-03-2015 at 05:45 PM.

+ Reply to Thread

Bookmarks

Posting Permissions

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