// this is used to set and check whether a spot is in use or not SpawnSpotsVacant <- []; m_nTotalSpawnSpots <- 4 for ( local i=0; i= FriendFoeOrder.len() ) m_nFriendFoeIndex = 0 printl( "m_nFriendFoeIndex = "+m_nFriendFoeIndex+", FriendFoeOrder.len() ="+FriendFoeOrder.len() ); local index = SpawnSpotsVacant[ slot ].tointeger() if ( FriendFoeOrder[m_nFriendFoeIndex] == "T" ) index += m_nTotalSpawnSpots EntFire( EntityGroup[index].GetName(), "Open", "" ); // move the friend or foe list to the next entry m_nFriendFoeIndex++ SpawnSpotsVacant.remove( slot ); } // when a target has been hit, hide it and free up the slot again function TargetIsHidden( slot ) { printl( "Hiding target. Adding "+slot+" to table" ); local num = slot + "" SpawnSpotsVacant.append( num ); // you get a spawn bonus for shooting a target //if ( m_flSpawnDelay > 0.2 ) //{ // m_flSpawnDelay -= 1 // if ( m_flSpawnDelay < 0.2 ) // m_flSpawnDelay = 0.2 //} } ///////////////////// function StartRunningAimWall() { m_bIsRunningAimWall = true m_nAimWallOOATimes = 0 } function AimWallHitTarget() { m_bAimWallHitTarget = true } function StopRunningAimWall() { m_bIsRunningAimWall = false } function CompleteAimWall() { StopRunningAimWall() m_bCompletedAimWall = true } ////////////////// function StartRunningPreTeam() { m_bIsRunningPreTeamRec = true EntFire ( "@radiovoice","RunScriptCode", "IdTestStart()", 0 ) } function StopRunningPreTeam() { m_bIsRunningPreTeamRec = false } function CompletePreTeamTest() { StopRunningPreTeam() m_bCompletedPreTeamRec = true } ///////////////////// function StartRunningTeam() { m_bIsRunningTeamRec = true m_flSpawnDelay = 0 } function StopRunningTeam() { m_bIsRunningTeamRec = false } function CompleteTeamTest() { StopRunningTeam() m_bCompletedTeamRec = true } ///////////////////// function StartRunningBurst() { if ( m_bCompletedBurst ) { StartRunningBurstBlocker() } else { m_bIsRunningBurst = true } } function StopRunningBurst() { m_bIsRunningBurst = false } function CompleteBurstTest() { StopRunningBurst() m_bCompletedBurst = true } /////////////////////// function StartRunningBurstBlocker() { m_bIsRunningBurstBlocker = true } function StopRunningBurstBlocker() { m_bIsRunningBurstBlocker = false } function CompleteBurstBlockerTest() { StopRunningBurstBlocker() m_bCompletedBurstBlocker = true } /////////////////////// function StartRunningCrouchTest() { m_bIsRunningCrouchTest = true // initialize crouch target scoring relay state if( m_bPlayerIsCrouching ) { EntFire( "@relay_crouch_hit_target", "enable", 0 ) } else { EntFire( "@relay_crouch_hit_target", "disable", 0 ) } } function StopRunningCrouchTest() { m_bIsRunningCrouchTest = false } function CompleteCrouchTest() { printl("*** Completed Crouch Test - opening exit door ***") StopRunningCrouchTest() m_bCompletedCrouchTest = true // take away gun EntFire( "@rl_teamburst_test_over", "Trigger", "", 2 ) } // this function gets called whenever the crouch target gets hit regardless of scoring function CrouchTargetHitCallback() { // bail early if not running crouch test if( !m_bIsRunningCrouchTest ) { return } } function OutOfAmmo() { if ( m_bIsRunningAimWall ) { // we want to expell all ammo EntFire( "@rl_burst_win", "Trigger", "", 0 ) printl("========OutOfAmmo in m_bIsRunningAimWall !!!") } else if ( (m_bIsRunningTeamRec && !m_bCompletedTeamRec) || (m_bIsRunningBurst && !m_bCompletedBurst) || (m_bIsRunningBurstBlocker && !m_bCompletedBurstBlocker) || (m_bIsRunningCrouchTest && !m_bCompletedCrouchTest) ) { RoundFailed( 1 ) } } function RoundFailed( reason ) { EntFire( "@relay_burst_round_failed", "Trigger", "", 0 ) if ( m_bIsRunningTeamRec ) { EntFire ( "@radiovoice","RunScriptCode", "IdTestFailed()", 0 ) StopRunningTeam() } if ( m_bIsRunningBurst ) { EntFire ( "@radiovoice","RunScriptCode", "BurstTestFailed()", 0 ) printl("===================FAIL!!!!!2222222222222222!!!") StopRunningBurst() } if ( m_bIsRunningBurstBlocker ) { EntFire ( "@radiovoice","RunScriptCode", "BurstBlockerTestFailed()", 0 ) printl("===================FAIL!!!!!333333333333333333!!!") StopRunningBurstBlocker() } if( m_bIsRunningCrouchTest ) { // hook up function EntFire ( "@radiovoice","RunScriptCode", "CrouchTestFailed()", 0 ) printl("===================FAIL!!!!!444444444444444444444 (crouch test)!!!") // hook up function StopRunningCrouchTest() } if ( reason == 1 ) { //EntFire ( "@radiovoice","RunScriptCode", "FailureAmmo()", 0 ) EntFire( "@hint_fail_outofammo", "ShowHint", "", 0 ) } else if ( reason == 2 ) { EntFire ( "@radiovoice","RunScriptCode", "FailureTime()", 0 ) EntFire( "@hint_fail_outoftime", "ShowHint", "", 0 ) } EntFire( "@unlock_gunbutton_team", "Trigger", "", 6 ) } function Think() { // bail early if not running recognition test if ( !m_bIsRunningTeamRec ) return // this controls the spawns if ( m_flLastThink + m_flSpawnDelay < Time() ) { m_flLastThink = Time(); if ( SpawnSpotsVacant.len() > 0 ) { printl( "SpawnSpotsVacant.len() = "+SpawnSpotsVacant.len() ); local nMax = (SpawnSpotsVacant.len() > 0) ? (SpawnSpotsVacant.len()-1) : 0 local targetSpot = RandomInt( 0, nMax ) //local slot = SpawnSpotsVacant[ targetSpot ]; ShowTarget( targetSpot ) } } }