Hi, right now i have a piece of code which targets the closest mob to me but then sometimes they move or even run away when low hp and my bot just targets a new mobs which isn't the behavior i would like it to have. I really want to be able to lock onto the target and chase it to death.
Right now i have this code but it doesn't lock sadly, i'm trying to figure out how to do it for 2 days but couldn't find any smart way to do it...
var focusUnit = ObjectManager.GetNearestWoWUnit(focusMobsList);
if (focusUnit.IsValid && ObjectManager.Target.Guid != focusUnit.Guid)
{
Logging.WriteDebug(string.Format("[PriorityTarget] Focus Unit - {0} (distance: {1}).", focusUnit.Name, focusUnit.GetDistance));
if (ObjectManager.Target.IsValid) Lua.LuaDoString("ClearTarget();");
cancelable.Cancel = true;
var m = Fight.StartFight(focusUnit.Guid, false);
}
I can't find a smart way to modify my condition so it would only go inside if the previous target is dead...
If someone have an idea or a hint, i'm welcoming any ideas...!
Thanks a lot