View Single Post
  #2  
Unread 11-07-2013, 12:08 PM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 340
There is an undocumented method of the Actor object, :GetTarget() which will return an Actor object for the specified Actor's current target. Note, as soon as the current target is out of range or the original Actor changes targets, the returned object is destroyed and will become nil so be sure to grab whatever information you plan to display into variables immediately.
There is also an undocumented event, TargetChanged() for which you can implement a handler to update the target info.

To get the name of the player's target, you would use:
Code:
localPlayer=Turbine.Gameplay.LocalPlayer.GetInstance();
playerTargetName="";
localPlayer.TargetChanged=function()
    local target=localPlayer:GetTarget()
    if target~=nil then
        playerTargetName=target:GetName()
    else
        playerTargetName=""
    end
end
Since these are undocumented, they are subject to changes without notice, but they still work in the live client at this time. Ideally you should use the AddCallback mechanism for the event handler and then remove it when your plugin unloads with RemoveCallback as show in EventHandling post of the thread
https://www.lotro.com/forums/showthr...gins-for-Noobs
Reply With Quote