diff --git a/zm_ai_pack/scripts/zm/zm_ai_pack/_round_manager.gsc b/zm_ai_pack/scripts/zm/zm_ai_pack/_round_manager.gsc index cd9f1b7..12ee683 100644 --- a/zm_ai_pack/scripts/zm/zm_ai_pack/_round_manager.gsc +++ b/zm_ai_pack/scripts/zm/zm_ai_pack/_round_manager.gsc @@ -391,7 +391,8 @@ determine_current_round_type() normal_present = true; break; } - + } + for (;;) { possible_round_types = array_randomize( possible_round_types_keys ); diff --git a/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_random.gsc b/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_random.gsc index 219c121..8a80d37 100644 --- a/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_random.gsc +++ b/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_random.gsc @@ -38,23 +38,43 @@ spawning_random() aitypes = array_randomize( aitypes ); ai = undefined; has_normal = false; - for ( i = 0; i < aitypes.size; i++ ) + max_iterations = 10; + iteration_count = 0; + for (;;) { - if ( aitypes[ i ] == "normal" ) + for ( i = 0; i < aitypes.size; i++ ) { - has_normal = true; - continue; + if ( aitypes[ i ] == "normal" ) + { + has_normal = true; + continue; + } + ai = attempt_random_spawn( aitypes[ i ] ); + if ( isdefined( ai ) ) + { + break; + } } - ai = attempt_random_spawn( aitypes[ i ] ); - if ( isdefined( ai ) ) + if ( !isdefined( ai ) && has_normal ) { break; - } + } + + iteration_count++; + if ( iteration_count >= max_iterations ) + { + break; + } } - if ( !isdefined( ai ) ) + + if ( !isdefined( ai ) && has_normal ) { ai = [[ level.round_manager_aitype_spawning_funcs[ "normal" ] ]](); } + else + { + + } if ( isdefined( ai ) ) {