Target lowest health enemy menu

Shout-Out

User Tag List

Results 1 to 4 of 4
  1. #1
    Nov17's Avatar Sergeant Major CoreCoins Purchaser
    Reputation
    9
    Join Date
    Aug 2011
    Posts
    161
    Thanks G/R
    6/0
    Trade Feedback
    2 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Target lowest health enemy

    I am looking to create an addon or a macro, that will target the lowest health enemy within range, and then bind it to tab.

    I am planning on using the following API call: UnitHealth(unit)

    Now what I am missing, and what I am asking is if I can create an array of the players within range, check their health, and return the player with the lowest health.

    Any suggestion/ideas/help?

    Target lowest health enemy
  2. #2
    Veritable's Avatar OwnedCore News Correspondent
    Reputation
    326
    Join Date
    Apr 2007
    Posts
    369
    Thanks G/R
    52/123
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are going to want to use UnitInRange() function like so:

    inRange = UnitInRange("unit") or UnitInRange("name")

    For a raid entry, you could do something like on the following page which will show you how to use the function: GetRaidRosterInfo - World of Warcraft Programming: A Guide and Reference for Creating WoW Addons

    I am not 100% on the syntax for WoW, but the principle behind it (using some of the things on that page) would be something like:

    Code:
    var rosterInRange[] = null;
    for( i = 1; i < GetNumGroupMembers(); i++) {
      if( UnitInRange(GetRaidRosterInfo(i).name ) {
        // Unit is in range, add them to an array for parsing afterwards
        rosterInRange.Add(GetRaidRosterInfo[i]);
      }
    }
    You can either choose to call some sort of GetPlayerInfo() if it exists by the name given by GetRaidRosterInfo[i].name and get their health value and assign it to an array key'd by the raidID for later. So you could actually just flat out compare the values of health, sort the array from highest to lowest, and then prioritize a spell that way. Because the key would be the raid members ID, it would already know which one to target.

  3. Thanks Nov17, Parog (2 members gave Thanks to Veritable for this useful post)
  4. #3
    Owneth's Avatar Active Member
    Reputation
    56
    Join Date
    Feb 2011
    Posts
    362
    Thanks G/R
    6/22
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  5. #4
    Nov17's Avatar Sergeant Major CoreCoins Purchaser
    Reputation
    9
    Join Date
    Aug 2011
    Posts
    161
    Thanks G/R
    6/0
    Trade Feedback
    2 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you mean protected calls, isn't that what LUA unlockers are for?

Similar Threads

  1. [PvP] [Druid] Optimize the way how you CC your enemys and targetting your mates
    By Classicclean in forum World of Warcraft Guides
    Replies: 6
    Last Post: 02-10-2011, 03:08 PM
  2. Target Lowest HP In Party?
    By abysskeq in forum WoW Bots Questions & Requests
    Replies: 3
    Last Post: 10-25-2010, 01:00 PM
  3. Increase "Target neares enemy" range
    By Fitch2k in forum World of Warcraft General
    Replies: 4
    Last Post: 11-03-2007, 03:27 AM
  4. target your enemys before arena starts
    By zeryudo in forum World of Warcraft Exploits
    Replies: 20
    Last Post: 10-14-2007, 06:20 PM
All times are GMT -5. The time now is 03:38 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search