Hi all, I'm trying to cast spells on my focus target but am not having any luck. I searched the forums and found this code but I couldnt get it to work for me. Code: public WoWUnit GetFocus { get { string name = Lua.GetReturnVal("return GetUnitName(\"" + "focus" + "\");",0); WoW 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; } } What i need is a code to return WoWPlayer as who ever my focus target is and null if i have no target so I could later call them by WoWPlayer p = GetFocus(); I appreciate any help since I've been stumped with this for quite a while now. Thanks, NightS
i don't see anything like StyxWoW.Me.FocusedUnit in references, there is only SetFocus() I'm using that: Code: private WoWUnit FocusTarget { get { return ObjectManager.GetObjectByGuid<WoWUnit>( ulong.Parse( Lua.GetReturnValues("return UnitGUID(\"focus\")")[0].Replace("0x", ""), System.Globalization.NumberStyles.HexNumber)); } } Step by step: 1. Get unit's GUID from Lua (string representing hexadecimal number), 2. Cut the "0x", 3. Convert to ulong, 4. Get object by GUID,