Full Version : Server crash when XMLRespawnAll
xmlspawner >>Troubleshooting >>Server crash when XMLRespawnAll
<< Prev | Next >>
Galfaroth- 02-11-2006
Server crash when XMLRespawnAll:

CODE
Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Server.Mobiles.XmlSpawner.RespawnSpawners(CommandEventArgs e, Boolean RespawnAll) in c:\FTP\Server\Scripts\WOG\NPC\XMLSpawner\XmlSpawner2.cs:line 6630
at Server.Mobiles.XmlSpawner.RespawnAll_OnCommand(CommandEventArgs e) in c:\FTP\Server\Scripts\WOG\NPC\XMLSpawner\XmlSpawner2.cs:line 6589
at Server.Commands.Handle(Mobile from, String text)
at Server.Mobile.DoSpeech(String text, Int32[] keywords, MessageType type, Int32 hue)
at Server.Network.PacketHandlers.UnicodeSpeech(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)

ArteGordon- 02-11-2006
I'm guessing that you have a spawner will a null name and it is this line around 6630 in xmlspawner2.cs that is causing the problem. Just add the code in red to fix this

QUOTE
// Check if there is a respawn condition if ((SpawnerPrefix == null) || (SpawnerPrefix.Length == 0) || (i.Name != null && i.Name.StartsWith(SpawnerPrefix)))

updated the beta_308.zip file with the fix as well in the updates and releases thread
http://xmlspawner.15.forumer.com/index.php?showtopic=53
Galfaroth- 02-11-2006
Still nothin... Maybe point me how to find this spawner and remove/change it. Or repair it by another way.
ArteGordon- 02-11-2006
can you go into your xmlspawner2.cs file and locate line 6630 and post it.
Galfaroth- 02-11-2006
Of course:

CODE
6630: { if( ( i is XmlSpawner ) && ( RespawnAll == true || i.Map == e.Mobile.Map ) && ( i.Deleted == false ) ) { // Check if there is a respawn condition if ((SpawnerPrefix == null) || (SpawnerPrefix.Length == 0) || (i.Name != null && i.Name.StartsWith(SpawnerPrefix)))
{
ToRespawn.Add( i );
Count++;
}
}
}

ArteGordon- 02-11-2006
exactly which line is 6630 on your system.
Galfaroth- 02-11-2006

CODE
6630: { 6631: if( ( i is XmlSpawner ) && ( RespawnAll == true || i.Map == e.Mobile.Map ) && ( i.Deleted == false ) ) 6632: { 6633: // Check if there is a respawn condition 6634: if ((SpawnerPrefix == null) || (SpawnerPrefix.Length == 0) || (i.Name != null && i.Name.StartsWith(SpawnerPrefix)))
6635: {
6636: ToRespawn.Add( i );
6647: Count++;
6638: }
6639: }
6640: }

I downloaded original 3.08 (new) xmlspawner2.cs
ArteGordon- 02-11-2006
and the crashlog gives the same numbers?
Galfaroth- 02-11-2006
Yes.
ArteGordon- 02-11-2006
hmm. puzzling. Try modifying that loop like this

CODE
foreach( Item i in World.Items.Values ) { try { if ((i is XmlSpawner) && (RespawnAll == true || i.Map == e.Mobile.Map) && (i.Deleted == false))
{
// Check if there is a respawn condition
if ((SpawnerPrefix == null) || (SpawnerPrefix.Length == 0) || (i.Name != null && i.Name.StartsWith(SpawnerPrefix)))
{
ToRespawn.Add(i);
Count++;
}
}
}
catch (Exception ex) { Console.WriteLine("Processing {0}, {1}", i, ex.Message); }
}

Galfaroth- 02-11-2006
Okay what I did:
.xmlspawnersave blah.xml
.global remove where xmlspawner
.xmlspawnerload blah.xml
.xmlspawnerrespawnall
And everything work...
ArteGordon- 02-12-2006
did you try adding that modification that I posted? Did it report anything?