Mobs aren't working! How do I add monsters?!?!?!?!?!?!?
The monster system IS NOT CODED IN THIS SOURCE. I've gotten so many msgs about this... I try to explain it and they go "so can I copy from lotf???" or something along those lines or just try to get me to add it for them.
To put it bluntly... Monsters (done correctly) can be the most complex system of your server to do right! Handling monster ai/movements/death/re spawning/drops and such is something you have to handle CAREFULLY or else you will run into all sorts of issues.
I do NOT recommend trying to use lotf's mob system... not good.
-Info on the monster system/what is loaded
The database is already set up properly... you simply need to start loading from database (it's commented out)
Code:
public static void GetSpawns()
Remove the comments.
STEP1
like this
public static void GetSpawns()
{
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
cmd.Select("MobSpawns");
uint Count = 0;
MySqlReader r = new MySqlReader(cmd);
while (r.Read())
{
MobSpawn S = new MobSpawn(r.ReadUInt32("Amount"), Dictionary.BaseMobs[r.ReadUInt32("SpawnMob")], r.ReadUInt16("X"), r.ReadUInt16("Y"), r.ReadUInt16("Spread"), r.ReadUInt16("Map"));
Count += (uint)S.Members.Count;
}
Console.WriteLine(Program.Title + " Spawning " + Count + " monsters into the world");
}
There are a number of monster variables not currently being initialized. You should fix that
STEP 2
like this
public static void GetBaseMobs()
{
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
cmd.Select("Monsters");
MySqlReader r = new MySqlReader(cmd);
int count = 0;
while (r.Read())
{
BaseMob M = new BaseMob();
M.MobID = r.ReadUInt32("UID");
M.Mesh = r.ReadUInt32("Mesh");
M.Name = r.ReadString("Name");
M.Level = r.ReadByte("Level");
M.MaxHp = r.ReadUInt32("Health");
M.VRange = r.ReadByte("ViewRange");
M.Range = r.ReadByte("AttackRange");
M.AtkType = r.ReadUInt16("AttackType");
M.MinAtk = r.ReadUInt16("MinAtk");
M.MaxAtk = r.ReadUInt16("MaxAtk");
M.Pdef = r.ReadUInt16("Pdef");
M.Mdef = r.ReadUInt16("Mdef");
M.Dodge = r.ReadByte("Dodge");
M.Accuracy = r.ReadByte("Accuracy");
M.DropLvl = r.ReadByte("DropMaxLvl");
if (!Dictionary.BaseMobs.ContainsKey(M.MobID))
Dictionary.BaseMobs.ThreadSafeAdd(M.MobID, M);
count++;
}
Console.WriteLine(Program.Title + " Loaded " + Dictionary.BaseMobs.Count + " Base Monsters from database");
}
There are a number of typos in the db/spawn code which need to be corrected.
STEP 3
i dont know what need to be corrected so can some one hep me!
then i need help in the other steps can someone help me!
thanks.