I have a little problem with my gamemode script. I try to spawn objects on a map by using this code:
Code: Select all
// Load Objects
Void LoadObjects ()
{
ItemList_Begin();
ObjectsIds["Armor"] = ItemList_Add("SMCommon\\Pickups\\Armor.Item.gbx");
ObjectsIds["Rocket"] = ItemList_Add("SMCommon\\Pickups\\Rocket.Item.gbx");
ObjectsIds["Laser"] = ItemList_Add("SMCommon\\Pickups\\Laser.Item.gbx");
ObjectsIds["Nucleus"] = ItemList_Add("SMCommon\\Pickups\\Nucleus.Item.gbx");
ObjectsIds["Arrow"] = ItemList_Add("SMCommon\\Pickups\\Arrow.Item.gbx");
ItemList_End();
}
Void SpawnObjects ()
{
foreach (MapLandmark in MapLandmarks_ObjectAnchor)
{
declare CSmObject Object;
switch (MapLandmark.Tag)
{
case "Armor": Object = ObjectCreate (ObjectsIds["Armor"]);
case "Rocket": Object = ObjectCreate (ObjectsIds["Rocket"]);
case "Laser": Object = ObjectCreate (ObjectsIds["Laser"]);
case "Nucleus": Object = ObjectCreate (ObjectsIds["Nucleus"]);
case "Arrow": Object = ObjectCreate (ObjectsIds["Arrow"]);
}
Object.SetAnchor (MapLandmark.ObjectAnchor);
}
}
LoadObjects () is called, when the server starts, SpawnObjects () when a round begins.
Everything works fine. I can see the objects on the map, but from the start on my framerate drops until the game freezes and players do not spawn, although they should spawn.
It seems like the freeze comes from the objects, because without the objects the script runs fine.
But I do not really know how such code can cause a freeze.