1. #1
    Deleted

    Get the target of a Unit (Addon Development)

    First of all sorry for my English, I'm Spanish.

    Well, I'm trying to do an addon and I need to know the target of my raid members.
    I tried all things but I don't got more ideas to try.

    I want to dodge the SendAddonMessage function.

    If anyone can help me I would be very grateful.

    Thanks for all,

    Mestaco.
    Last edited by mmoc11e812e174; 2014-12-28 at 09:19 PM.

  2. #2
    Hmm not rly sure what exactly you need but here you go: GetUnitName("target")


    and the api documentation for it: http://www.wowwiki.com/API_GetUnitName

    hope it helps

  3. #3
    I'm a little rusty, but you should be able to add "target" to the end of any unit identifier to get their target and then pass that to any function.
    Code:
    GetUnitName("playertarget")
    UnitLevel("party3target")
    UnitExists("raid11target")
    etc.
    This page should help as well

  4. #4
    Deleted
    I'm asking about how I can get the name of party1's target for example.
    And with GetUnitName I can do that. I was reading and I don't find nothing.

  5. #5
    Quote Originally Posted by Mestaco View Post
    I'm asking about how I can get the name of party1's target for example.
    And with GetUnitName I can do that. I was reading and I don't find nothing.
    loop through your party?

    "party1targettarget"
    Refers to the first party member (not the player, but the first person in the player's party frames)'s target's target.

  6. #6
    Deleted
    Thanks of both. It's that I want.

    Another ask, and for an enemy member of a battleground. How I cant get his target??

    Thanks.
    Last edited by mmoc11e812e174; 2014-12-28 at 09:44 PM.

  7. #7
    Quote Originally Posted by Mestaco View Post
    Thanks of both. It's that I want.

    Another ask, and for an enemy member of a battleground. How I cant get his target??

    Thanks.
    I'd probably try to get the names of the enemy players from the battleground scoreboard, then looping through that list and checking their targets. Not sure if that works though.

  8. #8
    Deleted
    Quote Originally Posted by Neteyes View Post
    I'd probably try to get the names of the enemy players from the battleground scoreboard, then looping through that list and checking their targets. Not sure if that works though.
    Yes, but which what functions I can get the enemy target once I got the enemy name?

    Thanks again for answer

  9. #9
    Quote Originally Posted by Mestaco View Post
    Yes, but which what functions I can get the enemy target once I got the enemy name?

    Thanks again for answer
    I'm not familiar with the wow api at all, but something like this maybe (this won't be actual code)
    for x in BgEnemies
    target = GetUnitName(x .. "-target")
    AddFrame(x, target)
    end

    Something like that maybe? I don't really know the lua syntax either, but the general idea is what I'd start with doing.

  10. #10
    Using unit names as unit IDs only works for units in your group. The only way you can find out who an enemy is targeting is by having someone in your group target the enemy.

  11. #11
    Deleted
    thanks both again.
    The first problem is solved

Posting Permissions

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