Advertisement
MakeCents

zone_manager

Mar 13th, 2015
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 19.39 KB | None | 0 0
  1. #include common_scripts\utility;
  2. #include maps\_utility;
  3.  
  4.  
  5. //--------------------------------------------------------------
  6. //  Checks to see if a player is in a zone_name volume
  7. //--------------------------------------------------------------
  8. player_in_zone( zone_name )
  9. {
  10.     // If the zone hasn't been activated, don't even bother checking
  11.     if ( !IsDefined(level.zones[ zone_name ]) )
  12.     {
  13.         return false;
  14.     }
  15.     zone = level.zones[ zone_name ];
  16.  
  17.     // Okay check to see if a player is in one of the zone volumes
  18.     players = get_players();
  19.     {
  20.         for (i = 0; i < zone.volumes.size; i++)
  21.         {
  22.             for (j = 0; j < players.size; j++)
  23.             {
  24.                 if ( players[j] IsTouching(zone.volumes[i]) )
  25.                     return true;
  26.             }
  27.         }
  28.     }
  29.     return false;
  30. }
  31.  
  32.  
  33. //
  34. //  Disable exterior_goals that have a script_noteworthy.  This can prevent zombies from
  35. //      pathing to a goal that the zombie can't path towards the player after entering.
  36. //  It is assumed these will be activated later, when the zone gets initialized.
  37. deactivate_initial_barrier_goals()
  38. {
  39.     special_goals = getstructarray("exterior_goal", "targetname");
  40.     for (i = 0; i < special_goals.size; i++)
  41.     {
  42.         if (IsDefined(special_goals[i].script_noteworthy))
  43.         {
  44.             special_goals[i].is_active = undefined;
  45.             special_goals[i] trigger_off();
  46.         }
  47.     }
  48. }
  49.  
  50.  
  51. //
  52. //  Allows zombies to path to the specified barriers.
  53. //  All barriers with a script_noteworthy should initially triggered off by
  54. //      deactivate_barrier_goals
  55. //
  56. activate_barrier_goals(barrier_name, key)
  57. {
  58.     //  
  59.     entry_points = getstructarray(barrier_name, key);
  60.  
  61.     for(i=0;i<entry_points.size;i++)
  62.     {
  63.         entry_points[i].is_active = 1;
  64.         entry_points[i] trigger_on();
  65.     }      
  66. }
  67.  
  68.  
  69. //--------------------------------------------------------------
  70. //  Call this when you want to allow zombies to spawn from a zone
  71. //  -   Must have at least one info_volume with targetname = (name of the zone)
  72. //  -   Have the info_volumes target the zone's spawners
  73. //--------------------------------------------------------------
  74. zone_init( zone_name )
  75. {
  76.     if ( IsDefined( level.zones[ zone_name ] ) )
  77.     {
  78.         // It's already been activated
  79.         return;
  80.     }
  81.  
  82.     // Add this to the list of active zones
  83.     level.zones[ zone_name ] = spawnstruct();
  84.     level.zones[ zone_name ].is_enabled = false;    // Does the zone need to be evaluated?
  85.     level.zones[ zone_name ].is_occupied = false;   // Is the zone occupied by a player?
  86.     level.zones[ zone_name ].is_active = false;     // Are the spawners currently enabled for spawning?
  87.     level.zones[ zone_name ].adjacent_zones = [];   // NOTE: These must be defined in a separate level-specific initialization
  88.     level.zones[ zone_name ].volumes = GetEntArray( zone_name, "targetname" );
  89.  
  90.     /*iprintLn("^5~~~~~~~~~~~~Zone '" + zone_name + "' initialized~~~~~~~~~~~");
  91.     if(level.zones[ zone_name ].volumes.size <= 0) iprintLn("^1Error: No volumes found for zone!");
  92.     else iprintLn("^2[OK] Volumes in " + zone_name + ": " + level.zones[ zone_name ].volumes.size);*/
  93.  
  94.     //assertEx( IsDefined( level.zones[ zone_name ].volumes[0] ), "zone_init: No volumes found for zone: "+zone_name );
  95.  
  96.     if ( IsDefined( level.zones[ zone_name ].volumes[0].target ) )
  97.     {
  98.         // Grab all of the zombie and dog spawners and sort them into two arrays
  99.         level.zones[ zone_name ].spawners = [];
  100.         level.zones[ zone_name ].dog_spawners = [];
  101.        
  102.         spawners = GetEntArray( level.zones[ zone_name ].volumes[0].target, "targetname" );
  103.  
  104.         /*if(isDefined(spawners) && spawners.size > 0)
  105.             iprintLn("^2[OK] " + zone_name + "  has " + spawners.size + " linked spawners.");
  106.         else
  107.             iprintLn("^1Error: " + zone_name + " has no linked spawners! This MUST be fixed , otherwise the zone is useless and will cause a script_runtime error.");*/
  108.  
  109.         for (i = 0; i < spawners.size; i++)
  110.         {
  111.             if ( issubstr(spawners[i].classname, "dog") )
  112.             {
  113.                 level.zones[ zone_name ].dog_spawners = add_to_array( level.zones[ zone_name ].dog_spawners, spawners[i] );
  114.             }
  115.             else
  116.             {
  117.                 level.zones[ zone_name ].spawners = add_to_array( level.zones[ zone_name ].spawners, spawners[i] );
  118.             }
  119.         }
  120.  
  121.         level.zones[ zone_name ].dog_locations = GetStructArray(level.zones[ zone_name ].volumes[0].target + "_dog", "targetname");
  122.  
  123.         // grab all zombie rise locations for the zone
  124.         level.zones[ zone_name ].rise_locations = GetStructArray(level.zones[ zone_name ].volumes[0].target + "_rise", "targetname");
  125.     }
  126. }
  127.  
  128.  
  129. //
  130. //  Turn on the zone
  131. enable_zone( zone_name )
  132. {
  133.     level.zones[ zone_name ].is_enabled = true;
  134.     //iprintLn("^5Info: All spawners in " + zone_name + " have been enabled.");
  135.     // activate any player spawn points
  136.     spawn_points = getstructarray("player_respawn_point", "targetname");
  137.     for( i = 0; i < spawn_points.size; i++ )
  138.     {
  139.         if ( spawn_points[i].script_noteworthy == zone_name )
  140.         {
  141.             spawn_points[i].locked = false;
  142.         }
  143.     }
  144.  
  145.     activate_barrier_goals( zone_name+"_barriers", "script_noteworthy" );
  146. }
  147.  
  148.  
  149. //
  150. // Makes zone_a connected to zone_b.  If one_way is false, zone_b is also made "adjacent" to zone_a
  151. add_adjacent_zone( zone_name_a, zone_name_b, flag_name, one_way )
  152. {
  153.     if ( !IsDefined( one_way ) )
  154.     {
  155.         one_way = false;
  156.     }
  157.  
  158.     // If it's not already activated, it will activate the zone
  159.     //  If it's already activated, it won't do anything.
  160.     zone_init( zone_name_a );
  161.     zone_init( zone_name_b );
  162.  
  163.     // B becomes an adjacent zone of A
  164.     if ( !IsDefined( level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ] ) )
  165.     {
  166.         level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ] = SpawnStruct();
  167.         level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ].is_connected = false;
  168.         level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ].flags_do_or_check = false;
  169.         if ( IsArray( flag_name ) )
  170.         {
  171.             level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ].flags = flag_name;
  172.         }
  173.         else
  174.         {
  175.             level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ].flags[0] = flag_name;
  176.         }
  177.     }
  178.     else   
  179.     {
  180.         // we've already defined a link condition, but we need to add another one and treat
  181.         //  it as an "OR" condition
  182.         assertEx( !IsArray( flag_name ), "add_adjacent_zone: can't mix single and arrays of flags" );  
  183.         size = level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ].flags.size;
  184.         level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ].flags[ size ] = flag_name;
  185.         level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ].flags_do_or_check = true;
  186.     }
  187.  
  188.     if ( !one_way )
  189.     {
  190.         if ( !IsDefined( level.zones[ zone_name_b ].adjacent_zones[ zone_name_a ] ) )
  191.         {
  192.             // A becomes an adjacent zone of B
  193.             level.zones[ zone_name_b ].adjacent_zones[ zone_name_a ] = SpawnStruct();
  194.             level.zones[ zone_name_b ].adjacent_zones[ zone_name_a ].is_connected = false;
  195.             level.zones[ zone_name_b ].adjacent_zones[ zone_name_a ].flags_do_or_check = false;
  196.             if ( IsArray( flag_name ) )
  197.             {
  198.                 level.zones[ zone_name_b ].adjacent_zones[ zone_name_a ].flags = flag_name;
  199.             }
  200.             else
  201.             {
  202.                 level.zones[ zone_name_b ].adjacent_zones[ zone_name_a ].flags[0] = flag_name;
  203.             }
  204.         }
  205.         else   
  206.         {
  207.             // we've already defined a link condition, but we need to add another one and treat
  208.             //  it as an "OR" condition
  209.             assertEx( !IsArray( flag_name ), "add_adjacent_zone: can't mix single and arrays of flags" );
  210.             size = level.zones[ zone_name_b ].adjacent_zones[ zone_name_a ].flags.size;
  211.             level.zones[ zone_name_b ].adjacent_zones[ zone_name_a ].flags[ size ] = flag_name;
  212.             level.zones[ zone_name_b ].adjacent_zones[ zone_name_a ].flags_do_or_check = true;
  213.         }
  214.     }
  215. }
  216.  
  217.  
  218. //--------------------------------------------------------------
  219. //  Gathers all flags that need to be evaluated and sets up waits for them
  220. //--------------------------------------------------------------
  221. setup_zone_flag_waits()
  222. {
  223.     flags = [];
  224.     for( z=0; z<level.zones.size; z++ )
  225.     {
  226.         zkeys = GetArrayKeys( level.zones );
  227.         for ( az = 0; az<level.zones[ zkeys[z] ].adjacent_zones.size; az++ )
  228.         {
  229.             azkeys = GetArrayKeys( level.zones[ zkeys[z] ].adjacent_zones );
  230.             for ( f = 0; f< level.zones[ zkeys[z] ].adjacent_zones[ azkeys[az] ].flags.size; f++ )
  231.             {
  232.                 no_dupes = array_check_for_dupes( flags, level.zones[ zkeys[z] ].adjacent_zones[ azkeys[az] ].flags[f] );
  233.                 if( no_dupes )
  234.                 {
  235.                     flags = add_to_array(flags, level.zones[ zkeys[z] ].adjacent_zones[ azkeys[az] ].flags[f] );
  236.                 }
  237.             }
  238.         }
  239.     }
  240.     for( i=0; i<flags.size; i++ )
  241.     {
  242.         level thread zone_flag_wait( flags[i] );
  243.     }
  244. }
  245.  
  246.  
  247. //
  248. //  Wait for a zone flag to be set and then update zones
  249. //
  250. zone_flag_wait( flag_name )
  251. {
  252.     if ( !IsDefined( level.flag[ flag_name ] ) )
  253.     {
  254.         flag_init( flag_name );
  255.     }
  256.     flag_wait( flag_name );
  257.  
  258.     // Enable adjacent zones if all flags are set for a connection
  259.     for( z=0; z<level.zones.size; z++ )
  260.     {
  261.         zkeys = GetArrayKeys( level.zones );
  262.         for ( az = 0; az<level.zones[ zkeys[z] ].adjacent_zones.size; az++ )
  263.         {
  264.             azkeys = GetArrayKeys( level.zones[ zkeys[z] ].adjacent_zones );
  265.  
  266.             if ( !level.zones[ zkeys[z] ].adjacent_zones[ azkeys[az] ].is_connected )
  267.             {
  268.                 if ( level.zones[ zkeys[z] ].adjacent_zones[ azkeys[az] ].flags_do_or_check )
  269.                 {
  270.                     // If ANY flag is set, then connect zones
  271.                     flags_set = false;
  272.                     for ( f = 0; f< level.zones[ zkeys[z] ].adjacent_zones[ azkeys[az] ].flags.size; f++ )
  273.                     {
  274.                         if ( flag( level.zones[ zkeys[z] ].adjacent_zones[ azkeys[az] ].flags[f] ) )
  275.                         {
  276.                             flags_set = true;
  277.                             break;
  278.                         }
  279.                     }
  280.                     if ( flags_set )
  281.                     {
  282.                         level.zones[ zkeys[z] ].adjacent_zones[ azkeys[az] ].is_connected = true;
  283.                         if ( !level.zones[ azkeys[az] ].is_enabled )
  284.                         {
  285.                             enable_zone( azkeys[az] );
  286.                         }
  287.                     }
  288.                 }
  289.                 else
  290.                 {
  291.                     // See if ALL the flags have been set, otherwise, move on
  292.                     flags_set = true;
  293.                     for ( f = 0; f< level.zones[ zkeys[z] ].adjacent_zones[ azkeys[az] ].flags.size; f++ )
  294.                     {
  295.                         if ( !flag( level.zones[ zkeys[z] ].adjacent_zones[ azkeys[az] ].flags[f] ) )
  296.                         {
  297.                             flags_set = false;
  298.                         }
  299.                     }
  300.                     if ( flags_set )
  301.                     {
  302.                         level.zones[ zkeys[z] ].adjacent_zones[ azkeys[az] ].is_connected = true;
  303.                         if ( !level.zones[ azkeys[az] ].is_enabled )
  304.                         {
  305.                             enable_zone( azkeys[az] );
  306.                         }
  307.                     }
  308.                 }
  309.             }
  310.         }
  311.     }
  312. }
  313.  
  314.  
  315. //--------------------------------------------------------------
  316. //  This needs to be called when new zones open up via doors
  317. //--------------------------------------------------------------
  318. connect_zones( zone_name_a, zone_name_b, one_way )
  319. {
  320.     if ( !IsDefined( one_way ) )
  321.     {
  322.         one_way = false;
  323.     }
  324.  
  325.     // If it's not already activated, it will activate the zone
  326.     //  If it's already activated, it won't do anything.
  327.     zone_init( zone_name_a );
  328.     zone_init( zone_name_b );
  329.  
  330.     enable_zone( zone_name_a );
  331.     enable_zone( zone_name_b );
  332.  
  333.     // B becomes an adjacent zone of A
  334.     if ( !IsDefined( level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ] ) )
  335.     {
  336.         level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ] = SpawnStruct();
  337.         level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ].is_connected = true;
  338.     }
  339.  
  340.     if ( !one_way )
  341.     {
  342.         // A becomes an adjacent zone of B
  343.         if ( !IsDefined( level.zones[ zone_name_b ].adjacent_zones[ zone_name_a ] ) )
  344.         {
  345.             level.zones[ zone_name_b ].adjacent_zones[ zone_name_a ] = SpawnStruct();
  346.             level.zones[ zone_name_b ].adjacent_zones[ zone_name_a ].is_connected = true;
  347.         }
  348.     }
  349. }
  350.  
  351.  
  352. //--------------------------------------------------------------
  353. //  This one function will handle managing all zones in your map
  354. //  to turn them on/off - probably the best way to handle this
  355. //--------------------------------------------------------------
  356. manage_zones( initial_zone )
  357. {
  358.     assertEx( IsDefined( initial_zone ), "You must specify an initial zone to manage" );   
  359.  
  360.     deactivate_initial_barrier_goals(); // Must be called before zone_init
  361.  
  362.     level.zones = [];
  363.     // Setup zone connections
  364.     if ( IsDefined( level.zone_manager_init_func ) )
  365.     {
  366.         [[ level.zone_manager_init_func ]]();
  367.     }
  368.  
  369.     if ( IsArray( initial_zone ) )
  370.     {
  371.         for ( i = 0; i < initial_zone.size; i++ )
  372.         {
  373.             zone_init( initial_zone[i] );
  374.             enable_zone( initial_zone[i] );
  375.         }
  376.     }
  377.     else
  378.     {
  379.         zone_init( initial_zone );
  380.         enable_zone( initial_zone );
  381.     }
  382.  
  383.     setup_zone_flag_waits();
  384.  
  385.     // Now iterate through the active zones and see if we need to activate spawners
  386.     while(getdvarint("noclip") == 0 || getdvarint("notarget") != 0  )
  387.     {
  388.         zkeys = GetArrayKeys( level.zones );
  389.  
  390.         // clear out active zone flags
  391.         for( z=0; z<zkeys.size; z++ )
  392.         {
  393.             level.zones[ zkeys[z] ].is_active   = false;
  394.             level.zones[ zkeys[z] ].is_occupied = false;
  395.         }
  396.  
  397.         // Figure out which zones are active
  398.         //  If a player occupies a zone, then that zone and any of its enabled adjacent zones will activate
  399.         a_zone_is_active = false;   // let's us know if an active zone is found
  400.         for( z=0; z<zkeys.size; z++ )
  401.         {
  402.             if ( !level.zones[ zkeys[z] ].is_enabled )
  403.             {
  404.                 continue;
  405.             }
  406.  
  407.             level.zones[ zkeys[z] ].is_occupied = player_in_zone( zkeys[z] );
  408.             if ( level.zones[ zkeys[z] ].is_occupied )
  409.             {
  410.                 level.zones[ zkeys[z] ].is_active = true;
  411.                 a_zone_is_active = true;
  412.                 for ( az=0; az<level.zones[ zkeys[z] ].adjacent_zones.size; az++ )
  413.                 {
  414.                     azkeys = GetArrayKeys( level.zones[ zkeys[z] ].adjacent_zones );
  415.                     if ( level.zones[ zkeys[z] ].adjacent_zones[ azkeys[az] ].is_connected )
  416.                     {
  417.                         level.zones[ azkeys[ az ] ].is_active = true;
  418.                     }
  419.                 }
  420.             }
  421.         }
  422.  
  423.         // MM - Special logic for empty spawner list
  424.         if ( !a_zone_is_active )
  425.         {
  426.             if(isDefined(level.zones[ "receiver_zone" ])) //UGX
  427.             {
  428.                 level.zones[ "receiver_zone" ].is_active = true;
  429.                 level.zones[ "receiver_zone" ].is_occupied = true;
  430.             }
  431.         }
  432.        
  433.  
  434.         // Okay now we can modify the spawner list
  435.         for( z=0; z<zkeys.size; z++ )
  436.         {
  437.             zone_name = zkeys[z];
  438.  
  439.             if ( !level.zones[ zkeys[z] ].is_enabled )
  440.             {
  441.                 continue;
  442.             }
  443.            
  444.             if ( level.zones[ zone_name ].is_active )
  445.             {
  446.                 // Making an assumption that if one of the zone's spawners is in the array, then all of them are in the array
  447.                 if ( level.zones[ zone_name ].spawners.size > 0 )
  448.                 {
  449.                     no_dupes = array_check_for_dupes( level.enemy_spawns, level.zones[ zone_name ].spawners[0] );
  450.                     if( no_dupes )
  451.                     {
  452.                         for(x=0;x<level.zones[ zone_name ].spawners.size;x++)
  453.                         {
  454.                             level.zones[ zone_name ].spawners[x].locked_spawner = false;
  455.                             level.enemy_spawns = add_to_array(level.enemy_spawns, level.zones[ zone_name ].spawners[x]);
  456.                         }
  457.                     }
  458.                 }
  459.  
  460.                 // Making an assumption that if one of the zone's spawners is in the array, then all of them are in the array
  461.                 if ( level.zones[ zone_name ].dog_spawners.size > 0 )
  462.                 {
  463.                     no_dupes = array_check_for_dupes( level.enemy_dog_spawns, level.zones[ zone_name ].dog_spawners[0] );
  464.                     if( no_dupes )
  465.                     {
  466.                         for(x=0;x<level.zones[ zone_name ].dog_spawners.size;x++)
  467.                         {
  468.                             level.enemy_dog_spawns = add_to_array(level.enemy_dog_spawns, level.zones[ zone_name ].dog_spawners[x]);
  469.                         }
  470.                     }
  471.                 }
  472.  
  473.                 // activate any associated dog_spawn locations
  474.                 if ( level.zones[ zone_name ].dog_locations.size > 0 )
  475.                 {
  476.                     // Making an assumption that if one of the structs
  477.                     //  is in the array, then all of them are in the array
  478.                     no_dupes = array_check_for_dupes(level.enemy_dog_locations, level.zones[ zone_name ].dog_locations[0]);
  479.                     if( no_dupes )
  480.                     {
  481.                         for(x=0; x<level.zones[ zone_name ].dog_locations.size; x++)
  482.                         {
  483.                             level.zones[ zone_name ].dog_locations[x].locked_spawner = false;
  484.                             level.enemy_dog_locations = add_to_array(level.enemy_dog_locations, level.zones[ zone_name ].dog_locations[x]);
  485.                         }
  486.                     }
  487.                 }
  488.  
  489.                 // activate any associated zombie_rise locations
  490.                 if ( level.zones[ zone_name ].rise_locations.size > 0 )
  491.                 {
  492.                     // Making an assumption that if one of the zone's spawners
  493.                     //  is in the array, then all of them are in the array
  494.                     no_dupes = array_check_for_dupes(level.zombie_rise_spawners, level.zones[ zone_name ].rise_locations[0]);
  495.                     if( no_dupes )
  496.                     {
  497.                         for(x=0; x<level.zones[ zone_name ].rise_locations.size; x++)
  498.                         {
  499.                             level.zones[ zone_name ].rise_locations[x].locked_spawner = false;
  500.                             level.zombie_rise_spawners = add_to_array(level.zombie_rise_spawners, level.zones[ zone_name ].rise_locations[x]);
  501.                         }
  502.                     }
  503.                 }
  504.             }
  505.             // The zone is not active so disable the spawners
  506.             else
  507.             {  
  508.                 // Making an assumption that if one of the zone's spawners
  509.                 //  is in the array, then all of them are in the array
  510.                 if ( level.zones[ zone_name ].spawners.size > 0 )
  511.                 {
  512.                     no_dupes = array_check_for_dupes( level.enemy_spawns, level.zones[ zone_name ].spawners[0] );
  513.                     if( !no_dupes )
  514.                     {
  515.                         for(x=0;x<level.zones[ zone_name ].spawners.size;x++)
  516.                         {
  517.                             level.zones[ zone_name ].spawners[x].locked_spawner = true;
  518.                             level.enemy_spawns = array_remove_nokeys(level.enemy_spawns, level.zones[ zone_name ].spawners[x]);
  519.                         }
  520.                     }
  521.                 }
  522.                
  523.                 // Making an assumption that if one of the zone's spawners is in the array, then all of them are in the array
  524.                 if ( level.zones[ zone_name ].dog_spawners.size > 0 )
  525.                 {
  526.                     no_dupes = array_check_for_dupes( level.enemy_dog_spawns, level.zones[ zone_name ].dog_spawners[0] );
  527.                     if( !no_dupes )
  528.                     {
  529.                         for(x=0;x<level.zones[ zone_name ].dog_spawners.size;x++)
  530.                         {
  531.                             level.enemy_dog_spawns = array_remove_nokeys(level.enemy_dog_spawns, level.zones[ zone_name ].dog_spawners[x]);
  532.                         }
  533.                     }
  534.                 }
  535.  
  536.                 // deactivate any associated dog spawn locations
  537.                 if ( level.zones[ zone_name ].dog_locations.size > 0 )
  538.                 {
  539.                     /*if(level.zones[ zone_name ].dog_locations.size == 1)
  540.                         iPrintLn("^3[Warning] You have placed exactly 1 dog struct in this zone (" + zone_name + "). This will cause a script_runtime error unless you have installed the UGX Modtools Patch or place at least one additional riser struct for this zone.");*/
  541.                     // Making an assumption that if one of the structs is in the array, then all of them are in the array
  542.                     no_dupes = array_check_for_dupes(level.enemy_dog_locations, level.zones[ zone_name ].dog_locations[0]);
  543.                     if( !no_dupes )
  544.                     {  
  545.                         for(x=0; x<level.zones[ zone_name ].dog_locations.size; x++)
  546.                         {
  547.                             level.zones[ zone_name ].dog_locations[x].locked_spawner = false;
  548.                             level.enemy_dog_locations = array_remove_nokeys(level.enemy_dog_locations, level.zones[ zone_name ].dog_locations[x]);
  549.                         }
  550.                     }
  551.                 }
  552.                 // deactivate any associated zombie_rise locations
  553.                 if ( level.zones[ zone_name ].rise_locations.size > 0 )
  554.                 {
  555.                     // Making an assumption that if one of the zone's spawners
  556.                     //  is in the array, then all of them are in the array
  557.                     /*if(level.zones[ zone_name ].rise_locations.size == 1)
  558.                         iPrintLn("^3[Warning] You have placed exactly 1 riser struct in this zone (" + zone_name + "). This will cause a script_runtime error unless you have installed the UGX Modtools Patch or place at least one additional riser struct for this zone.");*/
  559.                     no_dupes = array_check_for_dupes(level.zombie_rise_spawners, level.zones[ zone_name ].rise_locations[0]);
  560.                     if( !no_dupes )
  561.                     {
  562.                         for(x=0; x<level.zones[ zone_name ].rise_locations.size; x++)
  563.                         {
  564.                             level.zones[ zone_name ].rise_locations[x].locked_spawner = false;
  565.                             level.zombie_rise_spawners = array_remove_nokeys(level.zombie_rise_spawners, level.zones[ zone_name ].rise_locations[x]);
  566.                         }
  567.                     }
  568.                 }
  569.             }
  570.         }
  571.  
  572.         //wait a second before another check
  573.         wait(1);           
  574.     }
  575. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement