Jump to content

How to lock onto a target when mobs are running away


Recommended Posts

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 

Link to comment
Share on other sites

Hello, you can try (it's not recommended to use this code, it can add bugs) :

wManager.Events.FightEvents.OnFightEnd += delegate(Int128 guid)
{
    var o = ObjectManager.GetObjectByGuid(guid);
    if (o != null && 
        o.IsValid && 
        o.Type == WoWObjectType.Unit && 
        // o.Entry == 1234 &&  // By Entry ID ?????
        new WoWUnit(o.GetBaseAddress).IsAlive)
    {
        Fight.StartFight(guid, false);
    }
};

 

Link to comment
Share on other sites

I think it is working however, it sometimes Blacklist some mobs from the pack during 60sec i have no idea why, i'll try to look around what's the reason for the bot to blacklist a mob which is right next to meand shooting me.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...