hi, i have a problem with entities.cs when i start my server it loads everyting almost all mobs i have but when he is on SpawnALLMobs it give an error at line:217
error=System.NullReferenceException: Object reference not set to an instance of an object.
line:218 is DataBase.Mobs = null;
now you know where to look just above line:218
this is what i have:
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))
{
UID = (uint)General.Rand.Next(400000, 500000);
}
SingleMob Mob = new SingleMob(spawn_x, spawn_y, Convert.ToInt16(ThisSpawn[7]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[3]), short.Parse(ThisMob[6]), short.Parse(ThisMob[7]), UID, ThisMob[2], int.Parse(ThisMob[1]), short.Parse(ThisMob[4]), (byte)General.Rand.Next(8), byte.Parse(ThisMob[5]));
AllMobs.Add(UID, Mob);
MobsSpawned++; ;
}
}
DataBase.Mobs = null;
DataBase.MobSpawns = null;
General.WriteLine("Spawned " + MobsSpawned + " mobs.");
}
catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }
}
}
i know its my first post but this is my first problem :-p