Note: if you cannot find part of what I have you search for, you are probably using a suckier and much more out-of-date source... or you are using a newer "better" source like Future\Reloaded.. My original source was ShadowCo, though it is much more updated now, and I suggest starting with this. It is very stable, and once you get used to it, easy to navigate.
First go into your Entities.cs file and find
Code:
public void TimerElapsed(object source, ElapsedEventArgs e)
{
Code:
if (Target != null)
Move();
Here in this release\guide I would like to note: this is not the best way to do this, I split it up and made it longer and less efficient to make it simpler for idiots to do. Now we continue:
replace the afformentioned code with:
Code:
if (Target != null)
{
Move();
}
else if (MType == 1)
{
Tgt = Other.MobNearest((uint)PosX, (uint)PosY, (uint)Map);
if (Tgt != null && Tgt.Alive == true && Tgt.MType != 1 && MyMath.PointDistance(PosX, PosY, Tgt.PosX, Tgt.PosY) <= 10)
Move2();
}
Code:
public class SingleMob
{
public short PosX;
public short PosY;
Code:
Character Target = null;
Code:
Character Target = null;
SingleMob Tgt = null;
and add this function
Code:
public void Move2()
{
LastMove = DateTime.Now;
int DMG = General.Rand.Next(Convert.ToInt32(MinAtk), Convert.ToInt32(MaxAtk));
if (DMG < 1)
DMG = 1;
DMG *= 5;
Tgt.GetDamage((uint)DMG);
foreach (DictionaryEntry DE in World.AllChars)
{
Character Charr = (Character)DE.Value;
if (Charr.MyClient.Online)
if (MyMath.CanSeeBig(PosX, PosY, Charr.LocX, Charr.LocY))
{
Charr.MyClient.SendPacket(General.MyPackets.MobSkillUse2(this, Tgt, (uint)DMG, 1320, 2));
}
}
Tgt = null;
}
Next, go to Packets.cs and find
Code:
public byte[] MobSkillUse(SingleMob Mob, Character Attacked, uint DMG, ushort SkillId, byte SkillLevel)
{
Code:
public byte[] MobSkillUse2(SingleMob Mob, SingleMob Attacked, uint DMG, ushort SkillId, byte SkillLevel)
{
ushort PacketType = 1105;
byte[] Packet = new byte[32];
fixed (byte* p = Packet)
{
*((ushort*)p) = (ushort)Packet.Length;
*((ushort*)(p + 2)) = (ushort)PacketType;
*((uint*)(p + 4)) = (uint)Mob.UID;
*((ushort*)(p + 8)) = (ushort)Attacked.PosX;
*((ushort*)(p + 10)) = (ushort)Attacked.PosY;
*((ushort*)(p + 12)) = (ushort)SkillId;
*((ushort*)(p + 14)) = (ushort)SkillLevel;
*(p + 16) = 1;
*((uint*)(p + 20)) = (uint)Attacked.UID;
*((uint*)(p + 24)) = (uint)DMG;
}
return Packet;
}
Code:
public static Character CharNearest(uint X, uint Y, uint Map, bool Blue)
{
add:
Code:
public static SingleMob MobNearest(uint X, uint Y, uint Map)
{
try
{
int ShortestDist = 30;
SingleMob NearestMob = null;
foreach (DictionaryEntry DE in Mobs.AllMobs)
{
SingleMob MOB = (SingleMob)DE.Value;
if (MyMath.PointDistance(X, Y, MOB.PosX, MOB.PosY) < ShortestDist && MOB.MType != 1 && MOB.Alive && MOB.Map == Map)
{
NearestMob = MOB;
ShortestDist = MyMath.PointDistance(X, Y, MOB.PosX, MOB.PosY);
}
}
return NearestMob;
}
catch (Exception Exc) { General.WriteLine(Exc.ToString()); return null; }
}
And that's it! Recompile and restart your server and attract some Mobs to your gaurd!
optional: if you add a value to SingleMob.GetDamage() for enabling\disabling drops you can make guard-killed Mobs not drop items.
P.S:
at the end of your public bool GetDamage(uint Damage) { block for your single mobs you may want to change
Code:
return true;
Code:
this.Death = DateTime.Now;
World.MobDissappear(this);
return true;






