What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Focus Target

pcxnet

New Member
Joined
Jun 20, 2011
Messages
9
Reaction score
0
Sorry, focus isn't the easiest keyword to search for.

Is it possible to implement the ability to get information on the players focus. (Not focus as in hunter energy, but as in their /focus)

Useful information would be the same as what you can get for Target

Distance etc.

That would be great

Thanks
 
you can always lookup the focus target by guid, and pass it to a WoWUnit, and just refrence the wowunit, and do it all internally.
 
Thats what I was thinking, just tested focusinfo and that wasn't it. How would he go about getting the guid of the focus target? Doing a lua.dostring? and getting the return value?
 
Thats what I was thinking, just tested focusinfo and that wasn't it. How would he go about getting the guid of the focus target? Doing a lua.dostring? and getting the return value?
well you gotta target the thing before you set it as your focaus target, so just pull it then.
 
I guess if your going todo it this way, there isnt really any reason to set it as your focus, just store the wowunit.
 
I"m looking for it more for a plugin that wont be fully automated, so the bot wont necessarily be doing the targeting.. Having the ability to get details about focus would be handy.
 
Is this the right forum for this or is there a better spot for suggestions ?
 
Solved this using a combination of HB and LUA.

Code:
List<string> abc = Lua.GetReturnValues("return UnitGUID(\"focus\")");

WoWUnit focus = null;

ulong guid = ulong.Parse(abc[0].Substring(2),System.Globalization.NumberStyles.AllowHexSpecifier);
					 
focus = ObjectManager.GetObjectsOfType<WoWUnit>().FirstOrDefault(unit => unit.Guid == guid);
 
Last edited:
how i did it, includes check if there aint any focus at all:
PHP:
public WoWUnit GetFocus
        {
            get
            {
                string name = Lua.GetReturnVal("return GetUnitName(\"" + "focus" + "\");",0);
                var units = ObjectManager.GetObjectsOfType(true, true).First((unit) => unit.Name == name && name != null && name != string.Empty && name.ToLower() != "nil");
                if (units != null)
                {
                    return units;
                }
                return null;
            }
        }
 
how i did it, includes check if there aint any focus at all:
PHP:
public WoWUnit GetFocus
        {
            get
            {
                string name = Lua.GetReturnVal("return GetUnitName(\"" + "focus" + "\");",0);
                var units = ObjectManager.GetObjectsOfType(true, true).First((unit) => unit.Name == name && name != null && name != string.Empty && name.ToLower() != "nil");
                if (units != null)
                {
                    return units;
                }
                return null;
            }
        }

you should not use <code><code>GetUnitName because if you have targets with the same name it can get pretty messy ^^</code></code> use the guid.
 
Back
Top