Hello!
Starting to learn c# and for the life of me can't figure out how to get a cavebot to jump loops. I made a "Friendly" mode so it only attacks blacksquared mobs, but I wan't there to be an option to cancel that aswell.
Heres my code:
Code:
foreach (Creature c in new Battlelist().GetCreatures())
{
if (chkFriendly.Checked && c.HasAttackedMeRecently(2000))
{
if (c.Type == (byte)Constants.Type.CREATURE)
{
if (c.Z == player.Z)
{
int x = Math.Abs(player.X - c.X);
int y = Math.Abs(player.Y - c.Y);
int rng = Int32.Parse(txtRange.Text);
if (x <= rng && y <= rng)
{
if (target == null) target = c;
if (c.Location.DistanceTo(target.Location) < player.Location.DistanceTo(target.Location))
{
if (x == 1 && y == 1)
{
target = c;
}
else
{
target = c;
}
}
}
}
}
}
}
if (target != null)
{
//int x = Math.Abs(player.X - target.X);
//int y = Math.Abs(player.Y - target.Y);
fromX = target.X - player.X;
fromY = target.Y - player.Y;
fromX *= tileX;
fromY *= tileY;
int pX = (p2.X - p1.X) / 2 + p1.X; //865
int pY = (p2.Y - p1.Y) / 2 + p1.Y; // 425
fromX += pX;
fromY += pY;
foundTarget = true;
}
if (foundTarget)
{
Attack();
Thread.Sleep(500);
continue;
}
//if not walk
if (chkwalker.Checked) Walker();
}
Now, my question is. I want to add an checkbox like chkAggressive and if thats checked, then to jump over the "if chkFriendly"