Template:PatchDiff/October 4, 2011 Patch/update/scripts/vscripts/choreo/glados coop.nut

From the Portal Wiki
Jump to navigation Jump to search
N/A1BluePingCount <- 0
N/A2BlueBadPingCount <- 0
N/A3BlueLastPing <- Time()
N/A4BlueInPortalTraining <-0
N/A5OrangeInPortalTraining <-0
N/A6OrangePingCount <- 0
N/A7OrangeLastPing <- Time()
N/A8OrangeBadPingCount <- 0
N/A9BluePortalTrainingCounter <- 0
N/A10OrangePortalTrainingCounter <- 0
N/A11BlueHasGun <-0
N/A12OrangeHasGun <-0
N/A13CoopStartCalCompleteSet <- 0
N/A14BlueInMaze <- 0
N/A15OrangeInMaze <- 0
N/A16BlueInCrusher <-0
N/A17OrangeInCrusher <-0
N/A18mp_coop_infinifling_traindeath <- 0
N/A19mp_coop_infinifling_traindeath01 <- 0
N/A20mp_coop_catapult_wall_introdeath <- 0
N/A21mp_coop_wall_blockdeath <- 0
N/A22bluetrust <-0
N/A23orangetrust <-0
N/A24BlueTalk <-0
N/A25OrangeTalk <-0
N/A26BlueNoTalk <-0
N/A27OrangeNoTalk <-0
N/A28startdeath <-0
N/A29mp_coop_turret_ballcount <-0
N/A30InHub2 <-0
N/A31teambtstaunts <- 0
N/A32GladosInsideTauntCam <- 0
N/A33GladosInsideTauntCamCounter <- 1
N/A34GladosInsideTauntCamInterval <- 0
N/A35GladosInsideTauntCamLastInterval <- 0
N/A36OrangeTauntCam <-0
N/A37BlueTauntCam <-0
N/A38BlueTauntFinaleInterval <-0
N/A39OrangeTauntFinaleInterval <-0
N/A40LastDeathTime <- 0
N/A41LastTauntTime <- 0
N/A42BluePingStartTimer <-0
N/A43OrangePingStartTimer <-0
N/A44BluePingStartDone <- 0
N/A45OrangePingStartDone <- 0
N/A46//Fire Once
N/A47CoopStartBButtonSet <-0
N/A48CoopStartButtonSet <-0
N/A49CoopStartBoxButtonSet <-0
N/A50CoopCrushersBlueCrushset <- 0
N/A51CoopCrushersOrangeCrushset <- 0
N/A52CoopMazeBlueCrushset <- 0
N/A53CoopMazeOrangeCrushset <- 0
N/A54InHub2Set <- 0
N/A55testcnt <-0
N/A56BluePingTraining1 <-0
N/A57BluePingTraining2 <-0
N/A58OrangePingTraining1 <-0
N/A59OrangePingTraining2 <-0
N/A60mp_coop_wall_2death <-0
N/A61HumanResourceDeath1 <-0
N/A62HumanResourceDeath2 <-0
N/A63HumanResourceDeath3 <-0
N/A64HumanResourceDeath4 <-0
N/A65HumanResourceDeath5 <-0
N/A66HumanResourceDeath6 <-0
N/A67HumanResourceDeath7 <-0
N/A68EarlyDeath1 <-0
N/A69EarlyDeath2 <-0
N/A70EarlyDeath3 <-0
N/A71EarlyDeath4 <-0
N/A72EarlyDeath5 <-0
N/A73Tbeam_enddeathturret <-0
N/A74Tbeam_enddeathfall <-0
N/A75Tbeam_enddeathcounter <-0
N/A76Tbeam_enddeathother <- 0
N/A77mp_coop_laser_crusherdeath <-0
N/A78mp_coop_turret_wallscount <-0
N/A79mp_coop_tbeam_laser_1death1 <-0
N/A80mp_coop_tbeam_laser_1death2 <-0
N/A81mp_coop_tbeam_redirectdeath <-0
N/A82mp_coop_tbeam_drilldeathorange <-0
N/A83mp_coop_tbeam_drilldeathblue <-0
N/A84mp_coop_tbeam_polaritydeathorange <-0
N/A85mp_coop_tbeam_polaritydeathblue <-0
N/A86mp_coop_tbeam_polarity3deathorange <-0
N/A87mp_coop_tbeam_polarity3deathblue <-0
N/A88polarity2whisper <- 0
N/A89mp_coop_multifling_1cube <- 0
N/A90//ispaused()
N/A91//IsPlayingBack()
N/A92//EstimateLength()
N/A93 
N/A94//debug stuff
N/A95debug <- false //Set true to enable debug block during think function
N/A96debugInterval <- 10.00
N/A97 
N/A98lastthink <- Time()
N/A99startBlock <- 0
N/A100 
N/A101//Queue of scenes started with GladosPlayVcd()
N/A102scenequeue <- {}
N/A103firedfromqueue <- false
N/A104 
N/A105//Map Name
N/A106curMapName <- GetMapName()
N/A107 
N/A108//PitchShifting stuff
N/A109pitchShifting <- false
N/A110pitchShiftLastThink <- Time()
N/A111pitchShiftInterval <- 1.0
N/A112pitchShiftValue <- 1.0
N/A113pitchOverride <- null
N/A114 
N/A115//State Flags
N/A116stateSlowFieldTraining <- false
N/A117 
N/A118 
N/A119//jailbreak specific stuff
N/A120if (curMapName=="sp_sabotage_jailbreak_01" || curMapName=="sp_sabotage_jailbreak" || curMapName=="sp_a2_bts1")
N/A121{
N/A122 jailbreakpos <- 0
N/A123}
N/A124 
N/A125 
N/A126//sp_catapult_fling_sphere_peek specific stuff
N/A127if (curMapName=="sp_a2_sphere_peek")
N/A128{
N/A129 peekctr <- 0
N/A130}
N/A131 
N/A132 
N/A133//Dings
N/A134sceneDingOn <- CreateSceneEntity("scenes/npc/glados_manual/ding_on.vcd")
N/A135sceneDingOff <- CreateSceneEntity("scenes/npc/glados_manual/ding_off.vcd")
N/A136 
N/A137 
N/A138 
N/A139DoIncludeScript( "choreo/glados_coop_scenetable_include", self.GetScriptScope() )
N/A140DoIncludeScript( "choreo/glados_coop_scenetable_include_manual", self.GetScriptScope() )
N/A141DoIncludeScript( "choreo/glados_coop_scenetable_include_manual_dlc1", self.GetScriptScope() )
N/A142 
N/A143 
N/A144//Co-op sepcific stuff
N/A145 coopFirstPlayerToGetGun <- 0 //Saves id of first player to pick up portal gun
N/A146 coopBlue <- 2 //id of blue player
N/A147 coopOrange <- 1 //id of orange player
N/A148 coopTalkIDBlue <-1 //Blue id for IsPlayerSpeaking() - There's some weirdness where it may not be the same as coopBlue
N/A149 coopTalkIDOrange <-2 //Orange id for IsPlayerSpeaking() - There's some weirdness where it may not be the same as coopOrange
N/A150 coopWaitingForGetGun <- null //Waiting for the second player to pick up the portal gun
N/A151 coopRelaxationVaultVoiceMonitor <- false //true = GladosThink() should monitor for player speech
N/A152 coopRelaxationVaultVoiceBlueTicks <- 0 //Number of times GladosThink() has detected Blue speaking
N/A153 coopRelaxationVaultVoiceOrangeTicks <- 0 //Number of times GladosThink() has detected Blue speaking
N/A154 coopRelaxationVaultthreshold <- 20 //number of times in GladosThink that a player has to talk before it is an interruption
N/A155 coopSilencethreshold <- 1.0 //number of seconds in GladosThink that both players have to remain silent before it is considered a silence
N/A156 coopSilenceTicks <- 0 //Number of consecutive GladosThink() calls during which neither player was speaking
N/A157 coopSayOnSilence <- 0 //if >0: When coopSilenceTicks>=coopSilencethreshold, GladosPlayVcd(coopSayOnSilence)
N/A158 coopWaitingToExit <- false
N/A159//Co-op Ping Training Stuff
N/A160 coopPingGameOn <- false
N/A161 coopPingPlayerTurn <- 0
N/A162 coopPingTurnNumber <- 0
N/A163 coopPingNextScene <- null
N/A164 coopPingNextSceneDelay <- null
N/A165 coopWrongMovesBlue <- 0
N/A166 coopWrongMovesOrange <- 0
N/A167 coopSaidWrongMovesDialog <- false
N/A168 coopPingsOrange <- 0
N/A169 coopPingsBlue <- 0
N/A170 coopPingNoInterrupt <- false
N/A171 coopTimeSinceTurn <- Time()
N/A172 coopSilenceBlahsPlayed <- 0
N/A173 coopTriggeredElevator <- false
N/A174 
N/A175//Score Stating Stuff
N/A176 coopScoreToState <- null
N/A177 
N/A178// Achievement LIMITED_PORTALS
N/A179LIMITED_PORTALS_MAP <- "mp_coop_catapult_wall_intro" // Map the achievement takes place on.
N/A180LIMITED_PORTALS_COUNT <- 5 // Max number of portals to make the achievement.
N/A181 
N/A182// Achievement STAYING_ALIVE
N/A183STAYING_ALIVE_SECTION <- 4 // Section the achievement applies to.
N/A184 
N/A185// Achievement SPEED_RUN_COOP
N/A186SPEED_RUN_THRESHOLD <- 60 // Number of seconds a run must be finished in to count.
N/A187SPEED_RUN_SECTION <- 2 // Section the achievement applies to.
N/A188mp_coop_speed_run_time <- 0
N/A189 
N/A190function printldebug(arg)
N/A191{
N/A192 if (debug)
N/A193 {
N/A194 printl(arg)
N/A195 }
N/A196}
N/A197 
N/A198 
N/A199// OnPostSpawn - this is all the initial setup stuff
N/A200function OnPostSpawn()
N/A201{
N/A202 local i = 0
N/A203 //assign a unique id to each scene entity (uses SetTeam because that's the only thing available)
N/A204 foreach (val in SceneTable)
N/A205 {
N/A206 i+=1
N/A207 val.vcd.ValidateScriptScope()
N/A208 val.vcd.SetTeam(i)
N/A209 val.index <- i
N/A210 }
N/A211 //Initialize the deferred scene queue
N/A212 QueueInitialize()
N/A213 
N/A214 //Map specific Spawn stuff
N/A215 switch (curMapName)
N/A216 {
N/A217 case "sp_a1_wakeup":
N/A218 EntFire("@glados","runscriptcode","sp_a1_wakeup_start_map()",1.0)
N/A219 break
N/A220 }
N/A221}
N/A222 
N/A223 
N/A224 
N/A225//Passed the unique team id associated with a scene entity defined in SceneTable, this function returns the correct SceneTable index for that entry
N/A226//ex: SceneTableInst = SceneTable[findIndex(team)]
N/A227function findIndex(team)
N/A228{
N/A229 local idx, val
N/A230 foreach (idx, val in SceneTable)
N/A231 {
N/A232 if (val.index == team)
N/A233 {
N/A234 return idx
N/A235 }
N/A236 }
N/A237 return null
N/A238}
N/A239 
N/A240//Passed the unique team id associated with a scene entity defined in SceneTable, this function returns the scene instance that originally fired it.
N/A241//Unfortunately, if multiple scene instances fire the same vcd, this isn't reliable. Hopefully we can either a) fix that
N/A242//or b) not have multiple scene instances use the same vcd (which is currently the case as of 07/19/2010 - efw)
N/A243function FindSceneInstanceByTeam(team)
N/A244{
N/A245 local idx, val
N/A246 local idx2, val2
N/A247 local inst = null
N/A248 foreach (idx, val in scenequeue)
N/A249 {
N/A250 foreach (idx2, val2 in val.waitFiredVcds)
N/A251 {
N/A252 if (val2 == team)
N/A253 {
N/A254 inst = val
N/A255 break
N/A256 }
N/A257 }
N/A258 if (inst != null)
N/A259 break
N/A260 }
N/A261 return inst
N/A262}
N/A263 
N/A264 
N/A265function SceneCanceled()
N/A266{
N/A267 printldebug("========SCENE CANCELLED - CALLING ENTITY: "+findIndex(owninginstance.GetTeam()))
N/A268}
N/A269 
N/A270//If a vcd is tagged to "exit early" (by setting postdelay < 0), this event fires rather than PlayNextScene() when the vcd finishes.
N/A271//SkipOnCompletion() has all the functionality of PlayNextScene(), except it doesn't actually play the next scene, because the next scene presumably
N/A272//already started playing when the vcd exited early.
N/A273//SkipOnCompletion does, however, evaluate the vcd's SceneTable entry to see if any EntFires need to happen.
N/A274function SkipOnCompletion()
N/A275{
N/A276 printldebug("========SKIPONCOMPLETION CALLING ENTITY: "+findIndex(owninginstance.GetTeam())+" : TIME "+Time())
N/A277 local team = owninginstance.GetTeam()
N/A278 local inst = FindSceneInstanceByTeam(team)
N/A279 if (inst != null)
N/A280 {
N/A281 inst.deleteFiredVcd(team)
N/A282 inst.waitVcdCurrent = findIndex(team)
N/A283 //Are there any EntFires associated with this vcd?
N/A284 if (inst.waitVcdCurrent != null)
N/A285 {
N/A286 if ("fires" in SceneTable[inst.waitVcdCurrent])
N/A287 {
N/A288 local idx, val
N/A289 foreach (idx, val in SceneTable[inst.waitVcdCurrent].fires)
N/A290 {
N/A291 if (!("fireatstart" in val))
N/A292 {
N/A293 printldebug(">>>>>>ENT FIRE AT (SKIPCOMPLETION) END: "+val.entity+":"+val.input)
N/A294 EntFire(val.entity,val.input,val.parameter,val.delay)
N/A295 }
N/A296 }
N/A297 }
N/A298 }
N/A299 }
N/A300}
N/A301 
N/A302 
N/A303function PlayNextScene()
N/A304{
N/A305 printldebug("========PLAYNEXTSCENE CALLING ENTITY: "+findIndex(owninginstance.GetTeam())+" : TIME "+Time())
N/A306 local team = owninginstance.GetTeam()
N/A307 local inst = FindSceneInstanceByTeam(team)
N/A308 if (inst != null)
N/A309 {
N/A310 inst.deleteFiredVcd(team)
N/A311 inst.waitVcdCurrent = findIndex(team)
N/A312 PlayNextSceneInternal(inst)
N/A313 }
N/A314}
N/A315 
N/A316 
N/A317 
N/A318function PlayNextSceneInternal(inst = null)
N/A319//inst = just completed scene
N/A320{
N/A321 local i = 0
N/A322 local tmp = 0
N/A323 //printldebug("===================Scene Done!" + i)
N/A324 
N/A325 //Set the ducking back to the default value
N/A326 SendToConsole( "snd_ducktovolume 0.55" )
N/A327 
N/A328 //Are there any "fire at the end" triggers associated with the just completed?
N/A329 if (inst.waitVcdCurrent != null)
N/A330 {
N/A331 if ("fires" in SceneTable[inst.waitVcdCurrent])
N/A332 {
N/A333 local idx, val
N/A334 foreach (idx, val in SceneTable[inst.waitVcdCurrent].fires)
N/A335 {
N/A336 if (!("fireatstart" in val))
N/A337 {
N/A338 printldebug(">>>>>>ENT FIRE AT END: "+val.entity+":"+val.input)
N/A339 EntFire(val.entity,val.input,val.parameter,val.delay)
N/A340 }
N/A341 }
N/A342 }
N/A343 }
N/A344 //Is there another vcd in the scene chain?
N/A345 if (inst.waitNext != null)
N/A346 {
N/A347 printldebug("=====There is a next scene: "+inst.waitNext)
N/A348 if (inst.waitLength == null)
N/A349 {
N/A350 i+=1
N/A351 printldebug("===================Ready to play:" + i)
N/A352 GladosPlayVcd(inst)
N/A353 }
N/A354 else
N/A355 {
N/A356 inst.waitStartTime = Time()
N/A357 inst.waiting = 1
N/A358 }
N/A359 }
N/A360 else
N/A361 {
N/A362 printldebug("=====No next scene!")
N/A363 //Remove the instance from the scene list
N/A364 scenequeue_DeleteScene(inst.index)
N/A365 //The current scene is over. Check to see if there are any queued scenes.
N/A366 if (QueueCheck())
N/A367 return
N/A368 
N/A369 //Do the ding if nothing's queued and the previous scene requires a ding
N/A370 if (!inst.waitNoDingOff)
N/A371 EntFireByHandle( sceneDingOff, "Start", "", 0.1, null, null )
N/A372 }
N/A373}
N/A374 
N/A375 
N/A376//Think function
N/A377function GladosThink()
N/A378{
N/A379 
N/A380 //Put debug stuff here!
N/A381 if (debug)
N/A382 {
N/A383 if (Time()-lastthink>debugInterval)
N/A384 {
N/A385 printldebug("===================GladosThink-> " + lastthink)
N/A386 lastthink = Time()
N/A387 QueueDebug()
N/A388 }
N/A389 }
N/A390 
N/A391 
N/A392 
N/A393 local idx, val
N/A394 foreach (idx,val in scenequeue)
N/A395 {
N/A396 //Check if current vcd is scheduled to exit early
N/A397 if (val.waitExitingEarly)
N/A398 {
N/A399 if (Time()-val.waitExitingEarlyStartTime >= val.waitExitingEarlyThreshold)
N/A400 {
N/A401 local team
N/A402 val.waitExitingEarly=false
N/A403 local curscene = characterCurscene(val.currentCharacter)
N/A404 if (curscene!=null)
N/A405 {
N/A406 curscene.ValidateScriptScope()
N/A407 curscene.GetScriptScope().SkipOnCompletion <- SkipOnCompletion.bindenv(this)
N/A408 curscene.DisconnectOutput("OnCompletion", "PlayNextScene")
N/A409 curscene.DisconnectOutput("OnCompletion", "SkipOnCompletion")
N/A410 curscene.ConnectOutput( "OnCompletion", "SkipOnCompletion" )
N/A411 team = curscene.GetTeam()
N/A412 val.waitVcdCurrent = findIndex(team)
N/A413 }
N/A414 printldebug("====EXITING EARLY!!!!!!!")
N/A415 PlayNextSceneInternal(val)
N/A416 return
N/A417 }
N/A418 }
N/A419 }
N/A420 
N/A421 local tmp
N/A422 //Check the deferred scene queue
N/A423 tmp = QueueThink()
N/A424 //Is a queued scene ready to fire?
N/A425 if (tmp != null)
N/A426 {
N/A427 printldebug("===========Forcing a queued Scene!!!!========")
N/A428 GladosPlayVcd(tmp,true)
N/A429 return
N/A430 }
N/A431 
N/A432 foreach (idx,val in scenequeue)
N/A433 {
N/A434 //Are we waiting to play another vcd?
N/A435 if (val.waiting == 1)
N/A436 {
N/A437 if (Time()-val.waitStartTime >= val.waitLength)
N/A438 {
N/A439 val.waiting = 0
N/A440 GladosPlayVcd(val)
N/A441 }
N/A442 }
N/A443 }
N/A444 
N/A445 if (curMapName=="mp_coop_start" && BluePingStartDone==1){
N/A446 local curTime=Time()
N/A447 local BluePingStartInterval = curTime - BluePingStartTimer
N/A448 if (BluePingStartInterval>20){
N/A449 BluePingStartTimer=Time()
N/A450 GladosPlayVcd(1331)
N/A451 }
N/A452 }
N/A453 if (curMapName=="mp_coop_start" && OrangePingStartDone==1){
N/A454 local curTime=Time()
N/A455 local OrangePingStartInterval = curTime - OrangePingStartTimer
N/A456 if (OrangePingStartInterval>20){
N/A457 OrangePingStartTimer=Time()
N/A458 GladosPlayVcd(1332)
N/A459 }
N/A460 }
N/A461 
N/A462 if (GladosInsideTauntCam == 1){
N/A463 local curTime=Time()
N/A464 local tauntreactionfired = 0
N/A465 local GladosInsideTauntCamInterval = curTime-GladosInsideTauntCamLastInterval
N/A466 printldebug("=================================== CAM INTERVAL:"+GladosInsideTauntCamCounter+" - "+GladosInsideTauntCamInterval+" - "+GladosInsideTauntCam)
N/A467 if (GladosInsideTauntCamInterval>8 || GladosInsideTauntCamCounter==1){
N/A468 if (BlueTauntCam==1 && OrangeTauntCam==0){
N/A469 if (curTime-BlueTauntFinaleInterval<5){
N/A470 tauntreactionfired = 1
N/A471 GladosInsideTauntCamLastInterval=Time()-6
N/A472 GladosPlayVcd(1194)
N/A473 }
N/A474 }
N/A475 
N/A476 if (BlueTauntCam==0 && OrangeTauntCam==1){
N/A477 if (curTime-OrangeTauntFinaleInterval<5){
N/A478 tauntreactionfired = 1
N/A479 GladosInsideTauntCamLastInterval=Time()-6
N/A480 GladosPlayVcd(1195)
N/A481 }
N/A482 }
N/A483 
N/A484 if (tauntreactionfired == 0){
N/A485 switch (GladosInsideTauntCamCounter)
N/A486 {
N/A487 case 1:
N/A488 GladosPlayVcd(1156)
N/A489 GladosInsideTauntCamCounter=GladosInsideTauntCamCounter+1
N/A490 GladosInsideTauntCamLastInterval=Time()
N/A491 // this is where we want to count completing paint_longjump
N/A492 EndSpeedRunTimer()
N/A493 break
N/A494 
N/A495 case 2:
N/A496 GladosPlayVcd(1166)
N/A497 GladosInsideTauntCamCounter=GladosInsideTauntCamCounter+1
N/A498 GladosInsideTauntCamLastInterval=Time()
N/A499 break
N/A500 case 3:
N/A501 GladosPlayVcd(1165)
N/A502 GladosInsideTauntCamCounter=GladosInsideTauntCamCounter+1
N/A503 GladosInsideTauntCamLastInterval=Time()
N/A504 break
N/A505 case 4:
N/A506 GladosPlayVcd(1167)
N/A507 GladosInsideTauntCamCounter=GladosInsideTauntCamCounter+1
N/A508 GladosInsideTauntCamLastInterval=Time()
N/A509 break
N/A510 case 5:
N/A511 GladosPlayVcd(1168)
N/A512 GladosInsideTauntCamCounter=GladosInsideTauntCamCounter+1
N/A513 GladosInsideTauntCamLastInterval=Time()
N/A514 break
N/A515 case 6:
N/A516 GladosPlayVcd(1158)
N/A517 GladosInsideTauntCamCounter=GladosInsideTauntCamCounter+1
N/A518 GladosInsideTauntCamLastInterval=Time()
N/A519 break
N/A520 case 7:
N/A521 GladosPlayVcd(1157)
N/A522 GladosInsideTauntCamCounter=GladosInsideTauntCamCounter+1
N/A523 GladosInsideTauntCamLastInterval=Time()
N/A524 break
N/A525 case 8:
N/A526 GladosPlayVcd(1169)
N/A527 GladosInsideTauntCamCounter=GladosInsideTauntCamCounter+1
N/A528 GladosInsideTauntCamLastInterval=Time()
N/A529 break
N/A530 case 9:
N/A531 GladosPlayVcd(1159)
N/A532 GladosInsideTauntCamCounter=GladosInsideTauntCamCounter+1
N/A533 GladosInsideTauntCamLastInterval=Time()
N/A534 break
N/A535 case 10:
N/A536 GladosPlayVcd(1160)
N/A537 GladosInsideTauntCamCounter=GladosInsideTauntCamCounter+1
N/A538 GladosInsideTauntCamLastInterval=Time()
N/A539 break
N/A540 case 11:
N/A541 GladosPlayVcd(1164)
N/A542 GladosInsideTauntCamCounter=GladosInsideTauntCamCounter+1
N/A543 GladosInsideTauntCamLastInterval=Time()
N/A544 break
N/A545 case 12:
N/A546 GladosPlayVcd(1163)
N/A547 GladosInsideTauntCamCounter=1
N/A548 GladosInsideTauntCamLastInterval=Time()
N/A549 break
N/A550 }
N/A551 }
N/A552 
N/A553 }
N/A554 
N/A555 }
N/A556 
N/A557 
N/A558}
N/A559 
N/A560function GladosBlowUpBots()
N/A561{
N/A562 // this calls the function in game code
N/A563 CoopGladosBlowUpBots()
N/A564}
N/A565 
N/A566function GladosEndingTauntCam_Begin(){
N/A567 GladosInsideTauntCam =1
N/A568}
N/A569 
N/A570function GladosEndingTauntCam_End(){
N/A571 GladosInsideTauntCam =0
N/A572}
N/A573 
N/A574 
N/A575//Play a vcd from the SceneTable, plus set up next line (if any).
N/A576//This is the function that should be used to start a scene from inside a map.
N/A577function GladosPlayVcd(arg,IgnoreQueue = null, caller = null)
N/A578//arg==instance -> Continue playing scene defined by scene class instance arg
N/A579//arg==integer -> Start playing new scene (scene being a chain of vcds) from SceneTable[SceneTableLookup[arg]]
N/A580//arg==string -> Start playing new scene (scene being a chain of vcds) from SceneTable[arg]
N/A581//arg==null -> Continue playing current scene with next vcd in current chain
N/A582//IgnoreQueue -> true == don't check for queue status (this is used to force a queued vcd to play)
N/A583//caller -> If passed as an entity, the vcd will have its "target1" set to caller.GetName()
N/A584{
N/A585 printldebug("=========GladosPlayVcd Called!=========")
N/A586 local dingon = false
N/A587 local inst
N/A588 local fromqueue = firedfromqueue
N/A589 firedfromqueue = false
N/A590 if (curMapName=="mp_coop_start" ){
N/A591 if (arg==30){
N/A592 BluePingStartDone=1
N/A593 BluePingStartTimer=Time()+15
N/A594 }
N/A595 if (arg==32){
N/A596 BluePingStartDone=2
N/A597 OrangePingStartDone=1
N/A598 OrangePingStartTimer=Time()+25
N/A599 }
N/A600 if (arg==34){
N/A601 OrangePingStartDone=2
N/A602 }
N/A603 }
N/A604 
N/A605 
N/A606 if (typeof arg == "instance")
N/A607 {
N/A608 inst = arg
N/A609 arg=inst.waitNext
N/A610 }
N/A611 else
N/A612 {
N/A613 //If this is a call from the map, look up the integer arg in the scene lookup table.
N/A614 //We need to do this because hammer/the engine can't pass a squirrel script a string, just an integer.
N/A615 //In other words, from a map, @glados.GladosPlayVcd("MyVcd") crashes the game. GladosPlayVcd(16) doesn't.
N/A616 local sceneStart = 0
N/A617 if (typeof arg == "integer")
N/A618 {
N/A619 sceneStart = arg
N/A620 printldebug("{}{}{}{}{}{}{}{}{}GladosPlayVcd: "+arg)
N/A621 arg = SceneTableLookup[arg]
N/A622 }
N/A623 else
N/A624 {
N/A625 sceneStart = 0
N/A626 }
N/A627 //if SkipIfBusy is present & we're already playing a scene, skip this new scene
N/A628 if ("skipifbusy" in SceneTable[arg])
N/A629 {
N/A630 if (!("char" in SceneTable[arg])){
N/A631 SceneTable[arg].char <- "glados"
N/A632 }
N/A633 
N/A634 if (characterCurscene(SceneTable[arg].char)!=null)
N/A635 {
N/A636 return
N/A637 }
N/A638 }
N/A639 //if queue is present & we're already playing a scene, add scene to queue
N/A640 if ("queue" in SceneTable[arg])
N/A641 {
N/A642 if (IgnoreQueue == null)
N/A643 {
N/A644 //queue if a specific character is talking
N/A645 if ("queuecharacter" in SceneTable[arg])
N/A646 {
N/A647 if (characterCurscene(SceneTable[arg].queuecharacter)!=null)
N/A648 {
N/A649 QueueAdd(arg)
N/A650 return
N/A651 }
N/A652 }
N/A653 //otherwise, queue if the character associated with the vcd is talking
N/A654 else
N/A655 {
N/A656 if (!("char" in SceneTable[arg])){
N/A657 SceneTable[arg].char <- "glados"
N/A658 }
N/A659 
N/A660 if (characterCurscene(SceneTable[arg].char)!=null)
N/A661 {
N/A662 QueueAdd(arg)
N/A663 return
N/A664 }
N/A665 }
N/A666 }
N/A667 }
N/A668 if (!("char" in SceneTable[arg])){
N/A669 SceneTable[arg].char <- "glados"
N/A670 }
N/A671 if (scenequeue_AddScene(arg,SceneTable[arg].char) == null)
N/A672 return
N/A673 inst = scenequeue[arg]
N/A674 inst.waitSceneStart = sceneStart
N/A675 
N/A676 if ("idle" in SceneTable[arg])
N/A677 {
N/A678 nags_init(inst,arg)
N/A679 }
N/A680 
N/A681 //This is a new dialog block, so turn off special processing
N/A682 dingon=true
N/A683 pitchShifting = false
N/A684 //startBlock = Time()
N/A685 if ("noDingOff" in SceneTable[arg])
N/A686 inst.waitNoDingOff = true
N/A687 else
N/A688 inst.waitNoDingOff = false
N/A689 if ("noDingOn" in SceneTable[arg])
N/A690 inst.waitNoDingOn = true
N/A691 else
N/A692 inst.waitNoDingOn = false
N/A693 }
N/A694 
N/A695 //If this scene is a nag/idle cycle, grab the next line off the stack
N/A696 if (inst.isNag)
N/A697 {
N/A698 //If we're not in a vcd chain, grab the next vcd from the randomized pool
N/A699 if (!inst.naginchain)
N/A700 {
N/A701 arg = nags_fetch(inst)
N/A702 }
N/A703 //if nothing fetched (because the nag has used all the lines and isn't marked as "repeat"), remove this scene
N/A704 if (arg == null)
N/A705 {
N/A706 scenequeue_DeleteScene(inst.index)
N/A707 return
N/A708 }
N/A709 }
N/A710 
N/A711 //Set ducking volume correctly for booming glados audio
N/A712 SendToConsole( "snd_ducktovolume 0.2" )
N/A713 
N/A714 //SetDucking( "announcerVOLayer", "announcerVO", 0.01 )
N/A715 //SetDucking( "gladosVOLayer", "gladosVO", 0.1 )
N/A716 
N/A717 local preDelay = 0.00
N/A718 preDelay = EvaluateTimeKey("predelay", SceneTable[arg])
N/A719 if (fromqueue && "queuepredelay" in SceneTable[arg])
N/A720 {
N/A721 preDelay = EvaluateTimeKey("queuepredelay", SceneTable[arg])
N/A722 }
N/A723 
N/A724 if ( arg != null )
N/A725 {
N/A726 
N/A727 local ltalkover
N/A728 ltalkover = "talkover" in SceneTable[arg]
N/A729 
N/A730 //Cancel any vcd that's already playing
N/A731 if (!ltalkover)
N/A732 {
N/A733 GladosAllCharactersStopScene()
N/A734 }
N/A735 else
N/A736 {
N/A737 //characters can't currently talk over themselves
N/A738 if (!("char" in SceneTable[arg])){
N/A739 SceneTable[arg].char <- "glados"
N/A740 }
N/A741 GladosCharacterStopScene(SceneTable[arg].char)
N/A742 }
N/A743 
N/A744 //Play the initial ding (unless the scene specifically requests no ding)
N/A745 if (dingon && !inst.waitNoDingOn)
N/A746 EntFireByHandle( sceneDingOn, "Start", "", preDelay, null, null )
N/A747 
N/A748 
N/A749 //Start the new vcd
N/A750 printldebug("===================Playing:" + arg)
N/A751 if (!("char" in SceneTable[arg])){
N/A752 SceneTable[arg].char <- "glados"
N/A753 }
N/A754 
N/A755 inst.currentCharacter = SceneTable[arg].char
N/A756 
N/A757 //Bind the OnCompletion Event
N/A758 SceneTable[arg].vcd.ValidateScriptScope()
N/A759 SceneTable[arg].vcd.GetScriptScope().PlayNextScene <- PlayNextScene.bindenv(this)
N/A760 SceneTable[arg].vcd.DisconnectOutput( "OnCompletion", "PlayNextScene" )
N/A761 SceneTable[arg].vcd.ConnectOutput( "OnCompletion", "PlayNextScene" )
N/A762 SceneTable[arg].vcd.ConnectOutput( "OnCanceled", "SceneCanceled" )
N/A763 
N/A764 //Set the target1 if necessary
N/A765 if (caller != null)
N/A766 {
N/A767 if (typeof caller == "string")
N/A768 {
N/A769 EntFireByHandle( SceneTable[arg].vcd, "SetTarget1", caller, 0, null, null )
N/A770 printldebug("++++++++++++SETTING TARGET: "+caller)
N/A771 }
N/A772 else
N/A773 {
N/A774 EntFireByHandle( SceneTable[arg].vcd, "SetTarget1", caller.GetName(), 0, null, null )
N/A775 }
N/A776 }
N/A777 if ("settarget1" in SceneTable[arg])
N/A778 {
N/A779 EntFireByHandle( SceneTable[arg].vcd, "SetTarget1", SceneTable[arg].settarget1 , 0, null, null )
N/A780 }
N/A781 
N/A782 inst.waitVcdTeam = SceneTable[arg].index
N/A783 inst.waitVcdCurrent = arg
N/A784 
N/A785 inst.addFiredVcd(SceneTable[arg].index)
N/A786 
N/A787 if (dingon && !inst.waitNoDingOn)
N/A788 EntFireByHandle( SceneTable[arg].vcd, "Start", "", preDelay+0.18, null, null )
N/A789 else
N/A790 EntFireByHandle( SceneTable[arg].vcd, "Start", "", preDelay, null, null )
N/A791 
N/A792 
N/A793 //Does this vcd have a "fire into entities" array?
N/A794 if ("fires" in SceneTable[arg])
N/A795 {
N/A796 local idx, val
N/A797 foreach (idx, val in SceneTable[arg].fires)
N/A798 {
N/A799 if ("fireatstart" in val)
N/A800 {
N/A801 printldebug(">>>>>>ENT FIRE AT START: "+val.entity+":"+val.input)
N/A802 EntFire(val.entity,val.input,val.parameter, val.delay)
N/A803 }
N/A804 }
N/A805 }
N/A806 
N/A807 if ("special" in SceneTable[arg])
N/A808 {
N/A809 switch (SceneTable[arg].special)
N/A810 {
N/A811 case 1: //Block-wide pitch shifting
N/A812 pitchShifting = true
N/A813 break
N/A814 case 2: //Speed up
N/A815 if (pitchOverride == null)
N/A816 EntFireByHandle( SceneTable[arg].vcd, "PitchShift", "2.5", 0, null, null )
N/A817 break
N/A818 case 3: //Slow down a bit
N/A819 EntFireByHandle( SceneTable[arg].vcd, "PitchShift", "0.9", 0, null, null )
N/A820 break
N/A821 }
N/A822 }
N/A823 if (pitchOverride!=null)
N/A824 EntFireByHandle( SceneTable[arg].vcd, "PitchShift", pitchOverride.tostring(), 0, null, null )
N/A825 
N/A826 //Setup next line (if there is one)
N/A827 if (SceneTable[arg].next != null || inst.isNag)
N/A828 {
N/A829 local pdelay = EvaluateTimeKey("postdelay",SceneTable[arg])
N/A830 
N/A831 //if this is a nag, use min/max defined in the first entry in the scene
N/A832 if (inst.isNag)
N/A833 {
N/A834 pdelay = RandomFloat(inst.nagminsecs,inst.nagmaxsecs)
N/A835 }
N/A836 
N/A837 if (pdelay<0.00)
N/A838 {
N/A839 if (inst.isNag)
N/A840 //If the "next" key != null, it means we're in a vcd chain
N/A841 if (SceneTable[arg].next != null)
N/A842 {
N/A843 inst.waitNext = SceneTable[arg].next
N/A844 inst.naginchain = true
N/A845 }
N/A846 else
N/A847 {
N/A848 //Otherwise, just slug in the same index (any non-null value would work here, however)
N/A849 inst.waitNext = arg
N/A850 inst.naginchain = false
N/A851 }
N/A852 else
N/A853 inst.waitNext = SceneTable[arg].next
N/A854 inst.waitExitingEarly=true
N/A855 inst.waitLength=null
N/A856 inst.waitExitingEarlyStartTime=Time()
N/A857 //If we're in a nag vcd chain, use the vcds postdelay rather than the nag-wide delay
N/A858 //This is because vcd chains generally need to be explicitly timed at the chain level
N/A859 //since the vcds are grouped together as a block
N/A860 if (inst.naginchain)
N/A861 pdelay = EvaluateTimeKey("postdelay",SceneTable[arg])
N/A862 inst.waitExitingEarlyThreshold=pdelay*-1
N/A863 }
N/A864 else
N/A865 {
N/A866 inst.waitExitingEarly=false
N/A867 if (inst.isNag)
N/A868 {
N/A869 //If the "next" key != null, it means we're in a vcd chain
N/A870 if (SceneTable[arg].next != null)
N/A871 {
N/A872 inst.waitNext = SceneTable[arg].next
N/A873 inst.naginchain = true
N/A874 }
N/A875 else
N/A876 {
N/A877 //Otherwise, just slug in the same index (any non-null value would work here, however)
N/A878 inst.waitNext = arg
N/A879 inst.naginchain = false
N/A880 }
N/A881 }
N/A882 else
N/A883 {
N/A884 inst.waitNext = SceneTable[arg].next
N/A885 }
N/A886 //If we're in a nag vcd chain, use the vcds postdelay rather than the nag-wide delay
N/A887 //This is because vcd chains generally need to be explicitly timed at the chain level
N/A888 //since the vcds are grouped together as a block
N/A889 if (inst.naginchain)
N/A890 pdelay = EvaluateTimeKey("postdelay",SceneTable[arg])
N/A891 }
N/A892 inst.waitLength = pdelay
N/A893 }
N/A894 else
N/A895 {
N/A896 inst.waitNext = null
N/A897 printldebug("===================SCENE END")
N/A898 }
N/A899 }
N/A900}
N/A901 
N/A902function EvaluateTimeKey(keyname, keytable)
N/A903{
N/A904 local ret = null
N/A905 
N/A906 if (keyname in keytable)
N/A907 {
N/A908 local typ = typeof keytable[keyname]
N/A909 if (typ == "array")
N/A910 {
N/A911 if (keytable[keyname].len() != 2)
N/A912 {
N/A913 printldebug("!!!!!!!!!!!!EVALUATE TIME KEY ERROR: "+keyname+" is an array with a length != 2")
N/A914 return 0.00
N/A915 }
N/A916 ret = RandomFloat(keytable[keyname][0],keytable[keyname][1])
N/A917 }
N/A918 else
N/A919 {
N/A920 ret = keytable[keyname]
N/A921 }
N/A922 }
N/A923 if (ret == null)
N/A924 ret = 0.00
N/A925 printldebug(">>>>>>>>>EVALUATE TIME KEY: "+keyname+" : "+ret)
N/A926 return ret
N/A927}
N/A928 
N/A929 
N/A930function GladosToggleDebug(arg = null)
N/A931{
N/A932 debug = !debug
N/A933 if (debug)
N/A934 printl("======================GLaDOS debug ON")
N/A935 else
N/A936 printl("======================GLaDOS debug OFF")
N/A937 if (arg!=null)
N/A938 debugInterval = arg
N/A939}
N/A940 
N/A941function GladosSetPitch(arg)
N/A942{
N/A943 pitchOverride = arg
N/A944 local curscene = self.GetCurrentScene()
N/A945 if ( curscene != null )
N/A946 EntFireByHandle( curscene, "PitchShift", pitchOverride.tostring(), 0, null, null )
N/A947}
N/A948 
N/A949 
N/A950//Stops a scene for all characters
N/A951function GladosAllCharactersStopScene()
N/A952{
N/A953 GladosCharacterStopScene("glados")
N/A954 GladosCharacterStopScene("wheatley")
N/A955 GladosCharacterStopScene("cave_body")
N/A956}
N/A957 
N/A958function characterCurscene(arg)
N/A959{
N/A960 local ret = null, ent = null
N/A961 switch (arg)
N/A962 {
N/A963 case "glados":
N/A964 case "@glados":
N/A965 ent = Entities.FindByName(ent, "@glados")
N/A966 break
N/A967 case "@sphere":
N/A968 case "wheatley":
N/A969 case "sphere":
N/A970 ent = Entities.FindByName(ent, "@sphere")
N/A971 break
N/A972 case "cave_body":
N/A973 case "cavebody":
N/A974 ent = Entities.FindByName(ent, "@cave_body")
N/A975 break
N/A976 }
N/A977 if (ent != null)
N/A978 {
N/A979 ret = ent.GetCurrentScene()
N/A980 }
N/A981 return ret
N/A982}
N/A983 
N/A984//Stops a scene for a particular character
N/A985function GladosCharacterStopScene(arg)
N/A986{
N/A987 local ent = null
N/A988 local curscene = characterCurscene(arg)
N/A989 if ( curscene != null )
N/A990 {
N/A991 EntFireByHandle( curscene, "Cancel", "", 0, null, null )
N/A992 }
N/A993}
N/A994 
N/A995//Turns off current Glados speech
N/A996function GladosStopTalking()
N/A997{
N/A998 local curscene = self.GetCurrentScene()
N/A999 pitchOverride = null
N/A1000 waitNext = null
N/A1001 waitLength = null
N/A1002 if ( curscene != null )
N/A1003 EntFireByHandle( curscene, "Cancel", "", 0, null, null )
N/A1004}
N/A1005 
N/A1006//Turns off current Glados speech if the scene # passed as arg is currently playing
N/A1007function GladosStopScene(arg)
N/A1008{
N/A1009 if (waitSceneStart == arg)
N/A1010 {
N/A1011 local curscene = self.GetCurrentScene()
N/A1012 pitchOverride = null
N/A1013 waiting = 0
N/A1014 waitNext = null
N/A1015 waitLength = null
N/A1016 if ( curscene != null )
N/A1017 EntFireByHandle( curscene, "Cancel", "", 0, null, null )
N/A1018 }
N/A1019}
N/A1020 
N/A1021//Slowfield functions
N/A1022function GladosEndSlowFieldTraining()
N/A1023{
N/A1024 stateSlowFieldTraining = false
N/A1025 GladosStopTalking()
N/A1026}
N/A1027 
N/A1028function GladosStartSlowFieldTraining()
N/A1029{
N/A1030 stateSlowFieldTraining = true
N/A1031 GladosPlayVcd(40)
N/A1032}
N/A1033 
N/A1034function GladosSlowFieldOn()
N/A1035{
N/A1036 if (stateSlowFieldTraining)
N/A1037 GladosPlayVcd(41)
N/A1038}
N/A1039 
N/A1040function GladosSlowFieldOff()
N/A1041{
N/A1042 if (stateSlowFieldTraining)
N/A1043 GladosPlayVcd(40)
N/A1044}
N/A1045//End of Slowfield functions
N/A1046 
N/A1047//Special Chamber Processing
N/A1048function GladosRelaxationVaultPowerUp()
N/A1049{
N/A1050 EntFire("open_portal_relay","Trigger","", 0.00)
N/A1051}
N/A1052 
N/A1053 
N/A1054//--------------------------------------------------------------------------------------------------------------
N/A1055//Queue Functions
N/A1056//--------------------------------------------------------------------------------------------------------------
N/A1057 
N/A1058Queue <- []
N/A1059 
N/A1060//Initialize the queue
N/A1061function QueueInitialize()
N/A1062{
N/A1063 Queue.clear()
N/A1064}
N/A1065 
N/A1066//Add a scene to the queue
N/A1067function QueueAdd(arg)
N/A1068{
N/A1069 Queue.append( { item = arg added = Time() })
N/A1070 if (arg in SceneTable)
N/A1071 {
N/A1072 if ("queueforcesecs" in SceneTable[arg])
N/A1073 {
N/A1074 Queue[Queue.len()-1].queueforcesecs <- SceneTable[arg].queueforcesecs
N/A1075 }
N/A1076 if ("queuetimeout" in SceneTable[arg])
N/A1077 {
N/A1078 Queue[Queue.len()-1].queuetimeout <- SceneTable[arg].queuetimeout
N/A1079 }
N/A1080 if ("queuepredelay" in SceneTable[arg])
N/A1081 {
N/A1082 Queue[Queue.len()-1].queuepredelay <- SceneTable[arg].queuepredelay
N/A1083 }
N/A1084 
N/A1085 }
N/A1086}
N/A1087 
N/A1088//Returns number of items in the queue
N/A1089function QueueLen()
N/A1090{
N/A1091 return Queue.len()
N/A1092}
N/A1093 
N/A1094 
N/A1095//Fetch the next scene in the queue
N/A1096function QueueGetNext()
N/A1097{
N/A1098 local ret,l
N/A1099 ret = null
N/A1100 l=QueueLen()
N/A1101 if (l>0)
N/A1102 {
N/A1103 ret = Queue[l-1].item
N/A1104 Queue.remove(l-1)
N/A1105 }
N/A1106 return ret
N/A1107}
N/A1108 
N/A1109function QueueDebug()
N/A1110{
N/A1111 printldebug("=================== items in queue-> " + Queue.len())
N/A1112}
N/A1113 
N/A1114//General stuff called from GladosThink()
N/A1115function QueueThink()
N/A1116{
N/A1117 local ret,t,index
N/A1118 if (QueueLen()==0)
N/A1119 {
N/A1120 return null
N/A1121 }
N/A1122 
N/A1123 t=Time()
N/A1124 //Check to see if any queued scenes timed out
N/A1125 for (index = QueueLen(); index > 0; index -= 1)
N/A1126 {
N/A1127 if ("queuetimeout" in Queue[index-1])
N/A1128 {
N/A1129 if (t-Queue[index-1].added > Queue[index-1].queuetimeout)
N/A1130 {
N/A1131 Queue.remove(index-1)
N/A1132 }
N/A1133 }
N/A1134 }
N/A1135 
N/A1136 //Check to see if any queued scenes should force fire
N/A1137 foreach (index, scene in Queue)
N/A1138 {
N/A1139 if ("queueforcesecs" in scene)
N/A1140 {
N/A1141 if (t-scene.added >scene.queueforcesecs)
N/A1142 {
N/A1143 ret = scene.item
N/A1144 Queue.remove(index)
N/A1145 return ret
N/A1146 }
N/A1147 }
N/A1148 }
N/A1149 return null
N/A1150}
N/A1151 
N/A1152//Debug testbed function
N/A1153function QueueTest()
N/A1154{
N/A1155 local a = []
N/A1156 for(local i=0;i<10;i+=1)
N/A1157 {
N/A1158 a.append(RandomInt(1,100))
N/A1159 printldebug(">>>>>> " + i + " : " + a[i])
N/A1160 }
N/A1161 for (local i = a.len(); i>0; i-=1)
N/A1162 {
N/A1163 if (a[i-1]<50)
N/A1164 a.remove(i-1)
N/A1165 }
N/A1166 foreach (index, n in a)
N/A1167 {
N/A1168 printldebug(">>>>>> " + index + " : " + a[index])
N/A1169 }
N/A1170}
N/A1171 
N/A1172//Delete a single item from the queue
N/A1173function QueueDeleteItem(item)
N/A1174{
N/A1175 if (QueueLen()==0)
N/A1176 {
N/A1177 return false
N/A1178 }
N/A1179 foreach (index, scene in Queue)
N/A1180 {
N/A1181 if (scene.item == item)
N/A1182 {
N/A1183 Queue.remove(index)
N/A1184 return true
N/A1185 }
N/A1186 }
N/A1187 return false
N/A1188}
N/A1189 
N/A1190 
N/A1191//Check to see if there's a Queued scene ready to go. If so, fire it! (and return true)
N/A1192function QueueCheck()
N/A1193{
N/A1194 local tmp
N/A1195 if (QueueLen()>0)
N/A1196 {
N/A1197 tmp=QueueGetNext()
N/A1198 if (tmp != null)
N/A1199 {
N/A1200 firedfromqueue = true
N/A1201 GladosPlayVcd(tmp,true)
N/A1202 //GladosPlayVcd(tmp)
N/A1203 return true
N/A1204 }
N/A1205 }
N/A1206 return false
N/A1207}
N/A1208 
N/A1209//--------------------------------------------------------------------------------------------------------------
N/A1210//End of Queue Functions
N/A1211//--------------------------------------------------------------------------------------------------------------
N/A1212 
N/A1213//--------------------------------------------------------------------------------------------------------------
N/A1214//sp_sabotage_jailbreak specific functions
N/A1215//--------------------------------------------------------------------------------------------------------------
N/A1216 
N/A1217function jailbreak_alert(arg)
N/A1218{
N/A1219 jailbreakpos =arg
N/A1220 printldebug("==========JAILBREAK ALERT "+arg)
N/A1221}
N/A1222 
N/A1223function jailbreak_whoah_speech()
N/A1224{
N/A1225 if (jailbreakpos == 0)
N/A1226 {
N/A1227 GladosPlayVcd(303)
N/A1228 }
N/A1229 else
N/A1230 {
N/A1231 GladosPlayVcd(302)
N/A1232 }
N/A1233}
N/A1234 
N/A1235 
N/A1236//--------------------------------------------------------------------------------------------------------------
N/A1237//sp_sabotage_darkness specific functions
N/A1238//--------------------------------------------------------------------------------------------------------------
N/A1239 
N/A1240 
N/A1241function PlayGhostStory()
N/A1242{
N/A1243 GladosPlayVcd(445)
N/A1244}
N/A1245 
N/A1246function PlaySmellyHumansOne()
N/A1247{
N/A1248 GladosPlayVcd(446)
N/A1249}
N/A1250 
N/A1251function PlaySmellyHumansTwo()
N/A1252{
N/A1253 GladosPlayVcd(447)
N/A1254}
N/A1255 
N/A1256function PlaySmellyHumansThree()
N/A1257{
N/A1258 GladosPlayVcd(448)
N/A1259}
N/A1260 
N/A1261function PlaySmellyHumansFour()
N/A1262{
N/A1263 GladosPlayVcd(449)
N/A1264}
N/A1265 
N/A1266 
N/A1267//--------------------------------------------------------------------------------------------------------------
N/A1268//Glados Battle specific functions
N/A1269//--------------------------------------------------------------------------------------------------------------
N/A1270 
N/A1271function sp_sabotage_glados_specials(arg)
N/A1272{
N/A1273 switch (arg)
N/A1274 {
N/A1275 case 1:
N/A1276 SendToConsole( "scene_playvcd npc/sphere03/fgb_ready_glados06")
N/A1277 break
N/A1278 case 2:
N/A1279 //SendToConsole( "scene_playvcd npc/sphere03/gladosbattle_pre09")
N/A1280 SendToConsole( "scene_playvcd npc/sphere03/fgb_pull_me_out01")
N/A1281 break
N/A1282 }
N/A1283}
N/A1284 
N/A1285glados_gibbering <- false
N/A1286glados_gibbering_start <- Time()
N/A1287glados_gibbering_next <- 0.00
N/A1288glados_gibbering_times <- {}
N/A1289 
N/A1290glados_gibbering_times[1] <- 0.7
N/A1291glados_gibbering_times[2] <- 1.37
N/A1292glados_gibbering_times[3] <- 1.22
N/A1293glados_gibbering_times[4] <- 1.27
N/A1294glados_gibbering_times[5] <- 5.29
N/A1295glados_gibbering_times[6] <- 4.15
N/A1296glados_gibbering_times[7] <- 3.35
N/A1297 
N/A1298 
N/A1299 
N/A1300function sp_sabotage_glados_start_gibberish()
N/A1301{
N/A1302 //gibberish is off for now
N/A1303 //glados_gibbering = true
N/A1304 glados_gibbering_start = Time()
N/A1305 glados_gibbering_next = 0.00
N/A1306}
N/A1307 
N/A1308function sp_sabotage_glados_stop_gibberish()
N/A1309{
N/A1310 glados_gibbering = false
N/A1311}
N/A1312 
N/A1313function sp_sabotage_glados_gibberish()
N/A1314{
N/A1315 local i = RandomInt(1,7)
N/A1316 if (Time() - glados_gibbering_start > glados_gibbering_next)
N/A1317 {
N/A1318 SendToConsole( "scene_playvcd npc/glados/sp_sabotage_glados_gibberish0"+i)
N/A1319 glados_gibbering_start = Time()
N/A1320 //glados_gibbering_next = RandomFloat(3.5, 5.0)
N/A1321 glados_gibbering_next = glados_gibbering_times[i]
N/A1322 }
N/A1323}
N/A1324 
N/A1325 
N/A1326 
N/A1327// ==============================
N/A1328// player starts vault trap
N/A1329// ==============================
N/A1330function VaultTrapStart()
N/A1331{
N/A1332 GladosPlayVcd(-50)
N/A1333}
N/A1334 
N/A1335// ==============================
N/A1336// player begins moving in relaxation vault
N/A1337// ==============================
N/A1338function VaultTrapStartMoving()
N/A1339{
N/A1340 GladosPlayVcd(-53)
N/A1341}
N/A1342 
N/A1343// ==============================
N/A1344// turrets are on the ground and begin their scene
N/A1345// ==============================
N/A1346function TurretScene()
N/A1347{
N/A1348 GladosPlayVcd(-700)
N/A1349}
N/A1350 
N/A1351// ==============================
N/A1352// ==============================
N/A1353function TurretDeathReactionDialog()
N/A1354{
N/A1355 GladosPlayVcd(-57)
N/A1356 //gladosbattle_pre_05 // my turrets!
N/A1357 //gladosbattle_pre_06 // oh, you were busy back there
N/A1358 //gladosbattle_pre_17 // i suppose we could just sit here and glare ... but i have a better idea
N/A1359}
N/A1360 
N/A1361 
N/A1362 
N/A1363// ==============================
N/A1364// ==============================
N/A1365function WheatleyBouncingDownTubeDialog()
N/A1366{
N/A1367 // play various "ouch.. oof... ow..." lines here
N/A1368 // play glados dialog responding to wheatley falling. "...sigh..."
N/A1369}
N/A1370 
N/A1371 
N/A1372// ==============================
N/A1373// ==============================
N/A1374function WheatleyLandsInChamberDialog()
N/A1375{
N/A1376 GladosPlayVcd(-61)
N/A1377 printldebug("==========HELLO!!!!!!!!!!!!!!!!!!!!!")
N/A1378 //wheatley - gladosbattle_pre01 // Hello!
N/A1379 //gladosbattle_pre_09 // i hate you so much
N/A1380}
N/A1381 
N/A1382// ==============================
N/A1383// ==============================
N/A1384function CoreDetectedDialog()
N/A1385{
N/A1386 //announcer - gladosbattle02 // warning: core corrupted
N/A1387 //glados - gladosbattle_xfer04 // that's funny i don't feel corrupted. in fact i feel pretty good
N/A1388 //announcer - gladosbattle03 // alternate core detected
N/A1389 //wheatley pre05 // ah that's me they're talking about!
N/A1390 //announcer - gladosbattle03 // to initiate a core transfer deposit core in receptacle
N/A1391 //ent_fire "deploy_core_receptacle_relay" trigger // deploys the core receptacle
N/A1392 //glados - gladosbattle_xfer05 // core transfer?
N/A1393 //glados - gladosbattle_xfer06 // oh you are kidding me
N/A1394 
N/A1395 // ********************************************************************************
N/A1396 // ********************************************************************************
N/A1397 // TODO - NAG: NEED NAG FOR 'INSERT CORE' TO PLAY UNTIL WheatleyCoreSocketed() GETS CALLED
N/A1398 // ********************************************************************************
N/A1399 // ********************************************************************************
N/A1400}
N/A1401 
N/A1402 
N/A1403// ==============================
N/A1404// ==============================
N/A1405function WheatleyCoreSocketed()
N/A1406{
N/A1407 // ********************************************************************************
N/A1408 // ********************************************************************************
N/A1409 // TODO - NAG: END 'INSERT CORE' NAG HERE
N/A1410 // ********************************************************************************
N/A1411 // ********************************************************************************
N/A1412 
N/A1413 GladosPlayVcd(-71) // announcer - substitute core accepted. core, are you willing to start the procedure?
N/A1414 
N/A1415 // ********************************************************************************
N/A1416 // ********************************************************************************
N/A1417 // TODO - NAG: BEGIN 'PRESS BUTTON' NAG HERE
N/A1418 // ********************************************************************************
N/A1419 // ********************************************************************************
N/A1420}
N/A1421 
N/A1422// ==============================
N/A1423// called when the player reaches a catapult or enters the room to press stalemate button
N/A1424// ==============================
N/A1425function StalemateAssociateNotSoFast()
N/A1426{
N/A1427 GladosPlayVcd(-84)
N/A1428}
N/A1429 
N/A1430 
N/A1431// ==============================
N/A1432// ==============================
N/A1433function CoreTransferInitiated()
N/A1434{
N/A1435 // ********************************************************************************
N/A1436 // ********************************************************************************
N/A1437 // TODO - NAG: END 'PRESS BUTTON' NAG HERE
N/A1438 // ********************************************************************************
N/A1439 // ********************************************************************************
N/A1440 
N/A1441 GladosPlayVcd(-88) //Stalemate Resolved. Core Transfer Initiated.
N/A1442}
N/A1443 
N/A1444// ==============================
N/A1445// ==============================
N/A1446function WheatleyCoreTransferStart()
N/A1447{
N/A1448 GladosPlayVcd(-4) // Here I go!
N/A1449}
N/A1450 
N/A1451// ==============================
N/A1452// ==============================
N/A1453function PitHandsGrabGladosHead()
N/A1454{
N/A1455 GladosPlayVcd(-89) // Get your hands off me!
N/A1456}
N/A1457 
N/A1458// ==============================
N/A1459// ==============================
N/A1460function PullGladosIntoPit()
N/A1461{
N/A1462 GladosPlayVcd(-90) // CHELL! STOP THIS! I AM YOUR MOTHER!
N/A1463}
N/A1464 
N/A1465// ==============================
N/A1466// ==============================
N/A1467function CoreTransferCompleted()
N/A1468{
N/A1469 GladosPlayVcd(-9) // Wow! Check ME out, Partner! .. Look how small you are!
N/A1470}
N/A1471 
N/A1472// ==============================
N/A1473// ==============================
N/A1474function PlayerEnteredElevator()
N/A1475{
N/A1476 GladosPlayVcd(-13) // Glados: Don't do this...
N/A1477}
N/A1478 
N/A1479 
N/A1480// ==============================
N/A1481// ==============================
N/A1482function DialogDuringPotatosManufacture()
N/A1483{
N/A1484 GladosPlayVcd(-33)
N/A1485}
N/A1486 
N/A1487// ==============================
N/A1488// ==============================
N/A1489function PotatosPresentation()
N/A1490{
N/A1491 GladosPlayVcd(-34)
N/A1492}
N/A1493 
N/A1494// ==============================
N/A1495// ==============================
N/A1496function ElevatorMoronScene()
N/A1497{
N/A1498 GladosPlayVcd(-37)
N/A1499}
N/A1500 
N/A1501// ==============================
N/A1502// ==============================
N/A1503function ElevatorConclusion()
N/A1504{
N/A1505 GladosPlayVcd(-44)
N/A1506}
N/A1507 
N/A1508 
N/A1509//--------------------------------------------------------------------------------------------------------------
N/A1510//sp_sabotage_factory functions
N/A1511//--------------------------------------------------------------------------------------------------------------
N/A1512 
N/A1513function sabotage_factory_WatchTheLine()
N/A1514{
N/A1515 GladosPlayVcd(441)
N/A1516}
N/A1517 
N/A1518function sabotage_factory_ReachedHackingSpot()
N/A1519{
N/A1520 GladosPlayVcd(442)
N/A1521}
N/A1522 
N/A1523function sabotage_factory_PlayerReachedWheatley()
N/A1524{
N/A1525 WheatleyStopNag()
N/A1526 GladosPlayVcd(443)
N/A1527}
N/A1528 
N/A1529function sabotage_factory_PlayerReachedExitDoor()
N/A1530{
N/A1531 WheatleyStopNag()
N/A1532 GladosPlayVcd(444)
N/A1533}
N/A1534 
N/A1535 
N/A1536//--------------------------------------------------------------------------------------------------------------
N/A1537//sp_sabotage_factory - Science Fair functions
N/A1538//--------------------------------------------------------------------------------------------------------------
N/A1539function ScienceFairGoingTheRightWay()
N/A1540{
N/A1541 GladosPlayVcd( -100 )
N/A1542}
N/A1543 
N/A1544function ScienceFairBringDaughter()
N/A1545{
N/A1546 GladosPlayVcd( -101 )
N/A1547}
N/A1548 
N/A1549function JustToReassureYou()
N/A1550{
N/A1551 GladosPlayVcd( -102 )
N/A1552}
N/A1553 
N/A1554function DefinitelySureThisWay()
N/A1555{
N/A1556 GladosPlayVcd( -103 )
N/A1557}
N/A1558 
N/A1559 
N/A1560//--------------------------------------------------------------------------------------------------------------
N/A1561//sp_catapult_fling_sphere_peek functions
N/A1562//--------------------------------------------------------------------------------------------------------------
N/A1563 
N/A1564function sp_catapult_fling_sphere_peek()
N/A1565{
N/A1566 switch (peekctr)
N/A1567 {
N/A1568 case 0:
N/A1569 GladosPlayVcd(335)
N/A1570 break
N/A1571 case 2:
N/A1572 GladosPlayVcd(362)
N/A1573 break
N/A1574 case 4:
N/A1575 GladosPlayVcd(363)
N/A1576 break
N/A1577 }
N/A1578 peekctr+=1
N/A1579}
N/A1580 
N/A1581 
N/A1582//--------------------------------------------------------------------------------------------------------------
N/A1583//New test functions
N/A1584//--------------------------------------------------------------------------------------------------------------
N/A1585function GladosTest1(arg)
N/A1586{
N/A1587 foreach (index, scene in arg)
N/A1588 {
N/A1589 if (scene.item)
N/A1590 {
N/A1591 arg.remove(index)
N/A1592 }
N/A1593 }
N/A1594}
N/A1595 
N/A1596 
N/A1597//--------------------------------------------------------------------------------------------------------------
N/A1598//Scene Queue Functions START
N/A1599//--------------------------------------------------------------------------------------------------------------
N/A1600 
N/A1601class scene {
N/A1602 //constructor
N/A1603 constructor(a, caller)
N/A1604 {
N/A1605 index = a
N/A1606 owner = caller
N/A1607 currentCharacter = ""
N/A1608 waitSceneStart = 0 //1 means we're waiting for the current vcd to finish so we can play the next vcd in the chain
N/A1609 waiting = 0
N/A1610 waitVcdCurrent = null
N/A1611 waitStartTime = Time()
N/A1612 waitLength = Time()
N/A1613 waitNext = null
N/A1614 waitExitingEarly = false
N/A1615 waitExitingEarlyStartTime = Time()
N/A1616 waitExitingEarlyThreshold = 0.00 //How many seconds sould the VCD play before moving on to the next one
N/A1617 waitNoDingOff = false
N/A1618 waitNoDingOn = false
N/A1619 waitVcdTeam = -1
N/A1620 waitFiredVcds = []
N/A1621 nagminsecs = 0
N/A1622 nagmaxsecs = 0
N/A1623 nags = []
N/A1624 isNag = false
N/A1625 nagpool = []
N/A1626 naglastfetched = null
N/A1627 nagrandom = false
N/A1628 nagrandomonrepeat = false
N/A1629 nagtimeslistcompleted = 0
N/A1630 nagrepeat = false
N/A1631 naginchain = false
N/A1632 }
N/A1633 
N/A1634 function nagsClear()
N/A1635 {
N/A1636 naglastfetched = null
N/A1637 nags.clear()
N/A1638 }
N/A1639 
N/A1640 function nagpoolClear()
N/A1641 {
N/A1642 nagpool.clear()
N/A1643 }
N/A1644 
N/A1645 
N/A1646 function addFiredVcd(team)
N/A1647 {
N/A1648 waitFiredVcds.append(team)
N/A1649 }
N/A1650 
N/A1651 function deleteFiredVcd(team)
N/A1652 {
N/A1653 local idx, val
N/A1654 local fnd = null
N/A1655 foreach (idx, val in waitFiredVcds)
N/A1656 {
N/A1657 if (val == team)
N/A1658 {
N/A1659 fnd = idx
N/A1660 break
N/A1661 }
N/A1662 }
N/A1663 if (fnd != null)
N/A1664 {
N/A1665 waitFiredVcds.remove(fnd)
N/A1666 }
N/A1667 }
N/A1668 
N/A1669 
N/A1670 //property
N/A1671 index = 0;
N/A1672 owner = null;
N/A1673 currentCharacter = "";
N/A1674 waitSceneStart = 0; //1 means we're waiting for the current vcd to finish so we can play the next vcd in the chain
N/A1675 waiting = 0;
N/A1676 waitVcdCurrent = null; //SceneTable index of last launched vcd
N/A1677 waitStartTime = 0;
N/A1678 waitLength = 0;
N/A1679 waitNext = null;
N/A1680 waitExitingEarly = false;
N/A1681 waitExitingEarlyStartTime = 0;
N/A1682 waitExitingEarlyThreshold = 0.00; //How many seconds sould the VCD play before moving on to the next one
N/A1683 waitNoDingOff = false;
N/A1684 waitNoDingOn = false;
N/A1685 waitFires = [];
N/A1686 waitVcdTeam = -1;
N/A1687 waitFiredVcds = [];
N/A1688 isNag = false;
N/A1689 nags = [];
N/A1690 nagpool = [];
N/A1691 nagminsecs = 0;
N/A1692 nagmaxsecs = 0;
N/A1693 naglastfetched = null;
N/A1694 nagrandom = false;
N/A1695 nagrandomonrepeat = false;
N/A1696 nagtimeslistcompleted = 0;
N/A1697 nagrepeat = false;
N/A1698 naginchain = false;
N/A1699}
N/A1700 
N/A1701 
N/A1702function scenequeue_AddScene(arg,char)
N/A1703{
N/A1704 local idx, val,delme
N/A1705 delme=null
N/A1706 foreach (idx, val in scenequeue)
N/A1707 {
N/A1708 if (SceneTable[idx].char==char)
N/A1709 {
N/A1710 delme = idx
N/A1711 }
N/A1712 if (idx == arg)
N/A1713 {
N/A1714 printldebug(">>>>>>>>>>Scene "+arg+" is already in the queue")
N/A1715 return null
N/A1716 }
N/A1717 }
N/A1718 if (delme != null)
N/A1719 {
N/A1720 printldebug(">>>>>>>>>>DELETING SCENE "+delme)
N/A1721 scenequeue_DeleteScene(delme)
N/A1722 }
N/A1723 scenequeue[arg] <- scene(arg, this)
N/A1724 scenequeue_Dump()
N/A1725 return scenequeue[arg]
N/A1726}
N/A1727 
N/A1728function scenequeue_DeleteScene(arg)
N/A1729{
N/A1730 local idx, val
N/A1731 foreach (idx, val in scenequeue)
N/A1732 {
N/A1733 if (idx == arg)
N/A1734 {
N/A1735 printldebug(">>>>>>>>>>Scene "+arg+" deleted!")
N/A1736 delete scenequeue[arg]
N/A1737 return true
N/A1738 }
N/A1739 }
N/A1740 return null
N/A1741}
N/A1742 
N/A1743function scenequeue_Dump()
N/A1744{
N/A1745 
N/A1746 printldebug(">>>>>>>>>>Scene Dump at "+Time())
N/A1747 foreach (idx, val in scenequeue)
N/A1748 {
N/A1749 printldebug(">>>>>>>>>>Scene "+idx+" ADDED at "+val.waitStartTime+" Type "+ typeof val)
N/A1750 }
N/A1751}
N/A1752 
N/A1753//--------------------------------------------------------------------------------------------------------------
N/A1754//Scene Queue Functions END
N/A1755//--------------------------------------------------------------------------------------------------------------
N/A1756 
N/A1757//--------------------------------------------------------------------------------------------------------------
N/A1758//Nag Table Functions START
N/A1759//--------------------------------------------------------------------------------------------------------------
N/A1760 
N/A1761function nags_init(inst,scenetableentry)
N/A1762{
N/A1763 local i = 0
N/A1764 inst.nagsClear()
N/A1765 if ("idleminsecs" in SceneTable[scenetableentry])
N/A1766 {
N/A1767 inst.nagminsecs = SceneTable[scenetableentry].idleminsecs
N/A1768 if ("idlemaxsecs" in SceneTable[scenetableentry])
N/A1769 {
N/A1770 inst.nagmaxsecs = SceneTable[scenetableentry].idlemaxsecs
N/A1771 }
N/A1772 else
N/A1773 {
N/A1774 inst.nagmaxsecs = inst.nagminsecs
N/A1775 }
N/A1776 }
N/A1777 
N/A1778 if ("idlerandomonrepeat" in SceneTable[scenetableentry])
N/A1779 {
N/A1780 inst.nagrandomonrepeat = true
N/A1781 }
N/A1782 
N/A1783 if ("idlerepeat" in SceneTable[scenetableentry])
N/A1784 {
N/A1785 inst.nagrepeat = true
N/A1786 }
N/A1787 
N/A1788 if ("idlerandom" in SceneTable[scenetableentry])
N/A1789 {
N/A1790 inst.nagrandom = true
N/A1791 }
N/A1792 
N/A1793 local igroup = SceneTable[scenetableentry].idlegroup
N/A1794 local idx, val,oig=0
N/A1795 foreach (idx, val in SceneTable)
N/A1796 {
N/A1797 if (!("idlegroup" in val))
N/A1798 continue
N/A1799 if (val.idlegroup != igroup)
N/A1800 continue
N/A1801 local rar = 101, mnum = 0
N/A1802 if ("idlerarity" in val)
N/A1803 {
N/A1804 rar = val.idlerarity
N/A1805 }
N/A1806 if ("idlemaxplays" in val)
N/A1807 {
N/A1808 mnum = val.idlemaxplays
N/A1809 }
N/A1810 //Skip vcds that are part of a chain (and not the first link in the chain)
N/A1811 if ("idleunder" in val)
N/A1812 {
N/A1813 continue
N/A1814 }
N/A1815 if ("idleorderingroup" in val)
N/A1816 {
N/A1817 oig=val.idleorderingroup
N/A1818 }
N/A1819 else
N/A1820 {
N/A1821 oig=0
N/A1822 }
N/A1823 inst.nags.append({SceneTableIndex=idx, rarity = rar, maxplays = mnum, totplays = 0,orderingroup = oig})
N/A1824 }
N/A1825 inst.nags.sort(nag_array_compare)
N/A1826 inst.isNag = true
N/A1827 inst.nagtimeslistcompleted = 0
N/A1828 nags_createpool(inst)
N/A1829}
N/A1830 
N/A1831function nags_createpool(inst)
N/A1832{
N/A1833 inst.nagpoolClear()
N/A1834 local idx, val
N/A1835 local takeit = false
N/A1836 local tempa = []
N/A1837 foreach (idx, val in inst.nags)
N/A1838 {
N/A1839 takeit=false
N/A1840 if (val.totplays >= val.maxplays && val.maxplays>0)
N/A1841 {
N/A1842 continue
N/A1843 }
N/A1844 if (RandomInt(1,100)<val.rarity)
N/A1845 {
N/A1846 takeit=true
N/A1847 }
N/A1848 if (takeit)
N/A1849 {
N/A1850 tempa.append(val)
N/A1851 }
N/A1852 }
N/A1853 local r
N/A1854 //The pool can still be empty at this point if only rare lines were available and none of them "made their roll".
N/A1855 if (tempa.len() == 0)
N/A1856 return
N/A1857 
N/A1858 if (inst.nagrandom || (inst.nagrandomonrepeat && inst.nagtimeslistcompleted > 0))
N/A1859 {
N/A1860 //Make sure the first entry in the new list isn't the same as the last vcd played.
N/A1861 //This ensures no repeats.
N/A1862 if (tempa.len()>1 && inst.naglastfetched!=null)
N/A1863 {
N/A1864 while (true)
N/A1865 {
N/A1866 r=RandomInt(0,tempa.len()-1)
N/A1867 if (tempa[r].SceneTableIndex != inst.naglastfetched)
N/A1868 {
N/A1869 inst.nagpool.append(tempa[r])
N/A1870 tempa.remove(r)
N/A1871 break
N/A1872 }
N/A1873 }
N/A1874 }
N/A1875 //Now build the rest of the pool
N/A1876 while (tempa.len()>0)
N/A1877 {
N/A1878 r=RandomInt(0,tempa.len()-1)
N/A1879 inst.nagpool.append(tempa[r])
N/A1880 tempa.remove(r)
N/A1881 }
N/A1882 }
N/A1883 else
N/A1884 {
N/A1885 foreach(idx, val in tempa)
N/A1886 {
N/A1887 inst.nagpool.append(val)
N/A1888 }
N/A1889 }
N/A1890}
N/A1891 
N/A1892function nags_nagpooldump(inst)
N/A1893{
N/A1894 local idx, val
N/A1895 foreach (idx, val in inst.nagpool)
N/A1896 printldebug("*********NAG "+idx+" : "+val.SceneTableIndex)
N/A1897}
N/A1898 
N/A1899function nags_fetch(inst)
N/A1900{
N/A1901 if (inst.nagpool.len() == 0)
N/A1902 {
N/A1903 if (inst.nagrepeat)
N/A1904 {
N/A1905 inst.nagtimeslistcompleted += 1
N/A1906 nags_createpool(inst)
N/A1907 if (inst.nagpool.len() == 0)
N/A1908 return null
N/A1909 }
N/A1910 else
N/A1911 {
N/A1912 return null
N/A1913 }
N/A1914 }
N/A1915 local ret = inst.nagpool[0].SceneTableIndex
N/A1916 foreach( idx, val in inst.nags)
N/A1917 {
N/A1918 if (val.SceneTableIndex == ret)
N/A1919 {
N/A1920 val.totplays+=1
N/A1921 break
N/A1922 }
N/A1923 }
N/A1924 //nags_nagpooldump(inst)
N/A1925 inst.nagpool.remove(0)
N/A1926 inst.naglastfetched = ret
N/A1927 return ret
N/A1928}
N/A1929 
N/A1930function GladosStopNag(arg = 0)
N/A1931{
N/A1932 nag_stop("glados",arg)
N/A1933}
N/A1934 
N/A1935function WheatleyStopNag(arg = 0)
N/A1936{
N/A1937 nag_stop("wheatley",arg)
N/A1938}
N/A1939 
N/A1940function nag_stop(char, stoptype)
N/A1941{
N/A1942 local idx, val
N/A1943 local todel = null
N/A1944 foreach (idx, val in scenequeue)
N/A1945 {
N/A1946 if (val.isNag && val.currentCharacter == char)
N/A1947 {
N/A1948 todel=idx
N/A1949 break
N/A1950 }
N/A1951 }
N/A1952 if (todel != null)
N/A1953 {
N/A1954 scenequeue_DeleteScene(todel)
N/A1955 }
N/A1956}
N/A1957 
N/A1958function nag_array_compare(a,b)
N/A1959{
N/A1960 if(a.orderingroup>b.orderingroup) return 1
N/A1961 else if(a.orderingroup<b.orderingroup) return -1
N/A1962 return 0;
N/A1963}
N/A1964 
N/A1965 
N/A1966//--------------------------------------------------------------------------------------------------------------
N/A1967//Nag Table Functions END
N/A1968//--------------------------------------------------------------------------------------------------------------
N/A1969 
N/A1970function SabotageFactoryRecycledTurretNoticesPlayer()
N/A1971{
N/A1972 GladosPlayVcd(439, null, "conveyor_turret")
N/A1973}
N/A1974 
N/A1975function TrustFlingCatapultTurretNoticesPlayer()
N/A1976{
N/A1977 GladosPlayVcd(439, null, "catapulted_turret")
N/A1978}
N/A1979 
N/A1980 
N/A1981 
N/A1982 
N/A1983 
N/A1984 
N/A1985//-------------------------------------------------------------------------------------
N/A1986//Context-specific functions
N/A1987//-------------------------------------------------------------------------------------
N/A1988function GladosPlayerGetsGun(arg)
N/A1989{
N/A1990 if (coopFirstPlayerToGetGun == 0)
N/A1991 {
N/A1992 if (arg == coopBlue)
N/A1993 {
N/A1994 coopFirstPlayerToGetGun = coopBlue
N/A1995 BlueHasGun=1
N/A1996 GladosPlayVcd(1)
N/A1997 }
N/A1998 else
N/A1999 {
N/A2000 OrangeHasGun=1
N/A2001 coopFirstPlayerToGetGun = coopOrange
N/A2002 GladosPlayVcd(2)
N/A2003 }
N/A2004 }
N/A2005 else
N/A2006 {
N/A2007 if (arg == coopBlue)
N/A2008 {
N/A2009 BlueHasGun=1
N/A2010 GladosPlayVcd(3)
N/A2011 }
N/A2012 else
N/A2013 {
N/A2014 OrangeHasGun=1
N/A2015 GladosPlayVcd(4)
N/A2016 }
N/A2017 
N/A2018 }
N/A2019}
N/A2020 
N/A2021// a newly spawned cube or sphere was destroyed
N/A2022function GladosDroppedCubeDestroyed(arg)
N/A2023{
N/A2024 if ( arg == coopBlue )
N/A2025 {
N/A2026 EntFireByHandle( badCatchBlue, "Start", "", 0, null, null )
N/A2027 }
N/A2028 else
N/A2029 {
N/A2030 EntFireByHandle( badCatchOrange, "Start", "", 0, null, null )
N/A2031 }
N/A2032}
N/A2033 
N/A2034function GladosGiveCompliment(arg)
N/A2035{
N/A2036 EntFireByHandle( ComplimentSceneTable[arg], "Start", "", 0, null, null )
N/A2037}
N/A2038 
N/A2039function GladosCoopTurnOffVoice()
N/A2040{
N/A2041 coopRelaxationVaultVoiceMonitor = false
N/A2042 coopRelaxationVaultVoiceBlueTicks = 0
N/A2043 coopRelaxationVaultVoiceOrangeTicks = 0
N/A2044}
N/A2045function GladosInitRelaxationVault()
N/A2046{
N/A2047 //coopRelaxationVaultVoiceMonitor = true
N/A2048 coopRelaxationVaultVoiceMonitor = false
N/A2049 coopRelaxationVaultVoiceBlueTicks = 0
N/A2050 coopRelaxationVaultVoiceOrangeTicks = 0
N/A2051 GladosPlayVcd(0,"glados")
N/A2052}
N/A2053 
N/A2054function GladosCoopPingPortalTraining()
N/A2055{
N/A2056 GladosPlayVcd(35)
N/A2057}
N/A2058 
N/A2059function CoopStartCalComplete()
N/A2060{
N/A2061 if (CoopStartCalCompleteSet == 0){
N/A2062 CoopStartCalCompleteSet = 1
N/A2063 GladosPlayVcd(1007)
N/A2064 }
N/A2065}
N/A2066 
N/A2067 
N/A2068function CoopStartBButton(player)
N/A2069{
N/A2070 
N/A2071 if (player == coopBlue && CoopStartBButtonSet == 0){
N/A2072 CoopStartBButtonSet = 1
N/A2073 GladosPlayVcd(1004)
N/A2074 }
N/A2075}
N/A2076 
N/A2077function CoopStartButton(player)
N/A2078{
N/A2079 
N/A2080 if (player == coopOrange && CoopStartButtonSet == 0){
N/A2081 CoopStartButtonSet = 1
N/A2082 GladosPlayVcd(1005)
N/A2083 }
N/A2084}
N/A2085 
N/A2086function CoopStartBoxButton(player)
N/A2087{
N/A2088 CoopStartBoxButtonSet++
N/A2089 if (CoopStartBoxButtonSet == 2){
N/A2090 GladosPlayVcd(1006)
N/A2091 }
N/A2092}
N/A2093 
N/A2094 
N/A2095 
N/A2096function GladosCoopInitiatePlanB()
N/A2097{
N/A2098 GladosPlayVcd(60)
N/A2099}
N/A2100 
N/A2101function GladosCoopEnterRadarRoom()
N/A2102{
N/A2103 GladosPlayVcd(65)
N/A2104}
N/A2105 
N/A2106 
N/A2107function GladosCoopStartRadar()
N/A2108{
N/A2109 GladosPlayVcd(66)
N/A2110}
N/A2111 
N/A2112function GladosCoopExplainMakeHuman()
N/A2113{
N/A2114 GladosPlayVcd(75)
N/A2115}
N/A2116 
N/A2117function GladosCoopExplainMakeHumanFail()
N/A2118{
N/A2119 GladosPlayVcd(80)
N/A2120}
N/A2121 
N/A2122//////
N/A2123function GladosCoopArtifact_1_Enter()
N/A2124{
N/A2125 GladosPlayVcd(100)
N/A2126}
N/A2127 
N/A2128function GladosCoopArtifact_1_Scan()
N/A2129{
N/A2130 GladosPlayVcd(102)
N/A2131}
N/A2132 
N/A2133function GladosCoopArtifact_1_Return()
N/A2134{
N/A2135 GladosPlayVcd(103)
N/A2136}
N/A2137///////
N/A2138 
N/A2139function GladosCoopReturnHubArtifact_1()
N/A2140{
N/A2141 GladosPlayVcd(85)
N/A2142}
N/A2143 
N/A2144function GladosToggleDebugMode()
N/A2145{
N/A2146 debug = !debug
N/A2147 if (debug) printl("=======================GLaDOS debug mode ON")
N/A2148 else printl("=======================GLaDOS debug mode OFF")
N/A2149}
N/A2150 
N/A2151//-------------------------------
N/A2152// PAX PAX END OF DEMO
N/A2153//-------------------------------
N/A2154//ping reminder
N/A2155function GladosCoopPAXEndDemo()
N/A2156{
N/A2157 GladosPlayVcd(153)
N/A2158}
N/A2159 
N/A2160//PrivateTalk mix vcds
N/A2161 PrivateMixVcds <- {}
N/A2162 PrivateMixVcds[1] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_MIX01.vcd")
N/A2163 PrivateMixVcds[2] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_MIX02.vcd")
N/A2164 PrivateMixVcds[3] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_MIX03.vcd")
N/A2165 PrivateMixVcds[4] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_MIX04.vcd")
N/A2166 PrivateMixVcds[5] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_MIX05.vcd")
N/A2167 PrivateMixVcds[6] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_MIX06.vcd")
N/A2168 PrivateMixVcds[7] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_MIX07.vcd")
N/A2169 PrivateMixVcds[8] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_MIX08.vcd")
N/A2170 PrivateMixVcds[9] <- CreateSceneEntity("scenes/npc/glados/COOP_TEST_CHAMBER_BLUE06.vcd")
N/A2171 PrivateMixVcds[10] <- CreateSceneEntity("scenes/npc/glados/COOP_TEST_CHAMBER_BLUE03.vcd")
N/A2172 
N/A2173 
N/A2174//PrivateTalk Both vcds
N/A2175 PrivateBothVcds <- {}
N/A2176 PrivateBothVcds[1] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_BOTH01.vcd")
N/A2177 PrivateBothVcds[2] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_BOTH02.vcd")
N/A2178 PrivateBothVcds[3] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_BOTH03.vcd")
N/A2179 PrivateBothVcds[4] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_BOTH04.vcd")
N/A2180 PrivateBothVcds[5] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_BOTH05.vcd")
N/A2181 PrivateBothVcds[6] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_BOTH06.vcd")
N/A2182 PrivateBothVcds[7] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_BOTH07.vcd")
N/A2183 PrivateBothVcds[8] <- CreateSceneEntity("scenes/npc/glados/COOP_PRIVATETALK_BOTH08.vcd")
N/A2184 PrivateBothVcds[9] <- CreateSceneEntity("scenes/npc/glados/COOP_TEST_CHAMBER_ORANGE06.vcd")
N/A2185 PrivateBothVcds[10] <- CreateSceneEntity("scenes/npc/glados/COOP_TEST_CHAMBER_ORANGE03.vcd")
N/A2186 
N/A2187//Fires two different vcds - one for each player's ears only.
N/A2188function GladosPrivateTalk(player,vndx)
N/A2189{
N/A2190 if (player == coopBlue)
N/A2191 {
N/A2192 GladosSetBroadcastState( PrivateMixVcds[vndx], "blue" )
N/A2193 GladosSetBroadcastState( PrivateBothVcds[vndx], "orange" )
N/A2194 EntFireByHandle(PrivateMixVcds[vndx], "Start", "", 0.00, null, null )
N/A2195 EntFireByHandle(PrivateBothVcds[vndx], "Start", "", 0.00, null, null )
N/A2196 }
N/A2197 else
N/A2198 {
N/A2199 GladosSetBroadcastState( PrivateMixVcds[vndx], "orange" )
N/A2200 GladosSetBroadcastState( PrivateBothVcds[vndx], "blue" )
N/A2201 EntFireByHandle(PrivateMixVcds[vndx], "Start", "", 0.0, null, null )
N/A2202 EntFireByHandle(PrivateBothVcds[vndx], "Start", "", 0.00, null, null )
N/A2203 }
N/A2204}
N/A2205 
N/A2206function GladosSayHello(player)
N/A2207{
N/A2208 if (player == coopBlue)
N/A2209 {
N/A2210 GladosSetBroadcastState( HelloVcds[1], "blue" )
N/A2211 EntFireByHandle(HelloVcds[1], "Start", "", 0.00, null, null )
N/A2212 }
N/A2213 else
N/A2214 {
N/A2215 GladosSetBroadcastState( HelloVcds[2], "orange" )
N/A2216 EntFireByHandle(HelloVcds[2], "Start", "", 0.00, null, null )
N/A2217 }
N/A2218}
N/A2219 
N/A2220function GladosSetBroadcastState(vcd,target )
N/A2221{
N/A2222 local ORANGE_PLAYER = 2
N/A2223 local BLUE_PLAYER = 3
N/A2224 if ( target == "both" )
N/A2225 {
N/A2226 vcd.AddBroadcastTeamTarget( BLUE_PLAYER )
N/A2227 vcd.AddBroadcastTeamTarget( ORANGE_PLAYER )
N/A2228 }
N/A2229 else if ( target == "blue" )
N/A2230 {
N/A2231 vcd.AddBroadcastTeamTarget( BLUE_PLAYER )
N/A2232 vcd.RemoveBroadcastTeamTarget( ORANGE_PLAYER )
N/A2233 }
N/A2234 else if ( target == "orange" )
N/A2235 {
N/A2236 vcd.RemoveBroadcastTeamTarget( BLUE_PLAYER )
N/A2237 vcd.AddBroadcastTeamTarget( ORANGE_PLAYER )
N/A2238 }
N/A2239}
N/A2240 
N/A2241 
N/A2242//Tells GLaDOS that the level wants to end and transition to the next level.
N/A2243//This gives her a chance to finish up any dialog before transitioning
N/A2244//Relies on a relay called "gladosendoflevelrelay" in the map that actually switches levels when triggered.
N/A2245//GLaDOS triggers "gladosendoflevelrelay" from her think function.
N/A2246function GladosEndLevelRequest()
N/A2247{
N/A2248 coopWaitingToExit = true
N/A2249}
N/A2250 
N/A2251//---------------------------------------------------------
N/A2252//Score annoucing stuff
N/A2253//---------------------------------------------------------
N/A2254 function GladosAnnouncePlayerDemerit(arg,low,hi)
N/A2255 {
N/A2256 local mapname = GetMapName()
N/A2257 switch (mapname){
N/A2258 case "mp_coop_catapult_1":
N/A2259 if (arg==coopBlue){
N/A2260 break
N/A2261 }
N/A2262 else{
N/A2263 break
N/A2264 }
N/A2265 }
N/A2266 }
N/A2267 
N/A2268 function GladosAnnouncePlayerScore(arg,low,hi)
N/A2269 {
N/A2270 local mapname = GetMapName()
N/A2271 switch (mapname)
N/A2272 {
N/A2273 
N/A2274 case "mp_coop_doors":
N/A2275 if (arg==coopBlue){
N/A2276 GladosPlayVcd(1012)
N/A2277 break
N/A2278 }
N/A2279 else{
N/A2280 GladosPlayVcd(1013)
N/A2281 break
N/A2282 }
N/A2283 case "mp_coop_fling_3":
N/A2284 if (arg==coopBlue){
N/A2285// GladosPlayVcd(1012)
N/A2286 break
N/A2287 }
N/A2288 else{
N/A2289 // GladosPlayVcd(1013) turned off for now, not on right track.
N/A2290 break
N/A2291 }
N/A2292 
N/A2293 }
N/A2294 
N/A2295 printldebug("2222222222222222222222222222222222")
N/A2296 }
N/A2297 
N/A2298 function GladosStateScore()
N/A2299 {
N/A2300 printldebug("333333333333333333333333333333")
N/A2301 }
N/A2302 
N/A2303 function GladosStateScienceCollaborationPoints()
N/A2304 {
N/A2305 printldebug("444444444444444444444444444444")
N/A2306 }
N/A2307//---------------------------------------------------------
N/A2308//END OF Score annoucing stuff
N/A2309//---------------------------------------------------------
N/A2310 
N/A2311 
N/A2312//-------------------------------
N/A2313// NEW NEW Ping Training Sequence stuff
N/A2314//-------------------------------
N/A2315 //ping reminder
N/A2316 function GladosCoopPingReminder1()
N/A2317 {
N/A2318 GladosPlayVcd(45)
N/A2319 }
N/A2320 
N/A2321//-------------------------------
N/A2322//Ping Training Sequence stuff
N/A2323//-------------------------------
N/A2324 //Play the ping training intro
N/A2325 function GladosCoopPingTrainingIntro()
N/A2326 {
N/A2327 GladosPlayVcd(10)
N/A2328 }
N/A2329 
N/A2330 //Housecleaning / entity stuff that happens when the ping training is over
N/A2331 function GladosCoopPingGameOver()
N/A2332 {
N/A2333 EntFire("aperture_door","SetSpeed",35, 0.00)
N/A2334 EntFire("aperture_door","Close", "", 0.00)
N/A2335 EntFire("dome_exit_door_blue","Open", "", 3.00)
N/A2336 EntFire("dome_exit_door_orange","Open", "", 3.00)
N/A2337 EntFire("platform_2_gate_exit","Open", "", 1.00)
N/A2338 EntFire("platform_1_gate_exit","Open", "", 1.00)
N/A2339 }
N/A2340 
N/A2341 //Turns ping training game on
N/A2342 function GladosCoopPingTrainingGameOn()
N/A2343 {
N/A2344 if (debug)
N/A2345 printl("========================GAME ON!!!!!")
N/A2346 coopPingGameOn = true //We are in ping training mode!
N/A2347 coopPingPlayerTurn = coopBlue //It's BLUE's turn
N/A2348 coopPingTurnNumber = 1 //It's turn #1
N/A2349 coopTimeSinceTurn = Time() //Turn #1 starts NOW!
N/A2350 EntFire("PingHint","ShowHint", "!player_blue", 0.00) //Fire the ping hint to blue player
N/A2351 }
N/A2352 
N/A2353 //Dome ping redirect
N/A2354 function GladosPingTrainingPingDome(arg)
N/A2355 {
N/A2356 GladosPingTrainingPing(arg)
N/A2357 }
N/A2358 
N/A2359 //Handles player placing a ping
N/A2360 function GladosPingTrainingPing(arg)
N/A2361 {
N/A2362 //Track total # of pings by both players
N/A2363 if (arg == coopBlue) coopPingsBlue += 1
N/A2364 if (arg == coopOrange) coopPingsOrange += 1
N/A2365 //Process ping only if GLaDOS isn't talking
N/A2366 if ((!coopPingNoInterrupt) && coopPingGameOn)
N/A2367 {
N/A2368 if (arg==coopBlue) //Ping belongs to BLUE
N/A2369 {
N/A2370 if (coopPingPlayerTurn==coopBlue) //Is it actually BLUE's turn?
N/A2371 {
N/A2372 switch (coopPingTurnNumber)
N/A2373 {
N/A2374 case 1: //Turn 1
N/A2375 coopPingPlayerTurn = coopOrange
N/A2376 coopPingNextScene = 5
N/A2377 coopPingNextSceneDelay = 0.4
N/A2378 coopTimeSinceTurn = Time()
N/A2379 GladosPingTrainingSpeak(2,true,0.00)
N/A2380 EntFire("PingHint","EndHint", "!player_blue", 0.00)
N/A2381 EntFire("PingHint","ShowHint", "!player_orange", 3.00)
N/A2382 break
N/A2383 case 2: //Turn 2
N/A2384 coopPingPlayerTurn = coopOrange
N/A2385 coopPingNextScene = 16
N/A2386 coopPingNextSceneDelay = 0.4
N/A2387 coopTimeSinceTurn = Time()
N/A2388 GladosPingTrainingSpeak(4, true, 0.00)
N/A2389 break
N/A2390 }
N/A2391 }
N/A2392 else //BLUE is pinging out of turn!
N/A2393 {
N/A2394 GladosPingTrainingWrongMove(coopBlue)
N/A2395 }
N/A2396 }
N/A2397 if (arg==coopOrange) //Ping belongs to ORANGE
N/A2398 {
N/A2399 if (coopPingPlayerTurn==coopOrange) //Is it actually ORANGE's turn?
N/A2400 {
N/A2401 switch (coopPingTurnNumber)
N/A2402 {
N/A2403 case 1: //TURN 1
N/A2404 coopPingPlayerTurn = coopBlue
N/A2405 coopPingNextScene = 3
N/A2406 coopPingTurnNumber = 2
N/A2407 coopPingNextSceneDelay = 0.4
N/A2408 coopTimeSinceTurn = Time()
N/A2409 GladosPingTrainingSpeak(19, true, 0.00)
N/A2410 EntFire("PingHint","EndHint", "!player_orange", 0.00)
N/A2411 //GladosPingTrainingSpeak(20, true, 0.00)
N/A2412 break
N/A2413 case 2: //TURN 2 (FINAL MOVE OF GAME)
N/A2414 coopPingGameOn = false
N/A2415 GladosPlayVcd(11) //Play game over dialog dialog (also closes dome doors)
N/A2416 break
N/A2417 }
N/A2418 }
N/A2419 else //Orange is pinging out of turn!
N/A2420 {
N/A2421 GladosPingTrainingWrongMove(coopOrange)
N/A2422 }
N/A2423 }
N/A2424 }
N/A2425 }
N/A2426 
N/A2427 //Handles player placing ping when it's not their turn
N/A2428 function GladosPingTrainingWrongMove(arg)
N/A2429 {
N/A2430 //Gave players their last warning, so shut the game down
N/A2431 if (coopSaidWrongMovesDialog)
N/A2432 {
N/A2433 coopPingGameOn = false
N/A2434 GladosPlayVcd(12)
N/A2435 return
N/A2436 }
N/A2437 //Give players a final warning
N/A2438 if (coopPingsBlue>0 && coopPingsOrange>0 && (coopWrongMovesBlue+coopWrongMovesOrange)>0 && !coopSaidWrongMovesDialog)
N/A2439 {
N/A2440 coopSaidWrongMovesDialog = true
N/A2441 GladosPingTrainingSpeak(11, true, 0.00)
N/A2442 return
N/A2443 }
N/A2444 //Tell BLUE not to go out of turn
N/A2445 if (arg==coopBlue && coopWrongMovesOrange == 0 && coopWrongMovesBlue < 5) //BLUE goes out of turn, but Orange hasn't placed a ping
N/A2446 {
N/A2447 GladosPingTrainingSpeak(13, true, 0.00)
N/A2448 coopWrongMovesBlue +=1
N/A2449 return
N/A2450 }
N/A2451 //Tell ORANGE not to go out of turn
N/A2452 if (arg==coopOrange && coopWrongMovesBlue == 0 && coopWrongMovesOrange < 5)
N/A2453 {
N/A2454 GladosPingTrainingSpeak(14, true, 0.00)
N/A2455 coopWrongMovesOrange += 1
N/A2456 return
N/A2457 }
N/A2458 //Failsafe for final warning
N/A2459 if (!coopSaidWrongMovesDialog)
N/A2460 {
N/A2461 coopSaidWrongMovesDialog = true
N/A2462 GladosPingTrainingSpeak(11, true, 0.00)
N/A2463 return
N/A2464 }
N/A2465 }
N/A2466 
N/A2467 function GladosPingTrainingSpeak(arg,setNoInterrupt,d)
N/A2468 //arg: PingTrainingVcd index
N/A2469 //setNoInterrupt: true = dialog can't be interrupted by intervening event
N/A2470 //d: delay (in seconds) before line
N/A2471 {
N/A2472 if (setNoInterrupt == null) setNoInterrupt = true
N/A2473 if (d == null) d = 0.00
N/A2474 coopPingNoInterrupt = setNoInterrupt
N/A2475 EntFireByHandle(PingTrainingVcds[arg], "Start", "", d, null, null )
N/A2476 }
N/A2477 
N/A2478 //Automatically called at the end of every PingTrainingVcd. Starts next vcd if one has been set.
N/A2479 function GladosPingTrainingNextScene()
N/A2480 {
N/A2481 local i = coopPingNextScene
N/A2482 local d = coopPingNextSceneDelay
N/A2483 if (coopPingNextScene != null)
N/A2484 {
N/A2485 coopPingNextScene = null
N/A2486 coopPingNextSceneDelay = null
N/A2487 GladosPingTrainingSpeak(i,true,d)
N/A2488 }
N/A2489 else coopPingNoInterrupt = false
N/A2490 }
N/A2491//--------------------------------------
N/A2492//END of ping training sequence stuff
N/A2493//--------------------------------------
N/A2494 
N/A2495//-------------------------------------------------------------------------------------
N/A2496//END OF Context-specific functions
N/A2497//-------------------------------------------------------------------------------------
N/A2498 
N/A2499//----------------------------------------------------
N/A2500//microphone utilities
N/A2501//----------------------------------------------------
N/A2502function GladosStartMicTest()
N/A2503{
N/A2504 debugMicTest = true
N/A2505}
N/A2506function GladosStopMicTest()
N/A2507{
N/A2508 debugMicTest = false
N/A2509}
N/A2510 
N/A2511//----------------------------------------------------
N/A2512//END of microphone utilities
N/A2513//----------------------------------------------------
N/A2514 
N/A2515//----------------------------------------------------
N/A2516//Catches for old method of firing directly into speakvcd
N/A2517//----------------------------------------------------
N/A2518//Glados placing portals for player using ping tool.
N/A2519SceneTableLookup[35] <- "mp_coop_startcoop_portal_ping_intro00"
N/A2520function CoopRaceButtonPress(player){
N/A2521 if (player==coopBlue)
N/A2522 {
N/A2523 GladosPlayVcd(1012)
N/A2524 }
N/A2525 else
N/A2526 {
N/A2527 GladosPlayVcd(1013)
N/A2528 }
N/A2529}
N/A2530 
N/A2531function CoopStartHandOff()
N/A2532{
N/A2533}
N/A2534 
N/A2535function CoopStartBoxCatch()
N/A2536{
N/A2537 GladosPlayVcd(1023)
N/A2538}
N/A2539 
N/A2540 
N/A2541function GladosPingIntroDone()
N/A2542{
N/A2543 BlueInPortalTraining = 1
N/A2544 OrangeInPortalTraining = 1
N/A2545}
N/A2546 
N/A2547function CoopStartTwoPortals(){
N/A2548 GladosPlayVcd(1002)
N/A2549}
N/A2550 
N/A2551function CoopRadarRoom(){
N/A2552 LastDeathTime=Time()+5000 //extra time added so death responses will not fire
N/A2553 GladosPlayVcd(1009)
N/A2554 EndSpeedRunTimer()
N/A2555}
N/A2556 
N/A2557function CoopBlueprintRoom(){
N/A2558 LastDeathTime=Time()+5000 //extra time added so death responses will not fire
N/A2559 GladosPlayVcd(1055)
N/A2560 EndSpeedRunTimer()
N/A2561}
N/A2562function CoopSecutiryRoom(){
N/A2563 LastDeathTime=Time()+5000 //extra time added so death responses will not fire
N/A2564 GladosPlayVcd(1196)
N/A2565 EndSpeedRunTimer()
N/A2566}
N/A2567 
N/A2568function CoopTbeamSecurity()
N/A2569{
N/A2570 LastDeathTime=Time()+5000 //extra time added so death responses will not fire
N/A2571 GladosPlayVcd(1094)
N/A2572 
N/A2573 // Award the STAYING_ALIVE achievement here, before GLADOS nukes the players.
N/A2574 // If no one died...
N/A2575 local nTotalDeaths = GetPlayerDeathCount( 0 ) + GetPlayerDeathCount( 1 );
N/A2576 if ( nTotalDeaths == 0 )
N/A2577 {
N/A2578 // ...and both players completed every map in the branch during this session.
N/A2579 if ( CoopGetLevelsCompletedThisBranch() == CoopGetBranchTotalLevelCount(STAYING_ALIVE_SECTION-1)-1 )
N/A2580 {
N/A2581 RecordAchievementEvent( "ACH.STAYING_ALIVE", GetBluePlayerIndex() )
N/A2582 RecordAchievementEvent( "ACH.STAYING_ALIVE", GetOrangePlayerIndex() )
N/A2583 }
N/A2584 }
N/A2585 
N/A2586 EndSpeedRunTimer()
N/A2587}
N/A2588 
N/A2589function RespondToTaunt(tauntnumber){
N/A2590 printldebug("-------------------------------------------RESPONDTOTAUNT"+tauntnumber)
N/A2591 local curMapName = GetMapName()
N/A2592 //taunt 0 given at start
N/A2593 LastTauntTime=Time()
N/A2594 switch (curMapName)
N/A2595 {
N/A2596 case "mp_coop_start":
N/A2597 if (tauntnumber == 1)
N/A2598 {
N/A2599 GladosPlayVcd(1064)
N/A2600 }
N/A2601 break
N/A2602 
N/A2603 case "mp_coop_laser_2":
N/A2604 if (tauntnumber == 2)
N/A2605 {
N/A2606 GladosPlayVcd(1065)
N/A2607 }
N/A2608 break
N/A2609 case "mp_coop_rat_maze":
N/A2610 if (tauntnumber == 3)
N/A2611 {
N/A2612 GladosPlayVcd(1017)
N/A2613 }
N/A2614 break
N/A2615 case "mp_coop_catapult_1":
N/A2616 if (tauntnumber == 5)
N/A2617 {
N/A2618 GladosPlayVcd(1051)
N/A2619 }
N/A2620 break
N/A2621 case "mp_coop_lobby_2":
N/A2622 case "mp_coop_lobby_3":
N/A2623 if (tauntnumber == 4){
N/A2624 //moved ot hub stuff
N/A2625 }
N/A2626 break
N/A2627 case "mp_coop_catapult_wall_intro":
N/A2628 if (tauntnumber == 7){
N/A2629 GladosPlayVcd(1097)
N/A2630 }
N/A2631 break
N/A2632 case "mp_coop_wall_5":
N/A2633 if (tauntnumber == 8){
N/A2634 GladosPlayVcd(1098)
N/A2635 }
N/A2636 break
N/A2637 case "mp_coop_tbeam_laser_1":
N/A2638 if (tauntnumber == 9){
N/A2639 GladosPlayVcd(1099)
N/A2640 }
N/A2641 break
N/A2642 }
N/A2643}
N/A2644 
N/A2645function CoopHubTrack01(){
N/A2646 GladosPlayVcd(1020)
N/A2647}
N/A2648function CoopHubTrack02(){
N/A2649 InHub2=1
N/A2650 GladosPlayVcd(1095)
N/A2651}
N/A2652 
N/A2653function CoopHubTrack03(){
N/A2654 GladosPlayVcd(1062)
N/A2655}
N/A2656 
N/A2657function CoopHubTrack04(){
N/A2658 GladosPlayVcd(1173)
N/A2659 
N/A2660}
N/A2661 
N/A2662function CoopHubTrack05(){
N/A2663 GladosPlayVcd(1130)
N/A2664}
N/A2665 
N/A2666function CoopHubTrack06(){
N/A2667 GladosPlayVcd(1130) // FIX ME: Need a new glados line here
N/A2668}
N/A2669 
N/A2670 
N/A2671 
N/A2672function CoopRaceButton(arg)
N/A2673{
N/A2674 if (arg==coopBlue)
N/A2675 {
N/A2676 GladosPlayVcd(1026)
N/A2677 }
N/A2678 else
N/A2679 {
N/A2680 GladosPlayVcd(1027)
N/A2681 }
N/A2682}
N/A2683 
N/A2684function CoopLaserTurretkill()
N/A2685{
N/A2686 GladosPlayVcd(1028)
N/A2687}
N/A2688 
N/A2689function CoopMazeOrangeCrush(arg){
N/A2690 if (arg == 1){
N/A2691 OrangeInMaze = 1
N/A2692 }
N/A2693 else{
N/A2694 OrangeInMaze = 0
N/A2695 }
N/A2696}
N/A2697 
N/A2698function CoopMazeBlueCrush(arg){
N/A2699 if (arg == 1){
N/A2700 BlueInMaze = 1
N/A2701 }
N/A2702 else{
N/A2703 BlueInMaze = 0
N/A2704 }
N/A2705}
N/A2706 
N/A2707function CoopCrushersBlueCrush(arg){
N/A2708 if (arg == 1){
N/A2709 BlueInCrusher = 1
N/A2710 }
N/A2711 else{
N/A2712 BlueInCrusher = 0
N/A2713 }
N/A2714}
N/A2715 
N/A2716function CoopCrushersOrangeCrush(arg){
N/A2717 if (arg == 1){
N/A2718 OrangeInCrusher = 1
N/A2719 }
N/A2720 else{
N/A2721 OrangeInCrusher = 0
N/A2722 }
N/A2723}
N/A2724 
N/A2725function CoopRedirectAhead(player){
N/A2726 if (player == coopBlue){
N/A2727 GladosPlayVcd(1092)
N/A2728 }
N/A2729 else{
N/A2730 GladosPlayVcd(1093)
N/A2731 }
N/A2732 
N/A2733}
N/A2734 
N/A2735 
N/A2736function Fling1Drop4Balls(){
N/A2737 GladosPlayVcd(1198)
N/A2738}
N/A2739 
N/A2740 
N/A2741 
N/A2742 
N/A2743 
N/A2744function BotDeath(player,dmgtype)
N/A2745{
N/A2746 printl("*******************DEATH***************************")
N/A2747 printl("player: "+player)
N/A2748 printl("dmg: "+dmgtype)
N/A2749 printl("*******************DEATH***************************")
N/A2750 
N/A2751 printldebug("*******************DEATH***************************")
N/A2752 printldebug(player)
N/A2753 printldebug(dmgtype)
N/A2754 printldebug(HumanResourceDeath4)
N/A2755 printldebug(LastDeathTime)
N/A2756 printldebug(mp_coop_tbeam_laser_1death1)
N/A2757 printldebug(mp_coop_tbeam_laser_1death2)
N/A2758 printldebug("*******************DEATH***************************")
N/A2759 local curTime=Time()
N/A2760 if (curTime-LastDeathTime<10){
N/A2761 return
N/A2762 }
N/A2763 LastDeathTime=Time()
N/A2764 
N/A2765 if (curMapName == "mp_coop_tbeam_polarity3" && mp_coop_tbeam_polarity3deathblue==1 && player== coopBlue){
N/A2766 mp_coop_tbeam_polarity3deathblue=2
N/A2767 GladosPlayVcd(1322)
N/A2768 return
N/A2769 }
N/A2770 if (curMapName == "mp_coop_tbeam_polarity3" && mp_coop_tbeam_polarity3deathblue==0 && player== coopBlue){
N/A2771 mp_coop_tbeam_polarity3deathblue=1
N/A2772 GladosPlayVcd(1323)
N/A2773 return
N/A2774 }
N/A2775 
N/A2776 if (curMapName == "mp_coop_tbeam_polarity3" && mp_coop_tbeam_polarity3deathorange==1 && player== coopOrange){
N/A2777 mp_coop_tbeam_polarity3deathorange=2
N/A2778 GladosPlayVcd(1325)
N/A2779 return
N/A2780 }
N/A2781 if (curMapName == "mp_coop_tbeam_polarity3" && mp_coop_tbeam_polarity3deathorange==0 && player== coopOrange){
N/A2782 mp_coop_tbeam_polarity3deathorange=1
N/A2783 GladosPlayVcd(1324)
N/A2784 return
N/A2785 }
N/A2786 
N/A2787 
N/A2788 
N/A2789 
N/A2790 
N/A2791 if (curMapName == "mp_coop_tbeam_drill" && mp_coop_tbeam_drilldeathblue==0 && player== coopBlue){
N/A2792 mp_coop_tbeam_drilldeathblue=1
N/A2793 GladosPlayVcd(1318)
N/A2794 return
N/A2795 }
N/A2796 if (curMapName == "mp_coop_tbeam_drill" && mp_coop_tbeam_drilldeathorange==0 && player== coopOrange){
N/A2797 mp_coop_tbeam_drilldeathorange=1
N/A2798 GladosPlayVcd(1319)
N/A2799 return
N/A2800 }
N/A2801 
N/A2802 if (curMapName == "mp_coop_tbeam_polarity" && mp_coop_tbeam_polaritydeathblue==0 && player== coopBlue){
N/A2803 mp_coop_tbeam_polaritydeathblue=1
N/A2804 GladosPlayVcd(1320)
N/A2805 return
N/A2806 }
N/A2807 if (curMapName == "mp_coop_tbeam_polarity" && mp_coop_tbeam_polaritydeathorange==0 && player== coopOrange){
N/A2808 mp_coop_tbeam_polaritydeathorange=1
N/A2809 GladosPlayVcd(1321)
N/A2810 return
N/A2811 }
N/A2812 
N/A2813 
N/A2814 if (curMapName == "mp_coop_tbeam_redirect" && mp_coop_tbeam_redirectdeath==0){
N/A2815 mp_coop_tbeam_redirectdeath=1
N/A2816 GladosPlayVcd(1316)
N/A2817 return
N/A2818 }
N/A2819 if (curMapName == "mp_coop_lobby_2" || curMapName == "mp_coop_lobby_3"){
N/A2820 local tauntflag3 = GetGladosSpokenFlags( 3 ) //used for deaths
N/A2821 if ((tauntflag3 & (1 << 1)) == 0){
N/A2822 tauntflag3 = tauntflag3 + (1 << 1)
N/A2823 AddGladosSpokenFlags( 3, tauntflag3 )
N/A2824 GladosPlayVcd(1199)
N/A2825 return
N/A2826 }
N/A2827 if ((tauntflag3 & (1 << 2)) == 0){
N/A2828 tauntflag3 = tauntflag3 + (1 << 2)
N/A2829 AddGladosSpokenFlags( 3, tauntflag3 )
N/A2830 GladosPlayVcd(1200)
N/A2831 return
N/A2832 }
N/A2833 if ((tauntflag3 & (1 << 0)) == 0){
N/A2834 tauntflag3 = tauntflag3 + (1 << 0)
N/A2835 AddGladosSpokenFlags( 3, tauntflag3 )
N/A2836 GladosPlayVcd(1096)
N/A2837 return
N/A2838 }
N/A2839 if ((tauntflag3 & (1 << 3)) == 0){
N/A2840 tauntflag3 = tauntflag3 + (1 << 3)
N/A2841 AddGladosSpokenFlags( 3, tauntflag3 )
N/A2842 GladosPlayVcd(1201)
N/A2843 return
N/A2844 }
N/A2845 if ((tauntflag3 & (1 << 4)) == 0){
N/A2846 tauntflag3 = tauntflag3 + (1 << 4)
N/A2847 AddGladosSpokenFlags( 3, tauntflag3 )
N/A2848 GladosPlayVcd(1202)
N/A2849 return
N/A2850 }
N/A2851 }
N/A2852 if (curMapName == "mp_coop_turret_walls" && mp_coop_turret_wallscount==9){
N/A2853 GladosPlayVcd(1192)
N/A2854 }
N/A2855 
N/A2856 if (curMapName == "mp_coop_turret_walls" && mp_coop_turret_wallscount==4){
N/A2857 GladosPlayVcd(1193)
N/A2858 }
N/A2859 
N/A2860 if (curMapName == "mp_coop_turret_walls" && mp_coop_turret_wallscount==2){
N/A2861 GladosPlayVcd(1191)
N/A2862 }
N/A2863 
N/A2864 if (curMapName == "mp_coop_turret_walls" && mp_coop_turret_wallscount==0){
N/A2865 GladosPlayVcd(1153)
N/A2866 }
N/A2867 
N/A2868 if (curMapName == "mp_coop_turret_walls"){
N/A2869 mp_coop_turret_wallscount=mp_coop_turret_wallscount+1
N/A2870 }
N/A2871 
N/A2872 
N/A2873 if (curMapName == "mp_coop_turret_ball" && mp_coop_turret_ballcount==2){
N/A2874 if (player==2){
N/A2875 GladosPlayVcd(1189)
N/A2876 }
N/A2877 else{
N/A2878 GladosPlayVcd(1188)
N/A2879 }
N/A2880 mp_coop_turret_ballcount=3
N/A2881 }
N/A2882 
N/A2883 if (curMapName == "mp_coop_turret_ball" && mp_coop_turret_ballcount==1){
N/A2884 mp_coop_turret_ballcount=2
N/A2885 GladosPlayVcd(1190)
N/A2886 }
N/A2887 if (curMapName == "mp_coop_turret_ball" && mp_coop_turret_ballcount==0){
N/A2888 mp_coop_turret_ballcount=1
N/A2889 GladosPlayVcd(1187)
N/A2890 }
N/A2891 
N/A2892 if (curMapName == "mp_coop_tbeam_end" ){
N/A2893 local fireddeath = 0
N/A2894 if (dmgtype==2 && Tbeam_enddeathturret==0){
N/A2895 Tbeam_enddeathturret=1
N/A2896 fireddeath=1
N/A2897 GladosPlayVcd(1180)
N/A2898 }
N/A2899 if (dmgtype==32 && Tbeam_enddeathfall==0){
N/A2900 Tbeam_enddeathfall=1
N/A2901 fireddeath=1
N/A2902 GladosPlayVcd(1179)
N/A2903 }
N/A2904 if (Tbeam_enddeathother==2 && fireddeath==0)
N/A2905 {
N/A2906 GladosPlayVcd(1181)
N/A2907 Tbeam_enddeathother=Tbeam_enddeathother+1
N/A2908 }
N/A2909 if (Tbeam_enddeathother==1 && fireddeath==0)
N/A2910 {
N/A2911 GladosPlayVcd(1182)
N/A2912 Tbeam_enddeathother=Tbeam_enddeathother+1
N/A2913 }
N/A2914 if (Tbeam_enddeathother==0 && fireddeath==0)
N/A2915 {
N/A2916 GladosPlayVcd(1183)
N/A2917 Tbeam_enddeathother=Tbeam_enddeathother+1
N/A2918 }
N/A2919 Tbeam_enddeathcounter=Tbeam_enddeathcounter+1
N/A2920 
N/A2921 }
N/A2922 
N/A2923 
N/A2924 if (curMapName == "mp_coop_rat_maze" )
N/A2925 {
N/A2926 if (player== coopBlue && dmgtype == 1 && BlueInMaze == 1 && CoopMazeBlueCrushset == 2)
N/A2927 {
N/A2928 CoopMazeBlueCrushset = 3
N/A2929 GladosPlayVcd(1047)
N/A2930 }
N/A2931 if (player== coopOrange && dmgtype == 1 && OrangeInMaze == 1 && CoopMazeOrangeCrushset == 2)
N/A2932 {
N/A2933 CoopMazeOrangeCrushset = 3
N/A2934 GladosPlayVcd(1048)
N/A2935 }
N/A2936 if (player==coopBlue && dmgtype == 1 && BlueInMaze == 1 && CoopMazeBlueCrushset == 1)
N/A2937 {
N/A2938 CoopMazeBlueCrushset = 2
N/A2939 GladosPlayVcd(1045)
N/A2940 }
N/A2941 if (player== coopOrange && dmgtype == 1 && OrangeInMaze == 1 && CoopMazeOrangeCrushset == 1)
N/A2942 {
N/A2943 CoopMazeOrangeCrushset = 2
N/A2944 GladosPlayVcd(1046)
N/A2945 }
N/A2946 
N/A2947 if (player==coopBlue && dmgtype == 1 && BlueInMaze == 1 && CoopMazeBlueCrushset == 0)
N/A2948 {
N/A2949 CoopMazeBlueCrushset = 1
N/A2950 GladosPlayVcd(1043)
N/A2951 }
N/A2952 if (player== coopOrange && dmgtype == 1 && OrangeInMaze == 1 && CoopMazeOrangeCrushset == 0)
N/A2953 {
N/A2954 CoopMazeOrangeCrushset = 1
N/A2955 GladosPlayVcd(1044)
N/A2956 }
N/A2957 
N/A2958 
N/A2959 }
N/A2960 
N/A2961 if (curMapName == "mp_coop_laser_crusher")
N/A2962 {
N/A2963 mp_coop_laser_crusherdeath=1
N/A2964 if (player==coopBlue && dmgtype == 1 && BlueInCrusher == 1 && CoopCrushersBlueCrushset == 1)
N/A2965 {
N/A2966 CoopCrushersOrangeCrushset = 2
N/A2967 CoopCrushersBlueCrushset = 2
N/A2968 GladosPlayVcd(1042)
N/A2969 }
N/A2970 if (player== coopOrange && dmgtype == 1 && OrangeInCrusher == 1 && CoopCrushersOrangeCrushset == 1)
N/A2971 {
N/A2972 CoopCrushersOrangeCrushset = 2
N/A2973 CoopCrushersBlueCrushset = 2
N/A2974 GladosPlayVcd(1042)
N/A2975 }
N/A2976 
N/A2977 if (player==coopBlue && dmgtype == 1 && BlueInCrusher == 1 && CoopCrushersBlueCrushset == 0)
N/A2978 {
N/A2979 CoopCrushersBlueCrushset = 1
N/A2980 GladosPlayVcd(1040)
N/A2981 }
N/A2982 if (player== coopOrange && dmgtype == 1 && OrangeInCrusher == 1 && CoopCrushersOrangeCrushset == 0)
N/A2983 {
N/A2984 CoopCrushersOrangeCrushset = 1
N/A2985 GladosPlayVcd(1041)
N/A2986 }
N/A2987 
N/A2988 }
N/A2989 if (curMapName == "mp_coop_start")
N/A2990 {
N/A2991 if (startdeath==3)
N/A2992 {
N/A2993 GladosPlayVcd(1086)
N/A2994 startdeath=startdeath+1
N/A2995 
N/A2996 }
N/A2997 if (startdeath==2)
N/A2998 {
N/A2999 GladosPlayVcd(1085)
N/A3000 startdeath=startdeath+1
N/A3001 
N/A3002 }
N/A3003 if (startdeath==1)
N/A3004 {
N/A3005 GladosPlayVcd(1084)
N/A3006 startdeath=startdeath+1
N/A3007 
N/A3008 }
N/A3009 if (player==coopBlue && startdeath==0)
N/A3010 {
N/A3011 startdeath=startdeath+1
N/A3012 GladosPlayVcd(1088)
N/A3013 
N/A3014 }
N/A3015 if (player==coopOrange && startdeath==0)
N/A3016 {
N/A3017 startdeath=startdeath+1
N/A3018 GladosPlayVcd(1087)
N/A3019 }
N/A3020 }
N/A3021 if ((curMapName == "mp_coop_lobby_2" || curMapName == "mp_coop_lobby_3") && InHub2==1 && InHub2Set==0 ) {
N/A3022 InHub2Set=1
N/A3023 GladosPlayVcd(1096)
N/A3024 }
N/A3025 if (curMapName == "mp_coop_wall_2") {
N/A3026 mp_coop_wall_2death=mp_coop_wall_2death+1
N/A3027 }
N/A3028 if (curMapName == "mp_coop_paint_redirect" && HumanResourceDeath1==2 ){
N/A3029 HumanResourceDeath1=3
N/A3030 GladosPlayVcd(1294)
N/A3031 }
N/A3032 
N/A3033 if (curMapName == "mp_coop_paint_redirect" && HumanResourceDeath1==1 ){
N/A3034 HumanResourceDeath1=2
N/A3035 GladosPlayVcd(1293)
N/A3036 }
N/A3037 
N/A3038 if (curMapName == "mp_coop_paint_redirect" && HumanResourceDeath1==0 ){
N/A3039 HumanResourceDeath1=1
N/A3040 GladosPlayVcd(1145)
N/A3041 }
N/A3042 if (curMapName == "mp_coop_paint_bridge" && HumanResourceDeath2==1){
N/A3043 HumanResourceDeath2=2
N/A3044 GladosPlayVcd(1296)
N/A3045 }
N/A3046 if (curMapName == "mp_coop_paint_bridge" && HumanResourceDeath2==0){
N/A3047 HumanResourceDeath2=1
N/A3048 GladosPlayVcd(1146)
N/A3049 }
N/A3050 
N/A3051 if (curMapName == "mp_coop_paint_walljumps" && HumanResourceDeath3==0){
N/A3052 HumanResourceDeath3=1
N/A3053 GladosPlayVcd(1150)
N/A3054 }
N/A3055 if (curMapName == "mp_coop_paint_red_racer" && HumanResourceDeath4==5){
N/A3056 HumanResourceDeath4=6
N/A3057 GladosPlayVcd(1186)
N/A3058 }
N/A3059 if (curMapName == "mp_coop_paint_red_racer" && HumanResourceDeath4==4){
N/A3060 HumanResourceDeath4=HumanResourceDeath4+1
N/A3061 }
N/A3062 if (curMapName == "mp_coop_paint_red_racer" && HumanResourceDeath4==3){
N/A3063 HumanResourceDeath4=HumanResourceDeath4+1
N/A3064 }
N/A3065 if (curMapName == "mp_coop_paint_red_racer" && HumanResourceDeath4==2){
N/A3066 HumanResourceDeath4=3
N/A3067 GladosPlayVcd(1185)
N/A3068 }
N/A3069 if (curMapName == "mp_coop_paint_red_racer" && HumanResourceDeath4==1){
N/A3070 HumanResourceDeath4=2
N/A3071 GladosPlayVcd(1184)
N/A3072 }
N/A3073 if (curMapName == "mp_coop_paint_red_racer" && HumanResourceDeath4==0){
N/A3074 HumanResourceDeath4=1
N/A3075 GladosPlayVcd(1148)
N/A3076 }
N/A3077 if (curMapName == "mp_coop_paint_speed_catch" && HumanResourceDeath5==0){
N/A3078 HumanResourceDeath5=1
N/A3079 GladosPlayVcd(1149)
N/A3080 }
N/A3081 if (curMapName == "mp_coop_paint_speed_fling" && HumanResourceDeath6==0){
N/A3082 HumanResourceDeath6=1
N/A3083 GladosPlayVcd(1299)
N/A3084 }
N/A3085 if (curMapName == "mp_coop_paint_longjump_intro" && HumanResourceDeath7==3){
N/A3086 HumanResourceDeath7=4
N/A3087 GladosPlayVcd(1303)
N/A3088 }
N/A3089 if (curMapName == "mp_coop_paint_longjump_intro" && HumanResourceDeath7==2){
N/A3090 HumanResourceDeath7=3
N/A3091 GladosPlayVcd(1302)
N/A3092 }
N/A3093 if (curMapName == "mp_coop_paint_longjump_intro" && HumanResourceDeath7==1){
N/A3094 HumanResourceDeath7=2
N/A3095 GladosPlayVcd(1301)
N/A3096 }
N/A3097 if (curMapName == "mp_coop_paint_longjump_intro" && HumanResourceDeath7==0){
N/A3098 HumanResourceDeath7=1
N/A3099 GladosPlayVcd(1300)
N/A3100 }
N/A3101 
N/A3102 
N/A3103 
N/A3104 if (curMapName == "mp_coop_race_2"&& EarlyDeath1==0 ){
N/A3105 EarlyDeath1=1
N/A3106 GladosPlayVcd(1151)
N/A3107 }
N/A3108 if (curMapName == "mp_coop_multifling_1" && EarlyDeath2==0){
N/A3109 EarlyDeath2=1
N/A3110 GladosPlayVcd(1152)
N/A3111 //add this line to ending if earlydeath2!=1
N/A3112 }
N/A3113 if (curMapName == "mp_coop_fling_crushers" && EarlyDeath3==2){
N/A3114 EarlyDeath3=3
N/A3115 GladosPlayVcd(1178)
N/A3116 }
N/A3117 
N/A3118 if (curMapName == "mp_coop_fling_crushers" && EarlyDeath3==1){
N/A3119 EarlyDeath3=2
N/A3120 GladosPlayVcd(1177)
N/A3121 }
N/A3122 if (curMapName == "mp_coop_fling_crushers" && EarlyDeath3==0){
N/A3123 EarlyDeath3=1
N/A3124 GladosPlayVcd(1147)
N/A3125 }
N/A3126 
N/A3127 
N/A3128 if (curMapName == "mp_coop_come_along" && EarlyDeath4==0){
N/A3129 EarlyDeath4=1
N/A3130 GladosPlayVcd(1154)
N/A3131 }
N/A3132 if (curMapName == "mp_coop_catapult_1" && EarlyDeath5==0){
N/A3133 EarlyDeath5=1
N/A3134 GladosPlayVcd(1155)
N/A3135 }
N/A3136 if (curMapName == "mp_coop_tbeam_laser_1" ){
N/A3137 if (player==2 && mp_coop_tbeam_laser_1death1==0){
N/A3138 mp_coop_tbeam_laser_1death1=1
N/A3139 GladosPlayVcd(1204)
N/A3140 return
N/A3141 }
N/A3142 if (player==1 && mp_coop_tbeam_laser_1death2==0){
N/A3143 mp_coop_tbeam_laser_1death2=1
N/A3144 GladosPlayVcd(1206)
N/A3145 }
N/A3146 if (player==2 && mp_coop_tbeam_laser_1death3==1){
N/A3147 mp_coop_tbeam_laser_1death1=2
N/A3148 GladosPlayVcd(1205)
N/A3149 }
N/A3150 }
N/A3151 if (curMapName == "mp_coop_infinifling_train" && mp_coop_infinifling_traindeath01==0){
N/A3152 mp_coop_infinifling_traindeath01=1
N/A3153 GladosPlayVcd(1255)
N/A3154 }
N/A3155 if (curMapName == "mp_coop_infinifling_train" ){
N/A3156 mp_coop_infinifling_traindeath=mp_coop_infinifling_traindeath+1
N/A3157 }
N/A3158 
N/A3159 if (curMapName == "mp_coop_catapult_wall_intro" && mp_coop_catapult_wall_introdeath==0){
N/A3160 mp_coop_catapult_wall_introdeath=1
N/A3161 GladosPlayVcd(1257)
N/A3162 }
N/A3163 if (curMapName == "mp_coop_wall_block" && mp_coop_wall_blockdeath==0){
N/A3164 mp_coop_wall_blockdeath=1
N/A3165 GladosPlayVcd(1258)
N/A3166 }
N/A3167 
N/A3168 //DLC functions
N/A3169 DLC1_BotDeath(player,dmgtype)
N/A3170 //--------------------------------------------
N/A3171}
N/A3172 
N/A3173function CoopCrushersBox(player){
N/A3174 local x = RandomInt(1,100)
N/A3175 if (x>50)
N/A3176 {
N/A3177 GladosPlayVcd(1012)
N/A3178 }
N/A3179 else
N/A3180 {
N/A3181 GladosPlayVcd(1013)
N/A3182 }
N/A3183}
N/A3184 
N/A3185 
N/A3186function GladosCoopMapStart(){
N/A3187 local curMapName = GetMapName()
N/A3188 switch (curMapName)
N/A3189 {
N/A3190///////Calibration Course
N/A3191 ///function handled elsewhere
N/A3192///////Team Building Course
N/A3193 case "mp_coop_doors": //introduction
N/A3194 GladosPlayVcd(54)
N/A3195 break
N/A3196 case "mp_coop_race_2": //human sports - fewest possible points
N/A3197 GladosPlayVcd(1022)
N/A3198 break
N/A3199 case "mp_coop_laser_2": // potentially lethal
N/A3200 GladosPlayVcd(1016)
N/A3201 break
N/A3202 case "mp_coop_rat_maze": //forged partnership - one lazy
N/A3203 
N/A3204 break
N/A3205 case "mp_coop_laser_crusher": //not a competition but if it were...
N/A3206 local x = RandomInt(1,100)
N/A3207 if (x>50){
N/A3208 GladosPlayVcd(1018)
N/A3209 }
N/A3210 else{
N/A3211 GladosPlayVcd(1019)
N/A3212 }
N/A3213 break
N/A3214 case "mp_coop_teambts": //outside the box.
N/A3215 GladosPlayVcd(1021)
N/A3216 break
N/A3217 
N/A3218///////Confidence Building Course
N/A3219 case "mp_coop_fling_3":
N/A3220 GladosPlayVcd(1029)
N/A3221 break
N/A3222 case "mp_coop_infinifling_train":
N/A3223 GladosPlayVcd(1031)
N/A3224 break
N/A3225 case "mp_coop_come_along":
N/A3226 GladosPlayVcd(1056)
N/A3227 break
N/A3228 case "mp_coop_fling_1":
N/A3229 GladosPlayVcd(1032)
N/A3230 break
N/A3231 case "mp_coop_catapult_1":
N/A3232 GladosPlayVcd(1057)
N/A3233 break
N/A3234 case "mp_coop_multifling_1":
N/A3235 GladosPlayVcd(1058)
N/A3236 break
N/A3237 case "mp_coop_fling_crushers":
N/A3238 GladosPlayVcd(1059)
N/A3239 break
N/A3240 case "mp_coop_fan":
N/A3241 GladosPlayVcd(1054)
N/A3242 break
N/A3243 
N/A3244/////////Obstacle Building Course
N/A3245 case "mp_coop_wall_intro":
N/A3246 GladosPlayVcd(1111)
N/A3247 break
N/A3248 case "mp_coop_wall_2":
N/A3249 GladosPlayVcd(1118)
N/A3250 break
N/A3251 case "mp_coop_catapult_wall_intro":
N/A3252 GladosPlayVcd(1117)
N/A3253 break
N/A3254 case "mp_coop_wall_block":
N/A3255 GladosPlayVcd(1119)
N/A3256 break
N/A3257 case "mp_coop_catapult_2":
N/A3258 GladosPlayVcd(1121)
N/A3259 break
N/A3260 case "mp_coop_turret_walls": //check this is in ?
N/A3261 GladosPlayVcd(1122)
N/A3262 break
N/A3263 case "mp_coop_turret_ball":
N/A3264 GladosPlayVcd(1083)
N/A3265 break
N/A3266 case "mp_coop_wall_5":
N/A3267 GladosPlayVcd(1060)
N/A3268 break
N/A3269 
N/A3270 
N/A3271 
N/A3272 
N/A3273 ///////Subterfuge Building Course
N/A3274 case "mp_coop_tbeam_redirect":
N/A3275 GladosPlayVcd(1125)
N/A3276 break
N/A3277 case "mp_coop_tbeam_drill":
N/A3278 if (IsLocalSplitScreen()){
N/A3279 GladosPlayVcd(1306)
N/A3280 }
N/A3281 else{
N/A3282 GladosPrivateTalk(2,10)
N/A3283 }
N/A3284 break
N/A3285 case "mp_coop_tbeam_catch_grind_1":
N/A3286 local x = RandomInt(1,100)
N/A3287 if (x>50)
N/A3288 {
N/A3289 GladosPlayVcd(1080)
N/A3290 bluetrust=1
N/A3291 }
N/A3292 else
N/A3293 {
N/A3294 GladosPlayVcd(1081)
N/A3295 orangetrust=1
N/A3296 }
N/A3297 break
N/A3298 case "mp_coop_tbeam_laser_1":
N/A3299 GladosPlayVcd(1073)
N/A3300 break
N/A3301 case "mp_coop_tbeam_polarity":
N/A3302 local x = RandomInt(1,100)
N/A3303 if (x>50)
N/A3304 {
N/A3305 GladosPlayVcd(1069)
N/A3306 bluetrust=1
N/A3307 }
N/A3308 else
N/A3309 {
N/A3310 GladosPlayVcd(1070)
N/A3311 orangetrust=1
N/A3312 }
N/A3313 break
N/A3314 case "mp_coop_tbeam_polarity2":
N/A3315 local x = RandomInt(1,100)
N/A3316 if (x>50)
N/A3317 {
N/A3318 GladosPlayVcd(1090)
N/A3319 }
N/A3320 else
N/A3321 {
N/A3322 GladosPlayVcd(1091)
N/A3323 }
N/A3324 break
N/A3325 case "mp_coop_tbeam_polarity3":
N/A3326 GladosPlayVcd(1261)
N/A3327 
N/A3328 break
N/A3329 case "mp_coop_tbeam_maze":
N/A3330 GladosPlayVcd(1127)
N/A3331 break
N/A3332 case "mp_coop_tbeam_end":
N/A3333 GladosPlayVcd(1129)
N/A3334// GladosPrivateTalk(2,9)
N/A3335 break
N/A3336 
N/A3337/////////XXXXXX Building Course
N/A3338 case "mp_coop_paint_come_along":
N/A3339 GladosPlayVcd(1131)
N/A3340 break
N/A3341 case "mp_coop_paint_redirect":
N/A3342 GladosPlayVcd(1133)
N/A3343 break
N/A3344 case "mp_coop_paint_bridge":
N/A3345 GladosPlayVcd(1135)
N/A3346 break
N/A3347 case "mp_coop_paint_walljumps":
N/A3348 GladosPlayVcd(1137)
N/A3349 break
N/A3350 case "mp_coop_paint_speed_fling":
N/A3351 GladosPlayVcd(1139)
N/A3352 break
N/A3353 case "mp_coop_paint_red_racer":
N/A3354 GladosPlayVcd(1141)
N/A3355 break
N/A3356 case "mp_coop_paint_speed_catch":
N/A3357 GladosPlayVcd(1175)
N/A3358 break
N/A3359 case "mp_coop_paint_longjump_intro":
N/A3360 GladosPlayVcd(1143)
N/A3361 break
N/A3362 
N/A3363 }
N/A3364 
N/A3365 //DLC functions
N/A3366 DLC1_GladosCoopMapStart()
N/A3367 //-----------------------------
N/A3368 
N/A3369 StartSpeedRunTimer()
N/A3370}
N/A3371 
N/A3372 
N/A3373//plays when exit door opens
N/A3374function GladosCoopOpenExitDoor(player)
N/A3375{
N/A3376 //endmap stuff
N/A3377 local mapname = GetMapName()
N/A3378 printldebug("****=================================Player "+player+" map NEW CODE"+mapname)
N/A3379 if (debug)
N/A3380 printldebug("****=================================Player "+player+" map "+mapname)
N/A3381 if (coopTriggeredElevator)
N/A3382 {
N/A3383 return
N/A3384 }
N/A3385 coopTriggeredElevator = true
N/A3386 EntFire( "@relay_disable_exit", "Trigger", "", 0.0 )
N/A3387 switch (mapname)
N/A3388 {
N/A3389///////Calibration Course
N/A3390 case "mp_coop_start": //DONE
N/A3391 EntFire( "@relay_enable_exit", "Trigger", "", 0 )
N/A3392 //plays at the end of the taunt stuff
N/A3393 break
N/A3394 
N/A3395///////Team Building Course
N/A3396 case "mp_coop_doors": //Done
N/A3397 GladosPlayVcd(1011)
N/A3398 break
N/A3399 case "mp_coop_race_2": //Done
N/A3400 EntFire( "@relay_enable_exit", "Trigger", "", 0 )
N/A3401 // plays off putting ball in CoopRacePlaceBox
N/A3402 break
N/A3403 case "mp_coop_laser_2": //Done
N/A3404 GladosPlayVcd(18)
N/A3405 break
N/A3406 case "mp_coop_rat_maze": //Done
N/A3407 local x = RandomInt(1,100)
N/A3408 if (x>50){
N/A3409 GladosPlayVcd(1036)
N/A3410 }
N/A3411 else{
N/A3412 GladosPlayVcd(1037)
N/A3413 }
N/A3414 break
N/A3415 case "mp_coop_laser_crusher": // Done
N/A3416 if (mp_coop_laser_crusherdeath==0){
N/A3417 if (player == coopBlue){
N/A3418 GladosPlayVcd(23)
N/A3419 }
N/A3420 else{
N/A3421 GladosPlayVcd(24)
N/A3422 }
N/A3423 }
N/A3424 else{
N/A3425 GladosPlayVcd(1170)
N/A3426 }
N/A3427 break
N/A3428 
N/A3429 
N/A3430 
N/A3431///////Confidence Building Course
N/A3432 case "mp_coop_fling_3":
N/A3433 GladosPlayVcd(1030)
N/A3434 break
N/A3435 case "mp_coop_infinifling_train":
N/A3436 if (mp_coop_infinifling_traindeath>0){
N/A3437 GladosPlayVcd(1049)
N/A3438 }
N/A3439 else{
N/A3440 GladosPlayVcd(1050)
N/A3441 }
N/A3442 break
N/A3443 case "mp_coop_come_along":
N/A3444 if (EarlyDeath4==0){
N/A3445 GladosPlayVcd(1172)
N/A3446 }
N/A3447 else{
N/A3448 GladosPlayVcd(1171)
N/A3449 }
N/A3450// GladosPlayVcd(1034) - removed
N/A3451 break
N/A3452 case "mp_coop_fling_1": //deliberatly blank
N/A3453 EntFire( "@relay_enable_exit", "Trigger", "", 0.0 )
N/A3454 break
N/A3455 case "mp_coop_catapult_1":
N/A3456 EntFire( "@relay_enable_exit", "Trigger", "", 0.0 )
N/A3457 //end speech fired in taunt response
N/A3458 
N/A3459 break
N/A3460 case "mp_coop_multifling_1": // Done
N/A3461 if (EarlyDeath2==0){
N/A3462 GladosPlayVcd(1162)
N/A3463 }
N/A3464 else{
N/A3465 GladosPlayVcd(1052)
N/A3466 }
N/A3467 break
N/A3468 case "mp_coop_fling_crushers": //Map 6
N/A3469 if (EarlyDeath3>0){
N/A3470 GladosPlayVcd(1176)
N/A3471 }
N/A3472 else{
N/A3473 GladosPlayVcd(1053)
N/A3474 }
N/A3475 break
N/A3476 ////mp_coop_fan end with CoopBlueprintRoom function
N/A3477 
N/A3478///////Obstacle Building Course
N/A3479 case "mp_coop_wall_intro":
N/A3480 GladosPlayVcd(1063)
N/A3481 break
N/A3482 case "mp_coop_wall_2":
N/A3483 if (mp_coop_wall_2death==0){
N/A3484 GladosPlayVcd(1113)
N/A3485 break
N/A3486 }
N/A3487 if (mp_coop_wall_2death==1){
N/A3488 GladosPlayVcd(1115)
N/A3489 break
N/A3490 }
N/A3491 if (mp_coop_wall_2death==2){
N/A3492 GladosPlayVcd(1116)
N/A3493 break
N/A3494 }
N/A3495 GladosPlayVcd(1114)
N/A3496 break
N/A3497 case "mp_coop_catapult_wall_intro":
N/A3498 GladosPlayVcd(1082)
N/A3499 break
N/A3500 case "mp_coop_wall_block":
N/A3501 if (mp_coop_wall_blockdeath==1){
N/A3502 GladosPlayVcd(1259)
N/A3503 }
N/A3504 else{
N/A3505 GladosPlayVcd(1120)
N/A3506 }
N/A3507 break
N/A3508 case "mp_coop_catapult_2":
N/A3509 GladosPlayVcd(1144)
N/A3510 break
N/A3511 
N/A3512 
N/A3513 case "mp_coop_turret_walls":
N/A3514 if (mp_coop_turret_wallscount==0){
N/A3515 GladosPlayVcd(1123)
N/A3516 }
N/A3517 else{
N/A3518 GladosPlayVcd(1260)
N/A3519 }
N/A3520 break
N/A3521 case "mp_coop_turret_ball":
N/A3522 GladosPlayVcd(1124)
N/A3523 break
N/A3524 case "mp_coop_wall_5":
N/A3525 GladosPlayVcd(15)
N/A3526 break
N/A3527///////Subterfuge Buidling Course
N/A3528 case "mp_coop_tbeam_redirect":
N/A3529 //moved to normal ending as one in front is rarely end.
N/A3530 break
N/A3531 case "mp_coop_tbeam_drill":
N/A3532 if (IsLocalSplitScreen()){
N/A3533 GladosPlayVcd(1307)
N/A3534 }
N/A3535 else{
N/A3536 GladosPrivateTalk(2,4)
N/A3537 EntFire( "@relay_enable_exit", "Trigger", "", 15.0 )
N/A3538 }
N/A3539 
N/A3540 break
N/A3541 case "mp_coop_tbeam_catch_grind_1":
N/A3542 // chet, I swapped this withtbeam_laser_1 so we can grant the trickfire there -mtw
N/A3543 GladosPlayVcd(1256)
N/A3544 break
N/A3545 case "mp_coop_tbeam_laser_1":
N/A3546 //none here anymore because we gran the trickfire here -mtw
N/A3547 break
N/A3548 case "mp_coop_tbeam_polarity":
N/A3549 if (bluetrust==1)
N/A3550 {
N/A3551 GladosPlayVcd(1071)
N/A3552 }
N/A3553 else
N/A3554 {
N/A3555 GladosPlayVcd(1072)
N/A3556 }
N/A3557 break
N/A3558 case "mp_coop_tbeam_polarity2":
N/A3559 printldebug("-------------------------------->"+polarity2whisper)
N/A3560 if (polarity2whisper == 2){
N/A3561 GladosPlayVcd(1309)
N/A3562 }
N/A3563 else{
N/A3564 GladosPlayVcd(1308)
N/A3565 }
N/A3566 break
N/A3567 case "mp_coop_tbeam_polarity3":
N/A3568 GladosPlayVcd(1174)
N/A3569 break
N/A3570 case "mp_coop_tbeam_maze":
N/A3571 GladosPlayVcd(1128)
N/A3572// GladosPrivateTalk(2,5)
N/A3573 // EntFire( "@relay_enable_exit", "Trigger", "", 10.0 )
N/A3574 break
N/A3575 case "mp_coop_tbeam_end":
N/A3576 GladosPlayVcd(15)
N/A3577 break
N/A3578 
N/A3579/////////XXXXXX Building Course
N/A3580 case "mp_coop_paint_come_along":
N/A3581 GladosPlayVcd(1132)
N/A3582 break
N/A3583 case "mp_coop_paint_redirect":
N/A3584 GladosPlayVcd(1295)
N/A3585 break
N/A3586 case "mp_coop_paint_bridge":
N/A3587 if (HumanResourceDeath2>0){
N/A3588 GladosPlayVcd(1297)
N/A3589 }
N/A3590 else{
N/A3591 GladosPlayVcd(1298)
N/A3592 }
N/A3593 break
N/A3594 case "mp_coop_paint_walljumps":
N/A3595 GladosPlayVcd(1138)
N/A3596 break
N/A3597 case "mp_coop_paint_speed_fling":
N/A3598 GladosPlayVcd(1140)
N/A3599 break
N/A3600 case "mp_coop_paint_red_racer":
N/A3601 GladosPlayVcd(1142)
N/A3602 break
N/A3603 case "mp_coop_paint_speed_catch":
N/A3604 GladosPlayVcd(1262)
N/A3605 break
N/A3606 case "mp_coop_paint_longjump_intro":
N/A3607 GladosPlayVcd(15)
N/A3608 break
N/A3609 }
N/A3610 
N/A3611 //DLC functions
N/A3612 DLC1_GladosCoopOpenExitDoor(player)
N/A3613 //-----------------------------
N/A3614 
N/A3615 EndSpeedRunTimer()
N/A3616 
N/A3617 CheckAchievementsOnExitDoorOpen()
N/A3618}
N/A3619 
N/A3620function CheckAchievementsOnExitDoorOpen()
N/A3621{
N/A3622 // If the player completed the specified map using only a few portals.
N/A3623 if ( GetMapName() == LIMITED_PORTALS_MAP &&
N/A3624 CoopGetNumPortalsPlaced() <= LIMITED_PORTALS_COUNT )
N/A3625 {
N/A3626 RecordAchievementEvent( "ACH.LIMITED_PORTALS", GetBluePlayerIndex() )
N/A3627 RecordAchievementEvent( "ACH.LIMITED_PORTALS", GetOrangePlayerIndex() )
N/A3628 }
N/A3629}
N/A3630 
N/A3631function StartSpeedRunTimer()
N/A3632{
N/A3633 mp_coop_speed_run_time = Time()
N/A3634}
N/A3635 
N/A3636function EndSpeedRunTimer()
N/A3637{
N/A3638 local run_length = Time() - mp_coop_speed_run_time
N/A3639 SetMapRunTime( run_length )
N/A3640}
N/A3641 
N/A3642function SetMapRunTime( flTime )
N/A3643{
N/A3644 // cap it at two hours
N/A3645 if ( flTime > 7200.0 )
N/A3646 {
N/A3647 flTime = 7200.0
N/A3648 }
N/A3649 
N/A3650 CoopSetMapRunTime( flTime )
N/A3651 
N/A3652 if ( flTime < SPEED_RUN_THRESHOLD &&
N/A3653 GetCoopSectionIndex() == SPEED_RUN_SECTION )
N/A3654 {
N/A3655 NotifySpeedRunSuccess( flTime, GetMapName() )
N/A3656 }
N/A3657}
N/A3658 
N/A3659function CoopRacePlaceBox()
N/A3660{
N/A3661 local mapname = GetMapName()
N/A3662 if (mapname == "mp_coop_race_2")
N/A3663 {
N/A3664 GladosPlayVcd(19)
N/A3665 }
N/A3666}
N/A3667 
N/A3668 
N/A3669 
N/A3670//Plays the final audio for each level
N/A3671function GladosCoopElevatorEntrance(arg)
N/A3672{
N/A3673 printldebug("====================================Player "+arg+" OLD CODE")
N/A3674 local mapname = GetMapName()
N/A3675 switch (mapname)
N/A3676 {
N/A3677/////////Calibration Course
N/A3678// case "mp_coop_start": //DONE
N/A3679// EntFire( "@relay_enable_exit", "Trigger", "", 0.0 )
N/A3680// //plays at the end of the taunt stuff
N/A3681// break
N/A3682//
N/A3683/////////Team Building Course
N/A3684// case "mp_coop_doors": //Done
N/A3685// GladosPlayVcd(1011)
N/A3686// break
N/A3687// case "mp_coop_race_2": //Done
N/A3688// GladosPlayVcd(19)
N/A3689// break
N/A3690// case "mp_coop_laser_2": //Done
N/A3691// GladosPlayVcd(18)
N/A3692// break
N/A3693// case "mp_coop_rat_maze": //Done
N/A3694// local x = RandomInt(1,100)
N/A3695// if (x>50){
N/A3696// GladosPlayVcd(1036)
N/A3697// }
N/A3698// else{
N/A3699// GladosPlayVcd(1037)
N/A3700// }
N/A3701// break
N/A3702// case "mp_coop_laser_crusher": // Done
N/A3703// if (arg == coopBlue)
N/A3704// GladosPlayVcd(23)
N/A3705// else
N/A3706// GladosPlayVcd(24)
N/A3707// break
N/A3708// //mp_coop_teambts end with GladosCoopEnterRadarRoom function
N/A3709//
N/A3710//
N/A3711/////////Confidence Building Course
N/A3712// case "mp_coop_fling_3":
N/A3713// GladosPlayVcd(1030)
N/A3714// break
N/A3715// case "mp_coop_infinifling_train":
N/A3716// if (mp_coop_infinifling_traindeath>0){
N/A3717// GladosPlayVcd(1049)
N/A3718// }
N/A3719// else{
N/A3720// GladosPlayVcd(1050)
N/A3721// }
N/A3722// break
N/A3723// case "mp_coop_come_along":
N/A3724// GladosPlayVcd(1034)
N/A3725// break
N/A3726// case "mp_coop_fling_1": //deliberatly blank
N/A3727// EntFire( "@relay_enable_exit", "Trigger", "", 0.0 )
N/A3728// break
N/A3729// case "mp_coop_catapult_1":
N/A3730// EntFire( "@relay_enable_exit", "Trigger", "", 0.0 )
N/A3731// //end speech fired in taunt response
N/A3732//
N/A3733// break
N/A3734// case "mp_coop_multifling_1": // Done
N/A3735// GladosPlayVcd(1052)
N/A3736// break
N/A3737// case "mp_coop_fling_crushers": //Map 6
N/A3738// GladosPlayVcd(1053)
N/A3739// break
N/A3740// ////mp_coop_fan end with CoopBlueprintRoom function
N/A3741//
N/A3742/////////Obstacle Building Course
N/A3743// case "mp_coop_wall_intro":
N/A3744// GladosPlayVcd(1082)
N/A3745// break
N/A3746// case "mp_coop_wall_2":
N/A3747// GladosPlayVcd(15)
N/A3748// break
N/A3749// case "mp_coop_catapult_wall_intro":
N/A3750// GladosPlayVcd(15)
N/A3751// break
N/A3752// case "mp_coop_wall_block":
N/A3753// GladosPlayVcd(15)
N/A3754// break
N/A3755// case "mp_coop_catapult_2":
N/A3756//// if (OrangeTalk>500 && BlueTalk==0)
N/A3757//// GladosPlayVcd(15)
N/A3758//// break
N/A3759//// }
N/A3760//// else{
N/A3761//// if (BlueTalk>500 && OrangeTalk==0)
N/A3762//// GladosPlayVcd(15)
N/A3763//// break
N/A3764//// }
N/A3765////
N/A3766//// }
N/A3767// GladosPlayVcd(15)
N/A3768// break
N/A3769// //didn't hook up sound stuff because quiet person may still have noisy avatar - need more thinking on this.
N/A3770//
N/A3771//
N/A3772// case "mp_coop_turret_walls":
N/A3773// GladosPlayVcd(15)
N/A3774// break
N/A3775// case "mp_coop_turret_ball":
N/A3776// GladosPlayVcd(15)
N/A3777// break
N/A3778// case "mp_coop_wall_5":
N/A3779// GladosPlayVcd(15)
N/A3780// break
N/A3781/////////Subterfuge Buidling Course
N/A3782 case "mp_coop_tbeam_redirect":
N/A3783 if (IsLocalSplitScreen()){
N/A3784 GladosPlayVcd(1305)
N/A3785 }
N/A3786 else{
N/A3787 EntFire( "@relay_disable_exit", "Trigger", "", 0.0 )
N/A3788 GladosPrivateTalk(1,1)
N/A3789 EntFire( "@relay_enable_exit", "Trigger", "", 13.0 )
N/A3790 break
N/A3791 }
N/A3792// case "mp_coop_tbeam_drill":
N/A3793// GladosPrivateTalk(2,4)
N/A3794// EntFire( "@relay_enable_exit", "Trigger", "", 15.0 )
N/A3795// break
N/A3796// case "mp_coop_tbeam_catch_grind_1":
N/A3797// GladosPrivateTalk(1,2)
N/A3798// EntFire( "@relay_enable_exit", "Trigger", "", 14.0 )
N/A3799// break
N/A3800// case "mp_coop_tbeam_laser_1":
N/A3801// GladosPrivateTalk(2,3)
N/A3802// EntFire( "@relay_enable_exit", "Trigger", "", 12.0 )
N/A3803// break
N/A3804// case "mp_coop_tbeam_polarity":
N/A3805// if (bluetrust==1)
N/A3806// {
N/A3807// GladosPlayVcd(1071)
N/A3808// }
N/A3809// else
N/A3810// {
N/A3811// GladosPlayVcd(1072)
N/A3812// }
N/A3813// break
N/A3814// case "mp_coop_tbeam_polarity2":
N/A3815// GladosPlayVcd(15)
N/A3816// break
N/A3817// case "mp_coop_tbeam_polarity3":
N/A3818// GladosPlayVcd(15)
N/A3819// break
N/A3820// case "mp_coop_tbeam_maze":
N/A3821// GladosPrivateTalk(2,5)
N/A3822// EntFire( "@relay_enable_exit", "Trigger", "", 10.0 )
N/A3823// break
N/A3824// case "mp_coop_tbeam_end":
N/A3825// GladosPlayVcd(15)
N/A3826// break
N/A3827//
N/A3828///////////XXXXXX Building Course
N/A3829// case "mp_coop_paint_come_along":
N/A3830// GladosPlayVcd(15)
N/A3831// break
N/A3832// case "mp_coop_paint_redirect":
N/A3833// GladosPlayVcd(15)
N/A3834// break
N/A3835// case "mp_coop_paint_bridge":
N/A3836// GladosPlayVcd(15)
N/A3837// break
N/A3838// case "mp_coop_paint_walljumps":
N/A3839// GladosPlayVcd(15)
N/A3840// break
N/A3841// case "mp_coop_paint_speed_fling":
N/A3842// GladosPlayVcd(15)
N/A3843// break
N/A3844// case "mp_coop_paint_red_racer":
N/A3845// GladosPlayVcd(15)
N/A3846// break
N/A3847// case "mp_coop_paint_speed_catch":
N/A3848// GladosPlayVcd(15)
N/A3849// break
N/A3850// case "mp_coop_paint_longjump_intro":
N/A3851// GladosPlayVcd(15)
N/A3852// break
N/A3853 }
N/A3854}
N/A3855 
N/A3856 
N/A3857 
N/A3858 
N/A3859function CoopPingTool(player,surface)
N/A3860{
N/A3861 local curTime = Time()
N/A3862 local mapname = GetMapName()
N/A3863 printldebug(surface)
N/A3864 if (player == coopBlue){
N/A3865 if (BlueInPortalTraining == 1 && BlueHasGun == 0 && mapname == "mp_coop_start"){
N/A3866 local BluePingInterval = curTime-BlueLastPing
N/A3867 local BluePingInterval2 = curTime-BluePortalTrainingCounter
N/A3868 BlueLastPing = curTime
N/A3869 if (surface==1 && BluePortalTrainingCounter==0 && BluePingTraining1==0){
N/A3870 BluePortalTrainingCounter=Time()
N/A3871 BluePingInterval2=0
N/A3872 BluePingTraining1=1
N/A3873 GladosPlayVcd(1000)
N/A3874 
N/A3875 }
N/A3876 if (surface==1 && BluePingInterval2>7 && BluePortalTrainingCounter!=0 && BluePingTraining2==0){
N/A3877 BluePortalTrainingCounter=0
N/A3878 BluePingTraining2=1
N/A3879 GladosPlayVcd(1001)
N/A3880 }
N/A3881 }
N/A3882 }
N/A3883 
N/A3884 if (player == coopOrange){
N/A3885 if (OrangeInPortalTraining == 1 && OrangeHasGun == 0 && mapname == "mp_coop_start"){
N/A3886 local OrangePingInterval = curTime-OrangeLastPing
N/A3887 local OrangePingInterval2 = curTime-OrangePortalTrainingCounter
N/A3888 OrangeLastPing = curTime
N/A3889 if (surface==1 && OrangePortalTrainingCounter==0 && OrangePingTraining1==0){
N/A3890 OrangePortalTrainingCounter=Time()
N/A3891 OrangePingInterval2=0
N/A3892 OrangePingTraining1=1
N/A3893 GladosPlayVcd(1014)
N/A3894 
N/A3895 }
N/A3896 if (surface==1 && OrangePingInterval2>7 && OrangePortalTrainingCounter!=0 && OrangePingTraining2==0){
N/A3897 OrangePortalTrainingCounter=0
N/A3898 OrangePingTraining2=1
N/A3899 GladosPlayVcd(1015)
N/A3900 }
N/A3901 }
N/A3902 }
N/A3903}
N/A3904 
N/A3905/////// Subterfuge section
N/A3906 
N/A3907function CoopPolarityWhisper(player){
N/A3908 if (player == coopBlue){
N/A3909 GladosPlayVcd(1066)
N/A3910 polarity2whisper=2
N/A3911 }
N/A3912 else{
N/A3913 GladosPlayVcd(1067)
N/A3914 polarity2whisper=1
N/A3915 }
N/A3916}
N/A3917 
N/A3918 
N/A3919 
N/A3920function CoopReturnHubTrack01(){
N/A3921 local tVcd
N/A3922 tVcd=RandomInt(1263,1266)
N/A3923 printldebug("THIS IS RANDOM:"+ tVcd)
N/A3924 GladosPlayVcd(tVcd)
N/A3925}
N/A3926 
N/A3927function CoopReturnHubTrack02(){
N/A3928 local tVcd
N/A3929 tVcd=RandomInt(1267,1270)
N/A3930 printldebug("THIS IS RANDOM:"+ tVcd)
N/A3931 GladosPlayVcd(tVcd)
N/A3932 
N/A3933}
N/A3934 
N/A3935function CoopReturnHubTrack03(){
N/A3936 local tVcd
N/A3937 tVcd=RandomInt(1271,1273)
N/A3938 printldebug("THIS IS RANDOM:"+ tVcd)
N/A3939 GladosPlayVcd(tVcd)
N/A3940}
N/A3941 
N/A3942function CoopReturnHubTrack04(){
N/A3943 local tVcd
N/A3944 tVcd=RandomInt(1274,1276)
N/A3945 printldebug("THIS IS RANDOM:"+ tVcd)
N/A3946 GladosPlayVcd(tVcd)
N/A3947}
N/A3948 
N/A3949function CoopReturnHubTrack05(){
N/A3950 local tVcd
N/A3951 tVcd=RandomInt(1277,1279)
N/A3952 printldebug("THIS IS RANDOM:"+ tVcd)
N/A3953 GladosPlayVcd(tVcd)
N/A3954}
N/A3955 
N/A3956function CoopReturnHubTrack06(){ // FIX ME
N/A3957 local tVcd
N/A3958 tVcd=RandomInt(1277,1279)
N/A3959 printldebug("THIS IS RANDOM:"+ tVcd)
N/A3960 GladosPlayVcd(tVcd)
N/A3961}
N/A3962 
N/A3963function CoopReturnHubAllFinished(){
N/A3964 local tVcd
N/A3965 tVcd=RandomInt(1280,1286)
N/A3966 printldebug("THIS IS RANDOM:"+ tVcd)
N/A3967 GladosPlayVcd(tVcd)
N/A3968 
N/A3969}
N/A3970 
N/A3971function PlayerTauntCamera (player,animation){
N/A3972 printldebug("===============>CAMERA GESTURE!"+player+" x "+animation)
N/A3973 //added to block playing of responses while at vault door.
N/A3974 if (curMapName == "mp_coop_paint_longjump_intro"){
N/A3975 return
N/A3976 }
N/A3977 
N/A3978 local curTime=Time()
N/A3979 if (curTime-LastTauntTime<5){
N/A3980 return
N/A3981 }
N/A3982 LastTauntTime=Time()
N/A3983 local tauntflag0 = GetGladosSpokenFlags( 0 ) //30
N/A3984 local tauntflag1 = GetGladosSpokenFlags( 1 ) //18
N/A3985 local tauntflag2 = GetGladosSpokenFlags( 2 )
N/A3986 local tauntflag3 = GetGladosSpokenFlags( 3 ) //4 used for deaths
N/A3987 
N/A3988 if (((tauntflag1 & (1 << 18)) == 0) && (curMapName == "mp_coop_race_2" || curMapName == "mp_coop_laser_2" || curMapName == "mp_coop_fling_3")){
N/A3989 local TellStory = 0
N/A3990 local Player2
N/A3991 while ( Player2 = Entities.FindByName ( Player2, "blue" ) )
N/A3992 {
N/A3993 print ( "Canceling:\t" + Player2.GetName() + "\n" )
N/A3994 if (Player2 !=null){
N/A3995 break
N/A3996 }
N/A3997 }
N/A3998 if ( Player2!=null){
N/A3999 local vecPlayerPos=Player2.GetOrigin()
N/A4000 local Door
N/A4001 while ( Door = (Entities.FindByNameNearest( "@exit_door", vecPlayerPos, 600 )) )
N/A4002 {
N/A4003 if (Door !=null){
N/A4004 TellStory = 1
N/A4005 break
N/A4006 }
N/A4007 }
N/A4008 }
N/A4009 if (TellStory==0){
N/A4010 tauntflag1 = tauntflag1 + (1 << 18)
N/A4011 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4012 GladosPlayVcd(1330)
N/A4013 return
N/A4014 }
N/A4015 }
N/A4016 
N/A4017 if ( animation == "smallWave" ){
N/A4018 if ((tauntflag0 & (1 << 0)) == 0){
N/A4019 tauntflag0 = tauntflag0 + (1 << 0)
N/A4020 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4021 GladosPlayVcd(1227)
N/A4022 return
N/A4023 }
N/A4024 if ((tauntflag0 & (1 << 1)) == 0){
N/A4025 tauntflag0 = tauntflag0 + (1 << 1)
N/A4026 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4027 GladosPlayVcd(1228)
N/A4028 return
N/A4029 }
N/A4030 if ((tauntflag0 & (1 << 2)) == 0){
N/A4031 tauntflag0 = tauntflag0 + (1 << 2)
N/A4032 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4033 GladosPlayVcd(1229)
N/A4034 return
N/A4035 }
N/A4036 if ((tauntflag0 & (1 << 26)) == 0){
N/A4037 tauntflag0 = tauntflag0 + (1 << 26)
N/A4038 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4039 GladosPlayVcd(1234)
N/A4040 return
N/A4041 }
N/A4042 if ((tauntflag0 & (1 << 28)) == 0){
N/A4043 tauntflag0 = tauntflag0 + (1 << 28)
N/A4044 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4045 GladosPlayVcd(1236)
N/A4046 return
N/A4047 }
N/A4048 if ((tauntflag0 & (1 << 29)) == 0){
N/A4049 tauntflag0 = tauntflag0 + (1 << 29)
N/A4050 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4051 GladosPlayVcd(1237)
N/A4052 return
N/A4053 }
N/A4054 if ((tauntflag0 & (1 << 30)) == 0){
N/A4055 tauntflag0 = tauntflag0 + (1 << 30)
N/A4056 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4057 GladosPlayVcd(1238)
N/A4058 return
N/A4059 }
N/A4060 }
N/A4061 
N/A4062 
N/A4063 if ( animation == "highFive" ){
N/A4064 if ((tauntflag0 & (1 << 3)) == 0){
N/A4065 tauntflag0 = tauntflag0 + (1 << 3)
N/A4066 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4067 GladosPlayVcd(1207)
N/A4068 return
N/A4069 }
N/A4070 if ((tauntflag0 & (1 << 4)) == 0){
N/A4071 tauntflag0 = tauntflag0 + (1 << 4)
N/A4072 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4073 GladosPlayVcd(1208)
N/A4074 return
N/A4075 }
N/A4076 if ((tauntflag0 & (1 << 5)) == 0){
N/A4077 tauntflag0 = tauntflag0 + (1 << 5)
N/A4078 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4079 GladosPlayVcd(1209)
N/A4080 return
N/A4081 }
N/A4082 if ((tauntflag1 & (1 << 0)) == 0){
N/A4083 tauntflag1 = tauntflag1 + (1 << 0)
N/A4084 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4085 GladosPlayVcd(1248)
N/A4086 return
N/A4087 }
N/A4088 if ((tauntflag1 & (1 << 1)) == 0){
N/A4089 tauntflag1 = tauntflag1 + (1 << 1)
N/A4090 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4091 GladosPlayVcd(1249)
N/A4092 return
N/A4093 }
N/A4094 if ((tauntflag1 & (1 << 2)) == 0){
N/A4095 tauntflag1 = tauntflag1 + (1 << 2)
N/A4096 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4097 GladosPlayVcd(1251)
N/A4098 return
N/A4099 }
N/A4100 if ((tauntflag1 & (1 << 9)) == 0){
N/A4101 tauntflag1 = tauntflag1 + (1 << 9)
N/A4102 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4103 GladosPlayVcd(1289)
N/A4104 return
N/A4105 }
N/A4106 
N/A4107 }
N/A4108 
N/A4109 if ( animation == "teamhug" ){
N/A4110 if ((tauntflag0 & (1 << 6)) == 0){
N/A4111 tauntflag0 = tauntflag0 + (1 << 6)
N/A4112 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4113 GladosPlayVcd(1210)
N/A4114 return
N/A4115 }
N/A4116 if ((tauntflag0 & (1 << 7)) == 0){
N/A4117 tauntflag0 = tauntflag0 + (1 << 7)
N/A4118 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4119 GladosPlayVcd(1211)
N/A4120 return
N/A4121 }
N/A4122 if ((tauntflag0 & (1 << 8)) == 0){
N/A4123 tauntflag0 = tauntflag0 + (1 << 8)
N/A4124 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4125 GladosPlayVcd(1212)
N/A4126 return
N/A4127 }
N/A4128 if ((tauntflag1 & (1 << 3)) == 0){
N/A4129 tauntflag1 = tauntflag1 + (1 << 3)
N/A4130 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4131 GladosPlayVcd(1221)
N/A4132 return
N/A4133 }
N/A4134 if ((tauntflag1 & (1 << 4)) == 0){
N/A4135 tauntflag1 = tauntflag1 + (1 << 4)
N/A4136 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4137 GladosPlayVcd(1231)
N/A4138 return
N/A4139 }
N/A4140 if ((tauntflag1 & (1 << 10)) == 0){
N/A4141 tauntflag1 = tauntflag1 + (1 << 10)
N/A4142 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4143 GladosPlayVcd(1290)
N/A4144 return
N/A4145 }
N/A4146 
N/A4147 }
N/A4148 
N/A4149 if ( animation == "TeamEggTease" || animation == "TeamBallTease" ){
N/A4150 if ((tauntflag0 & (1 << 9)) == 0){
N/A4151 tauntflag0 = tauntflag0 + (1 << 9)
N/A4152 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4153 GladosPlayVcd(1213)
N/A4154 return
N/A4155 }
N/A4156 if ((tauntflag0 & (1 << 10)) == 0){
N/A4157 tauntflag0 = tauntflag0 + (1 << 10)
N/A4158 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4159 GladosPlayVcd(1214)
N/A4160 return
N/A4161 }
N/A4162 if ((tauntflag0 & (1 << 11)) == 0){
N/A4163 tauntflag0 = tauntflag0 + (1 << 11)
N/A4164 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4165 GladosPlayVcd(1215)
N/A4166 return
N/A4167 }
N/A4168 if ((tauntflag0 & (1 << 12)) == 0){
N/A4169 tauntflag0 = tauntflag0 + (1 << 12)
N/A4170 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4171 GladosPlayVcd(1216)
N/A4172 return
N/A4173 }
N/A4174 if ((tauntflag1 & (1 << 8)) == 0){
N/A4175 tauntflag1 = tauntflag1 + (1 << 8)
N/A4176 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4177 GladosPlayVcd(1288)
N/A4178 return
N/A4179 }
N/A4180 
N/A4181 }
N/A4182 
N/A4183 
N/A4184 if ( animation == "laugh" ){
N/A4185 if ((tauntflag0 & (1 << 13)) == 0){
N/A4186 tauntflag0 = tauntflag0 + (1 << 13)
N/A4187 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4188 GladosPlayVcd(1239)
N/A4189 return
N/A4190 }
N/A4191 if ((tauntflag0 & (1 << 14)) == 0){
N/A4192 tauntflag0 = tauntflag0 + (1 << 14)
N/A4193 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4194 GladosPlayVcd(1254)
N/A4195 return
N/A4196 }
N/A4197 
N/A4198 if ((tauntflag0 & (1 << 15)) == 0){
N/A4199 tauntflag0 = tauntflag0 + (1 << 15)
N/A4200 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4201 GladosPlayVcd(1240)
N/A4202 return
N/A4203 }
N/A4204 if ((tauntflag0 & (1 << 16)) == 0){
N/A4205 tauntflag0 = tauntflag0 + (1 << 16)
N/A4206 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4207 GladosPlayVcd(1241)
N/A4208 return
N/A4209 }
N/A4210 if ((tauntflag0 & (1 << 17)) == 0){
N/A4211 tauntflag0 = tauntflag0 + (1 << 17)
N/A4212 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4213 GladosPlayVcd(1253)
N/A4214 return
N/A4215 }
N/A4216 if ((tauntflag1 & (1 << 11)) == 0){
N/A4217 tauntflag1 = tauntflag1 + (1 << 11)
N/A4218 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4219 GladosPlayVcd(1291)
N/A4220 return
N/A4221 }
N/A4222 
N/A4223 }
N/A4224 
N/A4225 if ( animation == "robotDance" ){
N/A4226 if ((tauntflag0 & (1 << 18)) == 0){
N/A4227 tauntflag0 = tauntflag0 + (1 << 18)
N/A4228 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4229 GladosPlayVcd(1242)
N/A4230 return
N/A4231 }
N/A4232 if ((tauntflag0 & (1 << 19)) == 0){
N/A4233 tauntflag0 = tauntflag0 + (1 << 19)
N/A4234 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4235 GladosPlayVcd(1243)
N/A4236 return
N/A4237 }
N/A4238 if ((tauntflag1 & (1 << 12)) == 0){
N/A4239 tauntflag1 = tauntflag1 + (1 << 12)
N/A4240 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4241 GladosPlayVcd(1292)
N/A4242 return
N/A4243 }
N/A4244 
N/A4245 if ((tauntflag0 & (1 << 20)) == 0){
N/A4246 tauntflag0 = tauntflag0 + (1 << 20)
N/A4247 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4248 GladosPlayVcd(1244)
N/A4249 return
N/A4250 }
N/A4251 if ((tauntflag0 & (1 << 21)) == 0){
N/A4252 tauntflag0 = tauntflag0 + (1 << 21)
N/A4253 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4254 GladosPlayVcd(1245)
N/A4255 return
N/A4256 }
N/A4257 if ((tauntflag0 & (1 << 22)) == 0){
N/A4258 tauntflag0 = tauntflag0 + (1 << 22)
N/A4259 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4260 GladosPlayVcd(1246)
N/A4261 return
N/A4262 }
N/A4263 if ((tauntflag0 & (1 << 23)) == 0){
N/A4264 tauntflag0 = tauntflag0 + (1 << 23)
N/A4265 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4266 GladosPlayVcd(1247)
N/A4267 return
N/A4268 }
N/A4269 }
N/A4270 
N/A4271 if ( animation == "rps" ){
N/A4272 if ((tauntflag0 & (1 << 24)) == 0){
N/A4273 tauntflag0 = tauntflag0 + (1 << 24)
N/A4274 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4275 GladosPlayVcd(1217)
N/A4276 return
N/A4277 }
N/A4278 if ((tauntflag0 & (1 << 25)) == 0){
N/A4279 tauntflag0 = tauntflag0 + (1 << 25)
N/A4280 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4281 GladosPlayVcd(1218)
N/A4282 return
N/A4283 }
N/A4284 if ((tauntflag0 & (1 << 27)) == 0){
N/A4285 tauntflag0 = tauntflag0 + (1 << 27)
N/A4286 AddGladosSpokenFlags( 0, tauntflag0 )
N/A4287 GladosPlayVcd(1235)
N/A4288 return
N/A4289 }
N/A4290 if ((tauntflag1 & (1 << 5)) == 0){
N/A4291 tauntflag1 = tauntflag1 + (1 << 5)
N/A4292 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4293 GladosPlayVcd(1232)
N/A4294 return
N/A4295 }
N/A4296 if ((tauntflag1 & (1 << 6)) == 0){
N/A4297 tauntflag1 = tauntflag1 + (1 << 6)
N/A4298 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4299 GladosPlayVcd(1233)
N/A4300 return
N/A4301 }
N/A4302 if ((tauntflag1 & (1 << 13)) == 0){
N/A4303 tauntflag1 = tauntflag1 + (1 << 13)
N/A4304 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4305 GladosPlayVcd(1287)
N/A4306 return
N/A4307 }
N/A4308 }
N/A4309 if ( animation == "trickfire" ){
N/A4310 if ((tauntflag1 & (1 << 14)) == 0){
N/A4311 tauntflag1 = tauntflag1 + (1 << 14)
N/A4312 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4313 GladosPlayVcd(1252)
N/A4314 return
N/A4315 }
N/A4316 
N/A4317 if ((tauntflag1 & (1 << 15)) == 0){
N/A4318 tauntflag1 = tauntflag1 + (1 << 15)
N/A4319 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4320 GladosPlayVcd(1327)
N/A4321 return
N/A4322 }
N/A4323 if ((tauntflag1 & (1 << 16)) == 0){
N/A4324 tauntflag1 = tauntflag1 + (1 << 16)
N/A4325 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4326 GladosPlayVcd(1328)
N/A4327 return
N/A4328 }
N/A4329 if ((tauntflag1 & (1 << 17)) == 0){
N/A4330 tauntflag1 = tauntflag1 + (1 << 17)
N/A4331 AddGladosSpokenFlags( 1, tauntflag1 )
N/A4332 GladosPlayVcd(1329)
N/A4333 return
N/A4334 }
N/A4335 }
N/A4336 
N/A4337 
N/A4338 
N/A4339}
N/A4340 
N/A4341function CoopBotAnimation(player,animation)
N/A4342{
N/A4343 
N/A4344 testcnt=testcnt+1
N/A4345 printldebug("===============>TEST TEST :"+testcnt)
N/A4346 printldebug("===============>GESTURE!"+player+" x "+animation)
N/A4347 
N/A4348 if (GladosInsideTauntCam == 1 ){
N/A4349 if (player==1){
N/A4350 OrangeTauntCam=1
N/A4351 OrangeTauntFinaleInterval = Time()
N/A4352 }
N/A4353 if (player==2){
N/A4354 BlueTauntCam=1
N/A4355 BlueTauntFinaleInterval = Time()
N/A4356 
N/A4357 }
N/A4358 if (BlueTauntCam==1 && OrangeTauntCam==1){
N/A4359 
N/A4360 GladosInsideTauntCam = 0
N/A4361 printldebug("===============>CAM TEST :"+GladosInsideTauntCam)
N/A4362 printldebug("===============>CAM TEST :"+GladosInsideTauntCam)
N/A4363 printldebug("===============>CAM TEST :"+GladosInsideTauntCam)
N/A4364 printldebug("===============>CAM TEST :"+GladosInsideTauntCam)
N/A4365 printldebug("===============>CAM TEST :"+GladosInsideTauntCam)
N/A4366 GladosPlayVcd(1161)
N/A4367 
N/A4368 }
N/A4369 }
N/A4370 
N/A4371 if (curMapName == "mp_coop_teambts"){
N/A4372 local curTime=Time()
N/A4373 if (curTime-LastTauntTime<5){
N/A4374 return
N/A4375 }
N/A4376 LastTauntTime=Time()
N/A4377 teambtstaunts=teambtstaunts+1
N/A4378 switch (teambtstaunts)
N/A4379 {
N/A4380 case 1:
N/A4381 if (player == coopBlue){
N/A4382 GladosPlayVcd(1100)
N/A4383 }
N/A4384 else{
N/A4385 GladosPlayVcd(1101)
N/A4386 }
N/A4387 break
N/A4388 
N/A4389 case 2:
N/A4390 GladosPlayVcd(1102)
N/A4391 break
N/A4392 
N/A4393 case 3:
N/A4394 if (player == coopBlue){
N/A4395 GladosPlayVcd(1103)
N/A4396 }
N/A4397 else{
N/A4398 GladosPlayVcd(1104)
N/A4399 }
N/A4400 break
N/A4401 
N/A4402 case 4:
N/A4403 GladosPlayVcd(1105)
N/A4404 break
N/A4405 
N/A4406 case 5:
N/A4407 GladosPlayVcd(1106)
N/A4408 break
N/A4409 }
N/A4410 }
N/A4411}
N/A4412 
N/A4413///bit for killing stuck players in tbeam
N/A4414function GladosCoopKillTbeamMaze(){
N/A4415 GladosPlayVcd(1304)
N/A4416}
N/A4417 
N/A4418function CoopCubeFizzle(){
N/A4419 local curMapName = GetMapName()
N/A4420 if (curMapName=="mp_coop_multifling_1"){
N/A4421 switch (mp_coop_multifling_1cube)
N/A4422 {
N/A4423 case 0:
N/A4424 mp_coop_multifling_1cube = 1
N/A4425 GladosPlayVcd(1310)
N/A4426 break
N/A4427 case 1:
N/A4428 mp_coop_multifling_1cube = 2
N/A4429 GladosPlayVcd(1311)
N/A4430 break
N/A4431 case 2:
N/A4432 mp_coop_multifling_1cube = 3
N/A4433 GladosPlayVcd(1312)
N/A4434 break
N/A4435 case 3:
N/A4436 mp_coop_multifling_1cube = 4
N/A4437 GladosPlayVcd(1313)
N/A4438 break
N/A4439 }
N/A4440 }
N/A4441}
N/A4442 
N/A4443// Announcer Stuf
N/A4444function CoopHubAllFinished()
N/A4445{
N/A4446 local x = RandomInt(1,100)
N/A4447 if (x>66)
N/A4448 {
N/A4449 GladosPlayVcd(1108)
N/A4450 }
N/A4451 else
N/A4452 {
N/A4453 if (x>33)
N/A4454 {
N/A4455 GladosPlayVcd(1109)
N/A4456 }
N/A4457 else{
N/A4458 GladosPlayVcd(1110)
N/A4459 }
N/A4460 }
N/A4461}
N/A4462 
N/A4463 
N/A4464 
N/A4465//--------------------------------------------------------------------------------------------------------------
N/A4466//DLC 1 FUNCTIONS
N/A4467//--------------------------------------------------------------------------------------------------------------
N/A4468 
N/A4469function DLC1_GladosCoopMapStart(){
N/A4470 local curMapName = GetMapName()
N/A4471 switch (curMapName)
N/A4472 {
N/A4473 case "mp_coop_separation_1":
N/A4474 GladosPlayVcd(-10000)
N/A4475 break
N/A4476 case "mp_coop_catapult_catch":
N/A4477 GladosPlayVcd(-10030)
N/A4478 break
N/A4479 case "mp_coop_2paints_1bridge":
N/A4480 GladosPlayVcd(-10040)
N/A4481 break
N/A4482 case "mp_coop_bridge_catch":
N/A4483 GladosPlayVcd(-10100)
N/A4484 break
N/A4485 case "mp_coop_laser_tbeam":
N/A4486 GladosPlayVcd(-10120)
N/A4487 break
N/A4488 case "mp_coop_paint_rat_maze":
N/A4489 GladosPlayVcd(-10130)
N/A4490 break
N/A4491 case "mp_coop_paint_crazy_box":
N/A4492 GladosPlayVcd(-10140)
N/A4493 break
N/A4494 }
N/A4495}
N/A4496 
N/A4497 
N/A4498function DLC1_GladosCoopOpenExitDoor(player)
N/A4499{
N/A4500 local mapname = GetMapName()
N/A4501 switch (curMapName)
N/A4502 {
N/A4503 case "mp_coop_separation_1":
N/A4504 GladosPlayVcd(-10010)
N/A4505 break
N/A4506 case "mp_coop_tripleaxis":
N/A4507 GladosPlayVcd(-10025)
N/A4508 break
N/A4509 case "mp_coop_catapult_catch":
N/A4510 GladosPlayVcd(-10035)
N/A4511 break
N/A4512 case "mp_coop_2paints_1bridge":
N/A4513 GladosPlayVcd(-10045)
N/A4514 break
N/A4515 case "mp_coop_bridge_catch":
N/A4516 GladosPlayVcd(-10105)
N/A4517 break
N/A4518 case "mp_coop_laser_tbeam":
N/A4519 GladosPlayVcd(-10125)
N/A4520 break
N/A4521 case "mp_coop_paint_rat_maze":
N/A4522 GladosPlayVcd(-10135)
N/A4523 break
N/A4524 case "mp_coop_paint_crazy_box":
N/A4525 GladosPlayVcd(-10145)
N/A4526 break
N/A4527 }
N/A4528}
N/A4529 
N/A4530function DLC1_mp_coop_tripleaxis_intro()
N/A4531{
N/A4532 GladosPlayVcd(-10020)
N/A4533}
N/A4534 
N/A4535function DLC1_mp_coop_2paints_1bridge_machine_break()
N/A4536{
N/A4537 GladosPlayVcd(-10050)
N/A4538}
N/A4539 
N/A4540//On start of night vision gag
N/A4541function DLC1_mp_coop_paint_crazy_box_lightsout()
N/A4542{
N/A4543 GladosPlayVcd(-10145)
N/A4544}
N/A4545 
N/A4546//On final gantry gate starting to open
N/A4547function DLC1_mp_coop_paint_crazy_box_gantry_open()
N/A4548{
N/A4549 GladosPlayVcd(-10170)
N/A4550}
N/A4551 
N/A4552//When players are in position for the final boss door
N/A4553function DLC1_mp_coop_paint_crazy_box_gantry_at_door()
N/A4554{
N/A4555 printl("***********************AT DOOR!!!!!!***************************")
N/A4556}
N/A4557 
N/A4558 
N/A4559//On first disassembler malfunction
N/A4560function DLC1_2Paints_1Bridge_Malfunction()
N/A4561{
N/A4562 GladosPlayVcd(-10050)
N/A4563}
N/A4564 
N/A4565//On land in offices
N/A4566function DLC1_2Paints_1Bridge_Offices()
N/A4567{
N/A4568 GladosPlayVcd(-10060)
N/A4569}
N/A4570 
N/A4571//On Seeing office switches
N/A4572function DLC1_2Paints_1Bridge_SeeSwitches()
N/A4573{
N/A4574 GladosPlayVcd(-10075)
N/A4575}
N/A4576 
N/A4577//On power cycling
N/A4578 
N/A4579function DLC1_2Paints_1Bridge_PowerCycle()
N/A4580{
N/A4581 GladosPlayVcd(-10080)
N/A4582}
N/A4583 
N/A4584//On enter white paint
N/A4585function DLC1_2Paints_1Bridge_WhitePaintIntro()
N/A4586{
N/A4587}
N/A4588 
N/A4589//On exit white paint
N/A4590function DLC1_2Paints_1Bridge_WhitePaintOutro()
N/A4591{
N/A4592 EntFire( "@relay_disable_exit", "Trigger", "", 0.0 )
N/A4593 GladosPlayVcd(-10090)
N/A4594}
N/A4595 
N/A4596 
N/A4597//---------------------------------------
N/A4598//AUTOGENERATED DEATH FUNCTION
N/A4599//---------------------------------------
N/A4600function DLC1_BotDeath(player,dmgtype)
N/A4601{
N/A4602 //player:
N/A4603 // 1 = orange
N/A4604 // 2 = blue
N/A4605 //dmgtype:
N/A4606 // 0 = acid
N/A4607 // 1 = crushed/grindered
N/A4608 // 2 = turret
N/A4609 if (characterCurscene("glados")!=null)
N/A4610 {
N/A4611 return
N/A4612 }
N/A4613 if (curMapName == "mp_coop_separation_1" && (dlc1_deathbits & (1 << 1)) == 0 && dmgtype == 2)
N/A4614 {
N/A4615 dlc1_deathbits = dlc1_deathbits + (1 << 1)
N/A4616 GladosPlayVcd(-11000)
N/A4617 return
N/A4618 }
N/A4619 if (curMapName == "mp_coop_separation_1" && (dlc1_deathbits & (1 << 2)) == 0)
N/A4620 {
N/A4621 dlc1_deathbits = dlc1_deathbits + (1 << 2)
N/A4622 GladosPlayVcd(-11001)
N/A4623 return
N/A4624 }
N/A4625 if (curMapName == "mp_coop_separation_1" && (dlc1_deathbits & (1 << 3)) == 0)
N/A4626 {
N/A4627 dlc1_deathbits = dlc1_deathbits + (1 << 3)
N/A4628 GladosPlayVcd(-11002)
N/A4629 return
N/A4630 }
N/A4631 if (curMapName == "mp_coop_separation_1" && (dlc1_deathbits & (1 << 4)) == 0)
N/A4632 {
N/A4633 dlc1_deathbits = dlc1_deathbits + (1 << 4)
N/A4634 GladosPlayVcd(-11003)
N/A4635 return
N/A4636 }
N/A4637 if (curMapName == "mp_coop_catapult_catch" && (dlc1_deathbits & (1 << 1)) == 0 && (dmgtype == 0 || dmgtype >1000))
N/A4638 {
N/A4639 dlc1_deathbits = dlc1_deathbits + (1 << 1)
N/A4640 GladosPlayVcd(-11004)
N/A4641 return
N/A4642 }
N/A4643 if (curMapName == "mp_coop_catapult_catch" && (dlc1_deathbits & (1 << 2)) == 0 && (dmgtype == 0 || dmgtype >1000))
N/A4644 {
N/A4645 dlc1_deathbits = dlc1_deathbits + (1 << 2)
N/A4646 GladosPlayVcd(-11005)
N/A4647 return
N/A4648 }
N/A4649 if (curMapName == "mp_coop_catapult_catch" && (dlc1_deathbits & (1 << 3)) == 0 && (dmgtype == 0 || dmgtype >1000))
N/A4650 {
N/A4651 dlc1_deathbits = dlc1_deathbits + (1 << 3)
N/A4652 GladosPlayVcd(-11006)
N/A4653 return
N/A4654 }
N/A4655 if (curMapName == "mp_coop_catapult_catch" && (dlc1_deathbits & (1 << 4)) == 0 && (dmgtype == 0 || dmgtype >1000))
N/A4656 {
N/A4657 dlc1_deathbits = dlc1_deathbits + (1 << 4)
N/A4658 GladosPlayVcd(-11007)
N/A4659 return
N/A4660 }
N/A4661 if (curMapName == "mp_coop_catapult_catch" && (dlc1_deathbits & (1 << 5)) == 0 && (dmgtype == 0 || dmgtype >1000))
N/A4662 {
N/A4663 dlc1_deathbits = dlc1_deathbits + (1 << 5)
N/A4664 GladosPlayVcd(-11008)
N/A4665 return
N/A4666 }
N/A4667 if (curMapName == "mp_coop_2paints_1bridge" && (dlc1_deathbits & (1 << 1)) == 0 && (dmgtype == 0 || dmgtype >1000))
N/A4668 {
N/A4669 dlc1_deathbits = dlc1_deathbits + (1 << 1)
N/A4670 GladosPlayVcd(-11009)
N/A4671 return
N/A4672 }
N/A4673 if (curMapName == "mp_coop_2paints_1bridge" && (dlc1_deathbits & (1 << 2)) == 0 && (dmgtype == 0 || dmgtype >1000))
N/A4674 {
N/A4675 dlc1_deathbits = dlc1_deathbits + (1 << 2)
N/A4676 GladosPlayVcd(-11010)
N/A4677 return
N/A4678 }
N/A4679 if (curMapName == "mp_coop_2paints_1bridge" && (dlc1_deathbits & (1 << 3)) == 0 && (dmgtype == 0 || dmgtype >1000))
N/A4680 {
N/A4681 dlc1_deathbits = dlc1_deathbits + (1 << 3)
N/A4682 GladosPlayVcd(-11011)
N/A4683 return
N/A4684 }
N/A4685 if (curMapName == "mp_coop_2paints_1bridge" && (dlc1_deathbits & (1 << 4)) == 0 && (dmgtype == 0 || dmgtype >1000))
N/A4686 {
N/A4687 dlc1_deathbits = dlc1_deathbits + (1 << 4)
N/A4688 GladosPlayVcd(-11012)
N/A4689 return
N/A4690 }
N/A4691 if (curMapName == "mp_coop_bridge_catch" && (dlc1_deathbits & (1 << 1)) == 0 && (dmgtype == 0 || dmgtype >1000))
N/A4692 {
N/A4693 dlc1_deathbits = dlc1_deathbits + (1 << 1)
N/A4694 GladosPlayVcd(-11013)
N/A4695 return
N/A4696 }
N/A4697 if (curMapName == "mp_coop_bridge_catch" && (dlc1_deathbits & (1 << 2)) == 0 && (dmgtype == 0 || dmgtype >1000))
N/A4698 {
N/A4699 dlc1_deathbits = dlc1_deathbits + (1 << 2)
N/A4700 GladosPlayVcd(-11014)
N/A4701 return
N/A4702 }
N/A4703 if (curMapName == "mp_coop_bridge_catch" && (dlc1_deathbits & (1 << 3)) == 0)
N/A4704 {
N/A4705 dlc1_deathbits = dlc1_deathbits + (1 << 3)
N/A4706 GladosPlayVcd(-11015)
N/A4707 return
N/A4708 }
N/A4709 if (curMapName == "mp_coop_bridge_catch" && (dlc1_deathbits & (1 << 4)) == 0)
N/A4710 {
N/A4711 dlc1_deathbits = dlc1_deathbits + (1 << 4)
N/A4712 GladosPlayVcd(-11016)
N/A4713 return
N/A4714 }
N/A4715 if (curMapName == "mp_coop_laser_tbeam" && (dlc1_deathbits & (1 << 1)) == 0)
N/A4716 {
N/A4717 dlc1_deathbits = dlc1_deathbits + (1 << 1)
N/A4718 GladosPlayVcd(-11017)
N/A4719 return
N/A4720 }
N/A4721 if (curMapName == "mp_coop_laser_tbeam" && (dlc1_deathbits & (1 << 2)) == 0)
N/A4722 {
N/A4723 dlc1_deathbits = dlc1_deathbits + (1 << 2)
N/A4724 GladosPlayVcd(-11018)
N/A4725 return
N/A4726 }
N/A4727 if (curMapName == "mp_coop_laser_tbeam" && (dlc1_deathbits & (1 << 3)) == 0)
N/A4728 {
N/A4729 dlc1_deathbits = dlc1_deathbits + (1 << 3)
N/A4730 GladosPlayVcd(-11019)
N/A4731 return
N/A4732 }
N/A4733 if (curMapName == "mp_coop_paint_rat_maze" && (dlc1_deathbits & (1 << 1)) == 0 && dmgtype == 1)
N/A4734 {
N/A4735 dlc1_deathbits = dlc1_deathbits + (1 << 1)
N/A4736 GladosPlayVcd(-11020)
N/A4737 return
N/A4738 }
N/A4739 if (curMapName == "mp_coop_paint_rat_maze" && (dlc1_deathbits & (1 << 2)) == 0 && dmgtype == 1)
N/A4740 {
N/A4741 dlc1_deathbits = dlc1_deathbits + (1 << 2)
N/A4742 GladosPlayVcd(-11021)
N/A4743 return
N/A4744 }
N/A4745 if (curMapName == "mp_coop_paint_rat_maze" && (dlc1_deathbits & (1 << 3)) == 0 && dmgtype == 1)
N/A4746 {
N/A4747 dlc1_deathbits = dlc1_deathbits + (1 << 3)
N/A4748 GladosPlayVcd(-11022)
N/A4749 return
N/A4750 }
N/A4751 if (curMapName == "mp_coop_paint_rat_maze" && (dlc1_deathbits & (1 << 10)) == 0)
N/A4752 {
N/A4753 dlc1_deathbits = dlc1_deathbits + (1 << 10)
N/A4754 GladosPlayVcd(-11023)
N/A4755 return
N/A4756 }
N/A4757 if (curMapName == "mp_coop_paint_rat_maze" && (dlc1_deathbits & (1 << 11)) == 0)
N/A4758 {
N/A4759 dlc1_deathbits = dlc1_deathbits + (1 << 11)
N/A4760 GladosPlayVcd(-11024)
N/A4761 return
N/A4762 }
N/A4763 if (curMapName == "mp_coop_paint_rat_maze" && (dlc1_deathbits & (1 << 12)) == 0)
N/A4764 {
N/A4765 dlc1_deathbits = dlc1_deathbits + (1 << 12)
N/A4766 GladosPlayVcd(-11025)
N/A4767 return
N/A4768 }
N/A4769 if (curMapName == "mp_coop_paint_rat_maze" && (dlc1_deathbits & (1 << 13)) == 0)
N/A4770 {
N/A4771 dlc1_deathbits = dlc1_deathbits + (1 << 13)
N/A4772 GladosPlayVcd(-11026)
N/A4773 return
N/A4774 }
N/A4775}
N/A4776//---------------------------------------
N/A4777//END OF AUTOGENERATED DEATH FUNCTION
N/A4778//---------------------------------------
N/A4779 
N/A4780//--------------------------------------------------------------------------------------------------------------
N/A4781//END OF DLC 1 FUNCTIONS
N/A4782//--------------------------------------------------------------------------------------------------------------