I added in some new mobs to the database, added spawns, but nothing is spawning. Am I missing something?
public static void SpawnAllMobs()
{
try
{
int MobsSpawned = 0;
int MobSpawnsToSpawn = DataBase.MobSpawns.Length;
for (int j = 0; j < MobSpawnsToSpawn; j++)
{
uint[] ThisSpawn = DataBase.MobSpawns[j];
string[] ThisMob = null;
foreach (string[] FindId in DataBase.Mobs)
{
if (FindId[0] == Convert.ToString(ThisSpawn[1]))
{
ThisMob = FindId;
}
}
for (int n = 0; n < Convert.ToInt32(ThisSpawn[2]); n++)
{
uint UID = (uint)General.Rand.Next(400000, 500000);
short spawn_x = (short)General.Rand.Next(Convert.ToInt16(ThisSpawn[3]), Convert.ToInt16(ThisSpawn[5]));
short spawn_y = (short)General.Rand.Next(Convert.ToInt16(ThisSpawn[4]), Convert.ToInt16(ThisSpawn[6]));
while (AllMobs.Contains(UID))
{
//DataBase.MobSpawns = null;
UID = (uint)General.Rand.Next(400000, 500000);
}
SingleMob Mob = new SingleMob((short)spawn_x, (short)spawn_y, Convert.ToInt16(ThisSpawn[7]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[6]), uint.Parse(ThisMob[7]), (uint)UID, ThisMob[2], int.Parse(ThisMob[1]), short.Parse(ThisMob[4]), (byte)General.Rand.Next(8), byte.Parse(ThisMob[5]), 0, true);
AllMobs.Add(UID, Mob);
MobsSpawned++;
}
}
DataBase.Mobs = null;
DataBase.MobSpawns = null;
General.WriteLine(" - Spawned " + MobsSpawned + " mobs.");
}
catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }
}
if (Splitter[0] == "@addspawn") // adds a spawn to your server (exa. @addspawn 502 2 2 )
{
uint MobID = uint.Parse(Splitter[1]);
ushort Area = byte.Parse(Splitter[2]);
ushort Amount = ushort.Parse(Splitter[3]);
DataBase.NewSpawn(MyChar.LocMap, (ushort)(MyChar.LocX - Area), (ushort)(MyChar.LocY + Area), (ushort)(MyChar.LocX + Area), (ushort)(MyChar.LocY - Area), Amount, MobID);
}
public static bool NewSpawn(ushort Map, ushort XStart, ushort YStart, ushort XEnd, ushort YEnd, ushort SpawnNr, uint MobID)
{
try
{
MySqlCommand Command = new MySqlCommand("INSERT INTO mobspawns (SpawnWhatID,SpawnNr,XStart,YStart,XEnd,YEnd,Map) VALUES (" + MobID + "," + SpawnNr + "," + XStart + "," + YStart + "," + XEnd + "," + YEnd + "," + Map + ")", Connection);
Command.ExecuteNonQuery();
return true;
}
catch { return false; }
}
line 212 MIninum Value is Same as Maximum Value , look closelyQuote:
I don't see anything wrong.
Code:public static void SpawnAllMobs() { try { int MobsSpawned = 0; int MobSpawnsToSpawn = DataBase.MobSpawns.Length; for (int j = 0; j < MobSpawnsToSpawn; j++) { uint[] ThisSpawn = DataBase.MobSpawns[j]; string[] ThisMob = null; foreach (string[] FindId in DataBase.Mobs) { if (FindId[0] == Convert.ToString(ThisSpawn[1])) { ThisMob = FindId; } } for (int n = 0; n < Convert.ToInt32(ThisSpawn[2]); n++) { uint UID = (uint)General.Rand.Next(400000, 500000); short spawn_x = (short)General.Rand.Next(Convert.ToInt16(ThisSpawn[3]), Convert.ToInt16(ThisSpawn[5])); short spawn_y = (short)General.Rand.Next(Convert.ToInt16(ThisSpawn[4]), Convert.ToInt16(ThisSpawn[6])); while (AllMobs.Contains(UID)) { //DataBase.MobSpawns = null; UID = (uint)General.Rand.Next(400000, 500000); } SingleMob Mob = new SingleMob((short)spawn_x, (short)spawn_y, Convert.ToInt16(ThisSpawn[7]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[6]), uint.Parse(ThisMob[7]), (uint)UID, ThisMob[2], int.Parse(ThisMob[1]), short.Parse(ThisMob[4]), (byte)General.Rand.Next(8), byte.Parse(ThisMob[5]), 0, true); AllMobs.Add(UID, Mob); MobsSpawned++; } } DataBase.Mobs = null; DataBase.MobSpawns = null; General.WriteLine(" - Spawned " + MobsSpawned + " mobs."); } catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); } }
lol i said i think thats it , not sure if it is in your databaseQuote:
Hrm. That doesn't seem to be working either.
The spawn I added, "/addspawn 502 2 2" shows up in the mobspawns database, but nothing spawns.