EntityMove doesn't exist.
This is what 5165 has:
Code:
public static COPacket Movement(uint UID, byte Dir)
{
byte[] Packet = new byte[8 + 16];
COPacket P = new COPacket(Packet);
P.WriteInt16((ushort)(Packet.Length - 8));
P.WriteInt16((ushort)10005);
P.WriteInt32((byte)(Dir + 8 * Program.Rnd.Next(7)));
P.WriteInt32(UID);
P.WriteInt32((uint)Environment.TickCount);
return P;
}
This is the mob movement problem...
It's highlighted in red
Code:
#region Player Target
if (PlayerTarget != null && (PlayerTarget.CanBeMeleed || AtkType != AttackType.Melee) && PlayerTarget.Alive && PlayerTarget.MyClient != null && MyMath.PointDistance(Loc.X, Loc.Y, PlayerTarget.Loc.X, PlayerTarget.Loc.Y) < Math.Max(15, (int)AttackDist) && (Type != MobBehaveour.HuntMobsAndBlue || PlayerTarget.BlueName))
{
if (MyMath.PointDistance(Loc.X, Loc.Y, PlayerTarget.Loc.X, PlayerTarget.Loc.Y) >= AttackDist)
{
byte ToDir = (byte)(7 - (Math.Floor(MyMath.PointDirecton(Loc.X, Loc.Y, PlayerTarget.Loc.X, PlayerTarget.Loc.Y) / 45 % 8)) - 1 % 8);
Direction = (byte)((int)ToDir % 8);
Location eLoc = Loc;
eLoc.Walk(Direction);
System.Collections.Hashtable H = (System.Collections.Hashtable)World.H_Mobs[Loc.Map];
bool PlaceFree = true;
if (DMaps.Loaded)
{
if (((DMap)DMaps.H_DMaps[Loc.Map]).GetCell(eLoc.X, eLoc.Y).NoAccess) PlaceFree = false;
}
foreach (Mob M in H.Values)
if (M != this && M.Loc.X == eLoc.X && M.Loc.Y == eLoc.Y && M.Alive)
{
PlaceFree = false;
break;
}
if (PlaceFree)
{
World.Action(this, Packets.Movement(EntityID, Direction).Get);
World.Spawn(this, true);
Loc.Walk(Direction);
}
else
{
for (int i = 0; i < 7; i++)
{
PlaceFree = true;
eLoc = Loc;
Direction = (byte)((Direction + 1) % 8);
eLoc.Walk(Direction);
if (DMaps.Loaded)
if (((DMap)DMaps.H_DMaps[Loc.Map]).GetCell(eLoc.X, eLoc.Y).NoAccess) PlaceFree = false;
foreach (Mob M in H.Values)
if (M != this && M.Loc.X == eLoc.X && M.Loc.Y == eLoc.Y && M.Alive)
{
PlaceFree = false;
break;
}
[COLOR="Red"]if (PlaceFree)
{
World.Action(this, Packets.Movement(EntityID, Direction).Get);
World.Spawn(this, true);
Loc.Walk(Direction);
break;
}[/COLOR]
}
}
}
else
{
if (MyMath.ChanceSuccess(15) || Type == MobBehaveour.HuntMobsAndBlue)
PlayerTarget.TakeAttack(this, PrepareAttack(), AtkType);
else
PlayerTarget.TakeAttack(this, 0, AtkType);
}
}
else PlayerTarget = null;
#endregion
that's how they move.
If you double the code, the mob will walk twice in a row.
I'm still working on it running.
EDIT:
It's also here:
Code:
if (Alive && DateTime.Now > LastMove.AddMilliseconds(1000))
{
LastMove = DateTime.Now;
if ((Type == MobBehaveour.HuntPlayers || Type == MobBehaveour.HuntMobsAndBlue) && PlayerTarget == null && MobTarget == null)
{
byte NDist = 10; // Distance they can see you by
byte MaxDist = 10;
foreach (Character C in World.H_Chars.Values)
{
if (C.Loc.Map == Loc.Map)
{
if (C.Alive)
{
if (C.CanBeMeleed || AtkType != AttackType.Melee)
{
byte Dst = (byte)MyMath.PointDistance(Loc.X, Loc.Y, C.Loc.X, C.Loc.Y);
if (Dst <= MaxDist && Dst < NDist)
{
if (Type != MobBehaveour.HuntMobsAndBlue || C.BlueName)
{
NDist = (byte)MyMath.PointDistance(Loc.X, Loc.Y, C.Loc.X, C.Loc.Y);
PlayerTarget = C;
}
}
}
}
}
}
}