Erickgames_HD
I wrote some code to do something similar for adding spawns:
_register_zombie_spawn( spawner_zone, coordinates, angles, location_script_noteworthy )
{
riser_location_struct = spawnStruct();
riser_location_struct.script_string = "find_flesh";
riser_location_struct.targetname = spawner_zone;
riser_location_struct.origin = coordinates;
riser_location_struct.angles = angles;
riser_location_struct.script_noteworthy = location_script_noteworthy;
riser_location_struct.is_blocked = false;
size_of_riser_locations = level.struct_class_names[ "targetname" ][ spawner_zone ].size;
level.struct_class_names[ "targetname" ][ spawner_zone ][ size_of_riser_locations ] = riser_location_struct;
}
add_zombie_spawns()
{
if ( level.csrmRoom == "gen5" )
{
_register_zombie_spawn( "zone_nml_farm_spawners", ( -2880, -384, 160.25 ), ( 0, 45, 0 ), "riser_location" );
_register_zombie_spawn( "zone_nml_farm_spawners", ( -2304.13, -492.192, 172.125 ), ( 0, 45, 0 ), "riser_location" );
}
if ( level.csrmRoom == "showers" )
{
//level.struct_class_names[ "targetname" ][ "cellblock_shower_spawners" ] = [];
_register_zombie_spawn( "spawner_shower", ( 1723.62, 10579.6, 1152.13 ), ( 0, 45, 0 ), "riser_location" );
}
}
Timing is important with this function. You need to allocate the new spawns before the game uses them officially. I recommend using _load.gsc to do so.
Deleting all the spawns is fairly simple:
zones = getArrayKeys( level.zones );
foreach ( zone in zones )
{
if ( isDefined( level.struct_class_names[ "targetname" ][ zone + "_spawners" ] ) )
{
level.struct_class_names[ "targetname" ][ zone + "_spawners" ] = [];
}
}
This can only be done after the structs have been intialized and after the zones are initialized as well.