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

Automatically target mob

stirling2155

New Member
Joined
Oct 3, 2015
Messages
22
Reaction score
0
I can't seem to find a way to code it so that when I use something such as a variation of ArcheGrinder, it will automatically target the mobs. I have the code to use combos and go to the mob to loot, but not to auto target the mob. I have to do that manually. Any tips?
 

would that be under this?
Code:
private void startCombat()
    {
        new Task(() => this.CancelAttacksOnAnothersMobs()).Start();
        this.LBLStatus.Text = "LazyGrinder is Running...";
        while (GetGroupStatus("LazyGrinder"))
        {
            if (GetGroupStatus("LazyGrinder") && me.isAlive())
            {
                Creature bestNearestMob = null;
                bestNearestMob = this.GetBestNearestMob(this.zone);
                if ((bestNearestMob != null) && (bestNearestMob.name != "Eagle"))
                {
                    try
                    {
                        while ((((bestNearestMob != null) && isAlive(bestNearestMob)) && (isExists(bestNearestMob) && GetGroupStatus("LazyGrinder"))) && isAlive())
                        {
                            if (hpp(me) <= 25 && Vfood != "Food" && itemCooldown(Vfood) == 0 && me.target == null)
                            {
                                UseItem(Vfood);
                                Thread.Sleep(5000);
                            }
                            if (mpp(me) <= 25 && Vdrink != "Drink" && itemCooldown(Vdrink) == 0 && me.target == null)
                            {
                                UseItem(Vdrink);
                            }
                            if (((bestNearestMob.aggroTarget != me) && (bestNearestMob.firstHitter != null)) && (bestNearestMob.firstHitter != me))
                            {
                                bestNearestMob = null;
                                break;
                            }
                            if (((bestNearestMob.firstHitter == null) && (getAggroMobs().Count > 0)) && (bestNearestMob != this.GetBestNearestMob(this.zone)))
                            {
                                bestNearestMob = this.GetBestNearestMob(this.zone);
                            }
                            if (me.target != bestNearestMob)
                            {
                                SetTarget(bestNearestMob);
                            }
                            //if (hpp(me) <= 30 && Vfood != "Food" && itemCooldown(Vfood) == 0)
                            //{
                            //    UseItem(Vfood);
                            //}
                            if (hpp(me) <= 30 && Vhealthp != "Health Potion" && itemCooldown(Vhealthp) == 0)
                            {
                                UseItem(Vhealthp);
                            }
                            if (mpp(me) <= 30 && Vmanap != "Mana Potion" && itemCooldown(Vmanap) == 0)
                            {
                                UseItem(Vmanap);
                            }
                            //if (mpp(me) <= 25 && Vdrink != "Drink" && itemCooldown(Vdrink) == 0)
                            //{
                            //    UseItem(Vdrink);
                            //}
                            if ((angle(bestNearestMob, me) > 0x2d) && (angle(bestNearestMob, me) < 0x13b))
                            {
                                TurnDirectly(bestNearestMob);
                            }
                            Thread.Sleep(10);
                        }
                        while (((((bestNearestMob != null) && !base.isAlive(bestNearestMob)) && (base.isExists(bestNearestMob) && (bestNearestMob.type == BotTypes.Npc))) && (((Npc)bestNearestMob).dropAvailable && base.GetGroupStatus("LazyGrinder"))) && base.isAlive())
                        {
                            if (base.me.dist(bestNearestMob) > 3.0)
                            {
                                base.ComeTo(bestNearestMob, 1.0, 1.5);
                            }
                            base.PickupAllDrop(bestNearestMob);
                        }
                    }
                    catch
                    {
                    }
                }
            }
            Thread.Sleep(10);
        }

Sorry, I'm new to C# and I'm just trying to learn. I figure that learning the basics + how these scripts are running off of each other will help.
 
Code:
private Creature findMob() // our mob finding function
{
	Creature choice = getCreatures().First(); // First Mob in the list of all creatures (stops us from getting a null reference later on)
	foreach (Creature mob in getCreatures()) // All Mobs in current view
	{
		if (mob.aggroTarget == null // if the mob has no target
		&& mob.isAlive() // if the mob is alive
		&& hpp(mob) == 100) // and if it has 100% HP do
		{
			if (me.dist(mob) < me.dist(choice)) // if the distance to this mob is shorter than the last one we checked do
			{
				choice = mob; // set the new choice to the current mob in the list
			}
		}
	}
	return choice; // send it back to where-ever we called from
}

private SomeOtherFunctionWhereYouWantAMob()
{
	me.SetTarget(findMob()); // set your target to the closest mob that is alive, has no target, and 100% hp
}

That's off the top of my head, and is untested.
 
Code:
private Creature findMob() // our mob finding function
{
	Creature choice = getCreatures().First(); // First Mob in the list of all creatures (stops us from getting a null reference later on)
	foreach (Creature mob in getCreatures()) // All Mobs in current view
	{
		if (mob.aggroTarget == null // if the mob has no target
		&& mob.isAlive() // if the mob is alive
		&& hpp(mob) == 100) // and if it has 100% HP do
		{
			if (me.dist(mob) < me.dist(choice)) // if the distance to this mob is shorter than the last one we checked do
			{
				choice = mob; // set the new choice to the current mob in the list
			}
		}
	}
	return choice; // send it back to where-ever we called from
}

private SomeOtherFunctionWhereYouWantAMob()
{
	me.SetTarget(findMob()); // set your target to the closest mob that is alive, has no target, and 100% hp
}

That's off the top of my head, and is untested.
Couldn't get it to work. one of my issues is that ArcheGrinder is not functioning properly and won't attack new mobs after about 1-2. I also can't get it to attempt to read a death route. I'm not sure if it's the file locations or what.
 
Couldn't get it to work. one of my issues is that ArcheGrinder is not functioning properly and won't attack new mobs after about 1-2. I also can't get it to attempt to read a death route. I'm not sure if it's the file locations or what.

ArcheGrinder works great and normally for me aside from Potions.
 
Back
Top