#using scripts\codescripts\struct; function main() { SetupIntercoms(); SetupAliases(); level thread PlayCryogenIntercoms( 25, 35 ); } function SetupIntercoms() { level.cryogenIntercoms = []; intercomStructs = struct::get_array( "cryogen_intercom" ,"targetname"); foreach( intercomStruct in intercomStructs ) { intercom = spawn( "script_model", intercomStruct.origin, 0, intercomStruct.angles ); intercom.angles = intercomStruct.angles; intercom SetModel( "tag_origin" ); level.cryogenIntercoms[level.cryogenIntercoms.size] = intercom; } } function SetupAliasHelper( prefix, count ) { aliases = []; for( i = 0 ; i < count; i++ ) { aliases[aliases.size] = prefix + i; } return aliases; } function SetupAliases() { level.cryogen_aliases_female = SetupAliasHelper( "vox_reco_announcement_general_", 30 ); level.cryogen_aliases_male = SetupAliasHelper( "vox_pani_announcement_attack_", 22 ); } function PlayCryogenIntercoms( minTime, maxTime ) { while( level.cryogen_aliases_female.size > 0 ) { waitTime = RandomIntRange( minTime, maxTime ); wait( waitTime ); femaleAlias = GetRandomAlias( level.cryogen_aliases_female ); PlayIntercomSound( femaleAlias ); interruptRandom = RandomFloat( 1 ); if( ( .3 > interruptRandom ) && ( level.cryogen_aliases_male.size > 0 ) ) { wait( RandomFloatRange( 1, 2 ) ); maleAlias = GetRandomAlias( level.cryogen_aliases_male ); PlayIntercomSound( maleAlias, femaleAlias ); } } } function GetRandomAlias( &aliasArray ) { randomIndex = RandomInt( aliasArray.size ); alias = aliasArray[ randomIndex ]; ArrayRemoveIndex( aliasArray, randomIndex ); return alias; } function PlayIntercomSound( alias, stopAlias ) { foreach( intercom in level.cryogenIntercoms ) { intercom thread PlayIntercom( alias, stopAlias ); } } function PlayIntercom( alias, stopAlias ) // self is intercom { if( isDefined( stopAlias ) ) { self StopSound( stopAlias ); wait( .05 ); self PlaySound( "amb_intercom_interrupt" ); wait( 2 ); } self PlaySound( alias ); }