//debug stuff debug <- false //Set true to enable debug block during think function debugInterval <- 3.00 lastthink <- Time() startBlock <- 0 //Queue of scenes started with PlayVcd() scenequeue <- {} firedfromqueue <- false //Map Name curMapName <- GetMapName() //Data crouchTrainingPlayerCrouching <- false //Include the autogenerated scene table DoIncludeScript( "training/training_scenetable_include", self.GetScriptScope() ) function printldebug(arg) { if (debug) { printl(arg) } } // ------------------------------------------------------------------- // Precache sounds we will emit // Define like this: self.PrecacheSoundScript( "Your.SoundName" ) // // Then you call the sound like so: // self.EmitSound("Your.SoundName") // ------------------------------------------------------------------- function Precache() { } // OnPostSpawn - this is all the initial setup stuff function OnPostSpawn() { printl("===========================POST SPAWN!=======") local i = 0 //assign a unique id to each scene entity (uses SetTeam because that's the only thing available) foreach (val in SceneTable) { i+=1 val.vcd.ValidateScriptScope() val.vcd.SetTeam(i) val.index <- i } //Initialize the deferred scene queue //QueueInitialize() //PuzzlePreStart() PostSpawnString <- "POSTSPAWN!!!" } //Passed the unique team id associated with a scene entity defined in SceneTable, this function returns the correct SceneTable index for that entry //ex: SceneTableInst = SceneTable[findIndex(team)] function findIndex(team) { local idx, val foreach (idx, val in SceneTable) { if (val.index == team) { return idx } } return null } //Passed the unique team id associated with a scene entity defined in SceneTable, this function returns the scene instance that originally fired it. //Unfortunately, if multiple scene instances fire the same vcd, this isn't reliable. Hopefully we can either a) fix that //or b) not have multiple scene instances use the same vcd (which is currently the case as of 07/19/2010 - efw) function FindSceneInstanceByTeam(team) { local idx, val local idx2, val2 local inst = null foreach (idx, val in scenequeue) { foreach (idx2, val2 in val.waitFiredVcds) { if (val2 == team) { inst = val break } } if (inst != null) break } return inst } //Is a character currently playing an uninterruptible scene? //char = character name string function IsCharPlayingUninterruptibleScene(char) { local idx, val foreach (idx, val in scenequeue) { if (val.currentCharacter==char && val.waitUninterruptible) { return true } } return false } function SceneCanceled() { printldebug("========SCENE CANCELLED - CALLING ENTITY: "+findIndex(owninginstance.GetTeam())) } //If a vcd is tagged to "exit early" (by setting postdelay < 0), this event fires rather than PlayNextScene() when the vcd finishes. //SkipOnCompletion() has all the functionality of PlayNextScene(), except it doesn't actually play the next scene, because the next scene presumably //already started playing when the vcd exited early. //SkipOnCompletion does, however, evaluate the vcd's SceneTable entry to see if any EntFires need to happen. function SkipOnCompletion() { printldebug("========SKIPONCOMPLETION CALLING ENTITY: "+findIndex(owninginstance.GetTeam())+" : TIME "+Time()) local team = owninginstance.GetTeam() local inst = FindSceneInstanceByTeam(team) if (inst != null) { inst.deleteFiredVcd(team) inst.waitVcdCurrent = findIndex(team) //Are there any EntFires associated with this vcd? if (inst.waitVcdCurrent != null) { if ("fires" in SceneTable[inst.waitVcdCurrent]) { local idx, val foreach (idx, val in SceneTable[inst.waitVcdCurrent].fires) { if (!("fireatstart" in val)) { printldebug(">>>>>>ENT FIRE AT (SKIPCOMPLETION) END: "+val.entity+":"+val.input) EntFire(val.entity,val.input,val.parameter,val.delay) } } } } } } function PlayNextScene() { local team = owninginstance.GetTeam() local inst = FindSceneInstanceByTeam(team) if (inst != null) { printldebug("========PLAYNEXTSCENE CALLING ENTITY: "+findIndex(owninginstance.GetTeam())+" : TIME "+Time()) inst.deleteFiredVcd(team) inst.waitVcdCurrent = findIndex(team) PlayNextSceneInternal(inst) } else { printldebug("========PLAYNEXTSCENE CALLING ENTITY NO LONGER EXISTS: CHECKING QUEUE...") QueueCheck() } } function PlayNextSceneInternal(inst = null) //inst = just completed scene { local i = 0 local tmp = 0 //Set the ducking back to the default value SendToConsole( "snd_ducktovolume 0.55" ) //Are there any "fire at the end" triggers associated with the just completed? if (inst.waitVcdCurrent != null) { if ("fires" in SceneTable[inst.waitVcdCurrent]) { local idx, val foreach (idx, val in SceneTable[inst.waitVcdCurrent].fires) { if (!("fireatstart" in val)) { printldebug(">>>>>>ENT FIRE AT END: "+val.entity+":"+val.input) EntFire(val.entity,val.input,val.parameter,val.delay) } } } } //If the vcd that's ending is part of a nag cycle, check to see if there are any queued //scenes for the primary nag character. If so, abandon the nag and start the queued scene. if (inst.isNag) { if (QueueLen(inst.currentCharacter)>0) { printldebug("========ABANDONING NAG CYCLE TO PLAY QUEUED SCENE") scenequeue_DeleteScene(inst.index) QueueCheck() return } } //Is there another vcd in the scene chain? if (inst.waitNext != null) { printldebug("=====There is a next scene: "+inst.waitNext) if (inst.waitLength == null) { i+=1 printldebug("===================Ready to play:" + i) PlayVcd(inst) } else { inst.waitStartTime = Time() inst.waiting = 1 } } else { printldebug("=====No next scene!") //Remove the instance from the scene list scenequeue_DeleteScene(inst.index) //The current scene is over. Check to see if there are any queued scenes. if (QueueCheck()) return //Do the ding if nothing's queued and the previous scene requires a ding if (!inst.waitNoDingOff) EntFireByHandle( sceneDingOff, "Start", "", 0.1, null, null ) } } //Think function function RadioVoiceThink() //function Think() { local curTime=Time() local thinkInterval = curTime-lastthink lastthink = curTime //Put debug stuff here! if (debug) { if (Time()-lastthink>debugInterval) { printldebug("===================RadioVoiceThink-> " + lastthink) lastthink = Time() QueueDebug() } } if (m_GunTestStart==1 && m_GunTestComplete==0) { if (i_GunTestInterval==0) { i_GunTestInterval=Time() } if (curTime-i_GunTestInterval>30 && m_PlayedGunTestWaiting==0) { i_GunTestInterval=Time() m_PlayedGunTestWaiting=1 GunTestWaiting() } if (curTime-i_GunTestInterval>25 && m_PlayedGunTestWaiting==1) { i_GunTestInterval=Time() m_PlayedGunTestWaiting=2 GunTestWaiting2() } } if (m_IdTestStart==1 && m_IdTestComplete==0) { if (i_IdTestInterval==0) { i_IdTestInterval=Time() } if (curTime-i_IdTestInterval>60 && m_PlayedIdTestWaiting==0) { m_PlayedIdTestWaiting=1 IdTestWaiting() } } local idx, val //scan the list of currently playing scenes. foreach (idx,val in scenequeue) { //Check if the current vcd is scheduled to exit early if (val.waitPreDelayed) { if (Time()>=val.waitDelayingUntil) { printldebug("*******LAUNCHING PREDELAYED SCENE") PlayVcd(val) } } if (val.waitExitingEarly) { if (Time()-val.waitExitingEarlyStartTime >= val.waitExitingEarlyThreshold) { local team val.waitExitingEarly=false local curscene = characterCurscene(val.currentCharacter) if (curscene!=null) { curscene.ValidateScriptScope() curscene.GetScriptScope().SkipOnCompletion <- SkipOnCompletion.bindenv(this) curscene.DisconnectOutput("OnCompletion", "PlayNextScene") curscene.DisconnectOutput("OnCompletion", "SkipOnCompletion") curscene.ConnectOutput( "OnCompletion", "SkipOnCompletion" ) team = curscene.GetTeam() val.waitVcdCurrent = findIndex(team) } printldebug("====Scene "+val.index+" EXITING EARLY") PlayNextSceneInternal(val) return } } } local tmp //Check the deferred scene queue tmp = QueueThink() //Is a queued scene ready to fire? if (tmp != null) { printldebug("===========FORCING QUEUED SCENE: "+tmp) PlayVcd(tmp,true) return } foreach (idx,val in scenequeue) { //Are we waiting to play another vcd? if (val.waiting == 1) { if (Time()-val.waitStartTime >= val.waitLength) { val.waiting = 0 PlayVcd(val) } } } } //Play a vcd from the SceneTable, plus set up next line (if any). //This is the function that should be used to start a scene from inside a map. function PlayVcd(arg,IgnoreQueue = null, caller = null ) //arg==instance -> Continue playing scene defined by scene class instance arg //arg==integer -> Start playing new scene (scene being a chain of vcds) from SceneTable[SceneTableLookup[arg]] //arg==string -> Start playing new scene (scene being a chain of vcds) from SceneTable[arg] //arg==null -> Continue playing current scene with next vcd in current chain //IgnoreQueue -> true == don't check for queue status (this is used to force a queued vcd to play) //caller -> If passed as an entity, the vcd will have its "target1" set to caller.GetName() //NoSkip -> If set to true will not allow another vcd to play until the first is completed. Not added yet { printldebug("=========PlayVcd Called!========="+arg) local dingon = false local inst local fromqueue = firedfromqueue firedfromqueue = false if (typeof arg == "instance") { //if this is a vcd that was being held for predelay, play it if (arg.waitPreDelayed) { inst = arg arg = inst.waitPreDelayedEntry } //otherwise, play the next vcd in the chain else { inst = arg arg=inst.waitNext } } else { //If this is a call from the map, look up the integer arg in the scene lookup table. //We need to do this because hammer/the engine can't pass a squirrel script a string, just an integer. //In other words, from a map, @radiovoice.PlayVcd("MyVcd") crashes the game. PlayVcd(16) doesn't. local sceneStart = 0 if (typeof arg == "integer") { if (arg == 407 || arg == 43) //remove this line without changing map (12/21/2010) { return } sceneStart = arg printldebug("{}{}{}{}{}{}{}{}{}PlayVcd: "+arg) arg = SceneTableLookup[arg] } else { sceneStart = 0 } //if there is an uninterruptible scene already playing for this character, skip the new scene if (IsCharPlayingUninterruptibleScene(SceneTable[arg].char)) { printl("** Scene " + sceneStart + " trying to stomp on currently playing scene, which is flagged 'uninterruptible'. Ignoring." ) return } //if SkipIfBusy is present & we're already playing a scene, skip this new scene if ("skipifbusy" in SceneTable[arg]) { if (characterCurscene(SceneTable[arg].char)!=null) { return } } //if queue is present & we're already playing a scene, add scene to queue if ("queue" in SceneTable[arg]) { if (IgnoreQueue == null) { //queue if a specific character is talking if ("queuecharacter" in SceneTable[arg]) { if (characterCurscene(SceneTable[arg].queuecharacter)!=null) { QueueAdd(arg) return } } //otherwise, queue if the character associated with the vcd is talking else { if (characterCurscene(SceneTable[arg].char)!=null) { QueueAdd(arg) return } } } } if (scenequeue_AddScene(arg,SceneTable[arg].char) == null) return inst = scenequeue[arg] inst.waitSceneStart = sceneStart if ("idle" in SceneTable[arg]) { nags_init(inst,arg) } //is this scene tagged uninterruptible? if ("uninterruptible" in SceneTable[arg]) { if( SceneTable[arg].uninterruptible == true ) { inst.waitUninterruptible = true } } //This is a new dialog block, so turn off special processing dingon=false inst.waitNoDingOff = true inst.waitNoDingOn = true } local preDelay = 0.00 //If this vcd wasn't called after a predelay (meaning the predelay already happened), see if there is a predelay if (!inst.waitPreDelayed) { preDelay = EvaluateTimeKey("predelay", SceneTable[arg]) if (fromqueue && "queuepredelay" in SceneTable[arg]) { preDelay = EvaluateTimeKey("queuepredelay", SceneTable[arg]) } //If there is a predelay, set it and then radiovoiceThink() will fire it after predelay seconds. if (preDelay > 0.00) { inst.waitPreDelayed = true inst.waitDelayingUntil = Time()+preDelay inst.waitPreDelayedEntry = arg printldebug("======= "+arg+" PREDELAYED FOR "+preDelay+" SECONDS") return } } //Otherwise, set the PreDelayed flag to false else { inst.waitPreDelayed = false inst.waitPreDelayedEntry = null } //If this scene is a nag/idle cycle, grab the next line off the stack if (inst.isNag) { //If we're not in a vcd chain, grab the next vcd from the randomized pool if (!inst.naginchain) { arg = nags_fetch(inst) } //if nothing fetched (because the nag has used all the lines and isn't marked as "repeat"), remove this scene if (arg == null) { scenequeue_DeleteScene(inst.index) return } } //Set ducking volume correctly for booming audio //SendToConsole( "snd_ducktovolume 0.2" ) //SetDucking( "announcerVOLayer", "announcerVO", 0.01 ) //SetDucking( "VOLayer", "VO", 0.1 ) if ( arg != null ) { local ltalkover ltalkover = "talkover" in SceneTable[arg] //Cancel any vcd that's already playing if (!ltalkover) { AllCharactersStopScene() } else { //characters can't currently talk over themselves CharacterStopScene(SceneTable[arg].char) } //Play the initial ding (unless the scene specifically requests no ding) if (dingon && !inst.waitNoDingOn) EntFireByHandle( sceneDingOn, "Start", "", 0.00, null, null ) //Start the new vcd printldebug("===================Playing:" + arg) inst.currentCharacter = SceneTable[arg].char //Bind the OnCompletion Event SceneTable[arg].vcd.ValidateScriptScope() SceneTable[arg].vcd.GetScriptScope().PlayNextScene <- PlayNextScene.bindenv(this) SceneTable[arg].vcd.DisconnectOutput( "OnCompletion", "PlayNextScene" ) SceneTable[arg].vcd.ConnectOutput( "OnCompletion", "PlayNextScene" ) SceneTable[arg].vcd.ConnectOutput( "OnCanceled", "SceneCanceled" ) //Set the target1 if necessary if (caller != null) { if (typeof caller == "string") { EntFireByHandle( SceneTable[arg].vcd, "SetTarget1", caller, 0, null, null ) printldebug("++++++++++++SETTING TARGET: "+caller) } else { EntFireByHandle( SceneTable[arg].vcd, "SetTarget1", caller.GetName(), 0, null, null ) } } if ("settarget1" in SceneTable[arg]) { printldebug("++++++++++++ "+arg+"SETTING TARGET: "+SceneTable[arg].settarget1) EntFireByHandle( SceneTable[arg].vcd, "SetTarget1", SceneTable[arg].settarget1 , 0, null, null ) } inst.waitVcdTeam = SceneTable[arg].index inst.waitVcdCurrent = arg inst.addFiredVcd(SceneTable[arg].index) if (dingon && !inst.waitNoDingOn) EntFireByHandle( SceneTable[arg].vcd, "Start", "", 0.00+0.18, null, null ) else EntFireByHandle( SceneTable[arg].vcd, "Start", "", 0.00, null, null ) //Does this vcd have a "fire into entities" array? if ("fires" in SceneTable[arg]) { local idx, val foreach (idx, val in SceneTable[arg].fires) { if ("fireatstart" in val) { printldebug(">>>>>>ENT FIRE AT START: "+val.entity+":"+val.input) EntFire(val.entity,val.input,val.parameter, val.delay) } } } //Setup next line (if there is one) if (SceneTable[arg].next != null || inst.isNag) { local pdelay = EvaluateTimeKey("postdelay",SceneTable[arg]) //if this is a nag, use min/max defined in the first entry in the scene if (inst.isNag) { pdelay = RandomFloat(inst.nagminsecs,inst.nagmaxsecs) } if (pdelay<0.00) { if (inst.isNag) //If the "next" key != null, it means we're in a vcd chain if (SceneTable[arg].next != null) { inst.waitNext = SceneTable[arg].next inst.naginchain = true } else { //Otherwise, just slug in the same index (any non-null value would work here, however) inst.waitNext = arg inst.naginchain = false } else inst.waitNext = SceneTable[arg].next inst.waitExitingEarly=true inst.waitLength=null inst.waitExitingEarlyStartTime=Time() //If we're in a nag vcd chain, use the vcds postdelay rather than the nag-wide delay //This is because vcd chains generally need to be explicitly timed at the chain level //since the vcds are grouped together as a block if (inst.naginchain) pdelay = EvaluateTimeKey("postdelay",SceneTable[arg]) inst.waitExitingEarlyThreshold=pdelay*-1 } else { inst.waitExitingEarly=false if (inst.isNag) { //If the "next" key != null, it means we're in a vcd chain if (SceneTable[arg].next != null) { inst.waitNext = SceneTable[arg].next inst.naginchain = true } else { //Otherwise, just slug in the same index (any non-null value would work here, however) inst.waitNext = arg inst.naginchain = false } } else { inst.waitNext = SceneTable[arg].next } //If we're in a nag vcd chain, use the vcds postdelay rather than the nag-wide delay //This is because vcd chains generally need to be explicitly timed at the chain level //since the vcds are grouped together as a block if (inst.naginchain) pdelay = EvaluateTimeKey("postdelay",SceneTable[arg]) } inst.waitLength = pdelay } else { inst.waitNext = null printldebug("===================SCENE END") } } } function EvaluateTimeKey(keyname, keytable) { local ret = null if (keyname in keytable) { local typ = typeof keytable[keyname] if (typ == "array") { if (keytable[keyname].len() != 2) { printldebug("!!!!!!!!!!!!EVALUATE TIME KEY ERROR: "+keyname+" is an array with a length != 2") return 0.00 } ret = RandomFloat(keytable[keyname][0],keytable[keyname][1]) } else { ret = keytable[keyname] } } if (ret == null) ret = 0.00 printldebug(">>>>>>>>>EVALUATE TIME KEY: "+keyname+" : "+ret) return ret } function ToggleDebug(arg = null) { debug = !debug if (debug) printl("====================== debug ON") else printl("====================== debug OFF") if (arg!=null) debugInterval = arg } //Nukes Everything. Delete all currently playing & queued scenes. function nuke() { scenequeue = {} Queue.clear() AllCharactersStopScene() StopAllCaveSpeakers() } //Stops a scene for all characters function AllCharactersStopScene() { CharacterStopScene("radiovoice") } function characterCurscene(arg) { local ret = null, ent = null switch (arg) { case "radiovoice": ent = Entities.FindByName(ent, "@radiovoice") break } if (ent != null) { printldebug("&&&&&&FOUND ENTITY: "+arg) ret = ent.GetCurrentScene() } else { printldebug("!!!!!!!!!!!!ENTITY NOT FOUND: "+arg) } return ret } //Stops a scene for a particular character function CharacterStopScene(arg) { local ent = null local curscene = characterCurscene(arg) if ( curscene != null ) { printldebug("&&&&&&STOP SCENE: "+arg+" FOUND SCENE TO DELETE!!!!!!!!!") EntFireByHandle( curscene, "Cancel", "", 0, null, null ) } else { printldebug("&&&&&&STOP SCENE: NO SCENE TO DELETE FOR " + arg) } } //Turns off current speech function StopTalking() { local curscene = self.GetCurrentScene() waitNext = null waitLength = null if ( curscene != null ) EntFireByHandle( curscene, "Cancel", "", 0, null, null ) } //Turns off current speech if the scene # passed as arg is currently playing function StopScene(arg) { if (waitSceneStart == arg) { local curscene = self.GetCurrentScene() waiting = 0 waitNext = null waitLength = null if ( curscene != null ) EntFireByHandle( curscene, "Cancel", "", 0, null, null ) } } //-------------------------------------------------------------------------------------------------------------- //Queue Functions // -This is the queue of scenes delayed by another scene //-------------------------------------------------------------------------------------------------------------- Queue <- [] //Initialize the queue function QueueInitialize() { Queue.clear() } //Add a scene to the queue //Queue table structure: // item = index in SceneTable (ie: SceneTable[Queue[index].item]) // added = time added to queue // queueforcesecs = (from SceneTable) force item to play after queueforcesecs seconds in queue // queuetimeout = (from SceneTable) delete item if it sits in queue for queuetimeout seconds // queuepredelay = (from SceneTable) wait queuepredelay seconds to fire the scene if it sat in the queue for any amount of time function QueueAdd(arg) { Queue.append( { item = arg added = Time() }) if (arg in SceneTable) { if ("queueforcesecs" in SceneTable[arg]) { Queue[Queue.len()-1].queueforcesecs <- SceneTable[arg].queueforcesecs } else { Queue[Queue.len()-1].queueforcesecs <- 45.0 } if ("queuetimeout" in SceneTable[arg]) { Queue[Queue.len()-1].queuetimeout <- SceneTable[arg].queuetimeout } if ("queuepredelay" in SceneTable[arg]) { Queue[Queue.len()-1].queuepredelay <- SceneTable[arg].queuepredelay } } } //Returns number of items in the queue function QueueLen(char = null) { local i = 0 if (char == null) { return Queue.len() } else { foreach (index, scene in Queue) { if (SceneTable[scene.item].char == char) { i+=1 } } return i } } //Fetch the next scene in the queue function QueueGetNext() { local ret,l ret = null l=QueueLen() if (l>0) { ret = Queue[l-1].item Queue.remove(l-1) } return ret } function QueueDebug() { printldebug("=================== items in queue-> " + Queue.len()) foreach (index, scene in Queue) { printldebug("========= queue item "+index+"("+scene.item+"): character "+SceneTable[scene.item].char) } } //General stuff called from RadioVoiceThink() function QueueThink() { local ret,t,index if (QueueLen()==0) { return null } t=Time() //Check to see if any queued scenes timed out for (index = QueueLen(); index > 0; index -= 1) { if ("queuetimeout" in Queue[index-1]) { if (t-Queue[index-1].added > Queue[index-1].queuetimeout) { Queue.remove(index-1) } } } //Check to see if any queued scenes should force fire foreach (index, scene in Queue) { if ("queueforcesecs" in scene) { if (t-scene.added >scene.queueforcesecs) { ret = scene.item Queue.remove(index) return ret } } } return null } //Debug testbed function function QueueTest() { local a = [] for(local i=0;i<10;i+=1) { a.append(RandomInt(1,100)) printl(">>>>>> " + i + " : " + a[i]) } for (local i = a.len(); i>0; i-=1) { if (a[i-1]<50) a.remove(i-1) } foreach (index, n in a) { printl(">>>>>> " + index + " : " + a[index]) } } //Delete a single item from the queue function QueueDeleteItem(item) { if (QueueLen()==0) { return false } foreach (index, scene in Queue) { if (scene.item == item) { Queue.remove(index) return true } } return false } //Check to see if there's a Queued scene ready to go. If so, fire it! (and return true) function QueueCheck() { local tmp if (QueueLen()>0) { printldebug("===QUEUE LEN IS "+QueueLen()) tmp=QueueGetNext() if (tmp != null) { firedfromqueue = true PlayVcd(tmp,true) //PlayVcd(tmp) return true } } return false } //-------------------------------------------------------------------------------------------------------------- //End of Queue Functions //-------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------- //Scenes List Functions START // -This is the list of currently playing scenes //-------------------------------------------------------------------------------------------------------------- class scene { //constructor constructor(a, caller) { index = a owner = caller currentCharacter = "" waitSceneStart = 0 //1 means we're waiting for the current vcd to finish so we can play the next vcd in the chain waiting = 0 waitVcdCurrent = null waitStartTime = Time() waitLength = Time() waitNext = null waitExitingEarly = false waitExitingEarlyStartTime = Time() waitExitingEarlyThreshold = 0.00 //How many seconds sould the VCD play before moving on to the next one waitDelayingUntil = null waitPreDelayed = false waitPreDelayedEntry = null waitNoDingOff = false waitNoDingOn = false waitVcdTeam = -1 waitFiredVcds = [] waitUninterruptible = false nagminsecs = 0 nagmaxsecs = 0 nags = [] isNag = false nagpool = [] naglastfetched = null nagrandom = false nagrandomonrepeat = false nagtimeslistcompleted = 0 nagrepeat = false naginchain = false } function nagsClear() { naglastfetched = null nags.clear() } function nagpoolClear() { nagpool.clear() } function addFiredVcd(team) { waitFiredVcds.append(team) } function deleteFiredVcd(team) { local idx, val local fnd = null foreach (idx, val in waitFiredVcds) { if (val == team) { fnd = idx break } } if (fnd != null) { waitFiredVcds.remove(fnd) } } //property index = 0; owner = null; currentCharacter = ""; waitSceneStart = 0; //1 means we're waiting for the current vcd to finish so we can play the next vcd in the chain waiting = 0; waitVcdCurrent = null; //SceneTable index of last launched vcd waitStartTime = 0; waitLength = 0; waitNext = null; waitExitingEarly = false; waitExitingEarlyStartTime = 0; waitExitingEarlyThreshold = 0.00; //How many seconds sould the VCD play before moving on to the next one waitDelayingUntil = null; waitPreDelayed = false; waitPreDelayedEntry = null; waitNoDingOff = false; waitNoDingOn = false; waitFires = []; waitVcdTeam = -1; waitFiredVcds = []; waitUninterruptible = false; isNag = false; nags = []; nagpool = []; nagminsecs = 0; nagmaxsecs = 0; naglastfetched = null; nagrandom = false; nagrandomonrepeat = false; nagtimeslistcompleted = 0; nagrepeat = false; naginchain = false; } function scenequeue_AddScene(arg,char) { local idx, val,delme delme=null foreach (idx, val in scenequeue) { if (SceneTable[idx].char==char) { delme = idx } if (idx == arg) { printldebug(">>>>>>>>>>Scene "+arg+" is already in the queue") return null } } if (delme != null) { printldebug(">>>>>>>>>>DELETING SCENE "+delme) scenequeue_DeleteScene(delme) } scenequeue[arg] <- scene(arg, this) scenequeue_Dump() return scenequeue[arg] } function scenequeue_DeleteScene(arg) { local idx, val foreach (idx, val in scenequeue) { if (idx == arg) { printldebug(">>>>>>>>>>Scene "+arg+" deleted!") delete scenequeue[arg] return true } } return null } function scenequeue_Dump() { printldebug(">>>>>>>>>>Scene Dump at "+Time()) foreach (idx, val in scenequeue) { printldebug(">>>>>>>>>>Scene "+idx+" ADDED at "+val.waitStartTime+" Type "+ typeof val) } } //-------------------------------------------------------------------------------------------------------------- //Scene Queue Functions END //-------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------- //Nag Table Functions START //-------------------------------------------------------------------------------------------------------------- function nags_init(inst,scenetableentry) { local i = 0 inst.nagsClear() if ("idleminsecs" in SceneTable[scenetableentry]) { inst.nagminsecs = SceneTable[scenetableentry].idleminsecs if ("idlemaxsecs" in SceneTable[scenetableentry]) { inst.nagmaxsecs = SceneTable[scenetableentry].idlemaxsecs } else { inst.nagmaxsecs = inst.nagminsecs } } if ("idlerandomonrepeat" in SceneTable[scenetableentry]) { inst.nagrandomonrepeat = true } if ("idlerepeat" in SceneTable[scenetableentry]) { inst.nagrepeat = true } if ("idlerandom" in SceneTable[scenetableentry]) { inst.nagrandom = true } local igroup = SceneTable[scenetableentry].idlegroup local idx, val,oig=0 foreach (idx, val in SceneTable) { if (!("idlegroup" in val)) continue if (val.idlegroup != igroup) continue local rar = 101, mnum = 0 if ("idlerarity" in val) { rar = val.idlerarity } if ("idlemaxplays" in val) { mnum = val.idlemaxplays } //Skip vcds that are part of a chain (and not the first link in the chain) if ("idleunder" in val) { continue } if ("idleorderingroup" in val) { oig=val.idleorderingroup } else { oig=0 } inst.nags.append({SceneTableIndex=idx, rarity = rar, maxplays = mnum, totplays = 0,orderingroup = oig}) } inst.nags.sort(nag_array_compare) inst.isNag = true inst.nagtimeslistcompleted = 0 nags_createpool(inst) } function nags_createpool(inst) { inst.nagpoolClear() local idx, val local takeit = false local tempa = [] foreach (idx, val in inst.nags) { takeit=false if (val.totplays >= val.maxplays && val.maxplays>0) { continue } if (RandomInt(1,100) 0)) { //Make sure the first entry in the new list isn't the same as the last vcd played. //This ensures no repeats. if (tempa.len()>1 && inst.naglastfetched!=null) { while (true) { r=RandomInt(0,tempa.len()-1) if (tempa[r].SceneTableIndex != inst.naglastfetched) { inst.nagpool.append(tempa[r]) tempa.remove(r) break } } } //Now build the rest of the pool while (tempa.len()>0) { r=RandomInt(0,tempa.len()-1) inst.nagpool.append(tempa[r]) tempa.remove(r) } } else { foreach(idx, val in tempa) { inst.nagpool.append(val) } } } function nags_nagpooldump(inst) { local idx, val foreach (idx, val in inst.nagpool) printldebug("*********NAG "+idx+" : "+val.SceneTableIndex) } function nags_fetch(inst) { if (inst.nagpool.len() == 0) { if (inst.nagrepeat) { inst.nagtimeslistcompleted += 1 nags_createpool(inst) if (inst.nagpool.len() == 0) return null } else { return null } } local ret = inst.nagpool[0].SceneTableIndex foreach( idx, val in inst.nags) { if (val.SceneTableIndex == ret) { val.totplays+=1 break } } //nags_nagpooldump(inst) inst.nagpool.remove(0) inst.naglastfetched = ret return ret } function StopNag(arg = 0) { nag_stop("glados",arg) } function WheatleyStopNag(arg = 0) { nag_stop("wheatley",arg) } function Core01StopNag(arg = 0) { nag_stop("core01",arg) } function Core02StopNag(arg = 0) { nag_stop("core02",arg) } function Core03StopNag(arg = 0) { nag_stop("core03",arg) } function nag_stop(char, stoptype) { local idx, val local todel = null foreach (idx, val in scenequeue) { if (val.isNag && val.currentCharacter == char) { todel=idx break } } if (todel != null) { scenequeue_DeleteScene(todel) } } function nag_array_compare(a,b) { if(a.orderingroup>b.orderingroup) return 1 else if(a.orderingroup0: When SilenceTicks>=Silencethreshold, RadioVoicePlayVcd(SayOnSilence) //Test stuff m_PlayingFailure <-0 m_GunTestStart <- 0 m_GunTestComplete <- 0 m_PlayedGunTestWaiting <- 0 i_GunTestInterval <- 0 m_IdTestStart <- 0 m_IdTestComplete <- 0 m_PlayedIdTestWaiting <- 0 i_IdTestInterval <- 0 i_LocationDamage <- 0 i_saidFireDamage <- Time() i_HeadDamageCounter <- 1 i_ChestDamageCounter <- 1 i_LegDamageCounter <- 1 i_FriendlyFireCounter <- 1 i_FriendlyFire <- Time() m_StartedTimedCourse <-0 i_FailureAmmoCount <-0 m_BurstTestStarted <- 0 m_BurstBlockerTestStarted <-0 m_CrouchTestStarted <- 0 i_BodyDamageFailCount <-0 m_GrenadeHitCagedDone <- 0 i_GrenadeHitCounter <-0 i_FlashBangFlashedCounter <-0 i_FlashBangFailedTargets <-0 m_BombPlantA <- 0 m_BombBeingDefused <-0 m_ReturnVisitor <-0 function RadioVoiceThinkOriginal() { local curTime=Time() local thinkInterval = curTime-lastthink lastthink = curTime //Put debug stuff here! if (debug) { debugAccrued += thinkInterval if (debugAccrued>debugInterval) { debugAccrued = 0 printl("===================RadioVoiceNEWThink-> " + lastthink+" "+thinkInterval) } } if (m_GunTestStart==1 && m_GunTestComplete==0) { if (i_GunTestInterval==0) { i_GunTestInterval=Time() } if (curTime-i_GunTestInterval>30 && m_PlayedGunTestWaiting==0) { i_GunTestInterval=Time() m_PlayedGunTestWaiting=1 GunTestWaiting() } if (curTime-i_GunTestInterval>10 && m_PlayedGunTestWaiting==1) { i_GunTestInterval=Time() m_PlayedGunTestWaiting=2 GunTestWaiting2() } } if (m_IdTestStart==1 && m_IdTestComplete==0) { if (i_IdTestInterval==0) { i_IdTestInterval=Time() } if (curTime-i_IdTestInterval>60 && m_PlayedIdTestWaiting==0) { m_PlayedIdTestWaiting=1 IdTestWaiting() } } //Wait for a break in the player's talking to say a line if (SayOnSilence) { local OrangeIndex = GetOrangePlayerIndex() local BlueIndex = GetBluePlayerIndex() local curscene = self.GetCurrentScene() if ( curscene == null ) { EntFireByHandle(BlahVcds[RandomInt(1,8)], "Start", "", 0.00, null, null ) SilenceBlahsPlayed += 1 } local lSilence = true if (PlayerVoiceListener.IsPlayerSpeaking(OrangeIndex)) lSilence = false if (PlayerVoiceListener.IsPlayerSpeaking(BlueIndex)) lSilence = false if (lSilence) SilenceTicks += thinkInterval else SilenceTicks = 0 if (SilenceTicks >= Silencethreshold || SilenceBlahsPlayed > 5) { local i = SayOnSilence SayOnSilence = 0 RadioVoicePlayVcd(i) } } //Are we waiting to play another vcd? if (waiting == 1) { if (Time()-waitStartTime >= waitLength) { waiting = 0 RadioVoicePlayVcd(null) } } } //Play a vcd from the SceneTable, plus set up next line (if any) function RadioVoicePlayVcd(arg) //arg==integer -> Start playing new scene (scene being a chain of vcds) from SceneTable[SceneTableLookup[arg]] //arg==string -> Start playing new scene (scene being a chain of vcds) from SceneTable[arg] //arg==null -> Continue playing current scene with next vcd in current chain { local dingon = false if (arg == null) { arg=waitNext } else { //If this is a call from the map, look up the integer arg in the scene lookup table. //We need to do this because hammer/the engine can't pass a squirrel script a string, just an integer. if (typeof arg == "integer") { waitSceneStart = arg arg = SceneTableLookup[arg] } else { waitSceneStart = 0 } //This is a new dialog block, so turn off special processing dingon=true startBlock = Time() if ("noDingOff" in SceneTable[arg]) waitNoDingOff = true else waitNoDingOff = false if ("noDingOn" in SceneTable[arg]) waitNoDingOn = true else waitNoDingOn = false } local preDelay = 0.00 if ( arg != null ) { if ("predelay" in SceneTable[arg]) preDelay = SceneTable[arg].predelay //Cancel any vcd that's already playing local curscene = self.GetCurrentScene() if ( curscene != null ) { EntFireByHandle( curscene, "Cancel", "", 0, null, null ) } //Start the new vcd if (dingon && !waitNoDingOn) EntFireByHandle( SceneTable[arg].vcd, "Start", "", 0.18, null, null ) else EntFireByHandle( SceneTable[arg].vcd, "Start", "", preDelay, null, null ) //Check for EntFire at end of vcd if ("fireentity" in SceneTable[arg]) { waitEntityFire = SceneTable[arg].fireentity waitEntityInput = SceneTable[arg].fireinput waitEntityDelay = SceneTable[arg].firedelay waitEntityParm = null if ("fireparm" in SceneTable[arg]) waitEntityParm = SceneTable[arg].fireparm } else { waitEntityFire = null waitEntityInput = null waitEntityDelay = null waitEntityParm = null } //Check for any special end-of-vcd processing if ("endspecial" in SceneTable[arg]) waitEndSpecial = SceneTable[arg].endspecial else waitEndSpecial = 0 } } //Turns off current RadioVoice speech function RadioVoiceStopTalking() { local curscene = self.GetCurrentScene() waiting = 0 waitNext = null waitLength = null //if ( curscene != null ) // EntFireByHandle( curscene, "Cancel", "", 0, null, null ) } //Turns off current RadioVoice speech if the scene # passed as arg is currently playing function RadioVoiceStopScene(arg) { if (waitSceneStart == arg) { local curscene = self.GetCurrentScene() waiting = 0 waitNext = null waitLength = null if ( curscene != null ) EntFireByHandle( curscene, "Cancel", "", 0, null, null ) } } function MainIntro ( ) { //----------------------------------------------------------------------------------------------- //I PUT THIS HERE TEMPORARILY BECAUSE ONPOSTSPAWN ISN'T FIRING AUTOMATICALLY LIKE IT SHOULD!!!! OnPostSpawn() //----------------------------------------------------------------------------------------------- PlayVcd(37) printl("===================MainIntro!"+includeTestString+PostSpawnString) printl("===================MainIntro!"+includeTestString+PostSpawnString) printl("===================MainIntro!"+includeTestString+PostSpawnString) m_GunTestStart=1 } function MainIntro2 ( ) { //----------------------------------------------------------------------------------------------- //I PUT THIS HERE TEMPORARILY BECAUSE ONPOSTSPAWN ISN'T FIRING AUTOMATICALLY LIKE IT SHOULD!!!! OnPostSpawn() //----------------------------------------------------------------------------------------------- PlayVcd(338) printl("===================MainIntro!"+includeTestString+PostSpawnString) printl("===================MainIntro!"+includeTestString+PostSpawnString) printl("===================MainIntro!"+includeTestString+PostSpawnString) //keep this set to zero to avoi speech conflicts. m_GunTestStart=0 m_ReturnVisitor=1 } function ReturnRandom( arg0,arg1,arg2,arg3,arg4,arg5){ local pData = {}; local pDataCount = 0 if (arg0>0){ pData[0] <- arg0 } if (arg1>0){ pData[1] <- arg1 pDataCount=1 } if (arg2>0){ pData[2] <- arg2 pDataCount=2 } if (arg3>0){ pData[3] <- arg3 pDataCount=3 } if (arg4>0){ pData[4] <- arg4 pDataCount=4 } if (arg5>0){ pData[5] <- arg5 pDataCount=5 } local rndpick = RandomInt(0,pDataCount) return pData[rndpick] } function GunTestStart ( ) { PlayVcd(11) printl("===================GunTestStart!") printl("===================GunTestStart!") printl("===================GunTestStart!") m_GunTestComplete=1 } function GunTestComplete ( ) { PlayVcd( 328 ) //ReturnRandom(14,328,0,0,0,0)) printl("===================GunTestComplete!") printl("===================GunTestComplete!") printl("===================GunTestComplete!") } function GunTestCompleteFail ( ) { PlayVcd(ReturnRandom(327,0,0,0,0,0)) printl("===================GunTestComplete!") printl("===================GunTestComplete!") printl("===================GunTestComplete!") } function GunTestWaiting( ) { PlayVcd(50) printl("===================GunTestWaiting!") printl("===================GunTestWaiting!") } function GunTestWaiting2( ) { PlayVcd(51) printl("===================GunTestWaiting!") printl("===================GunTestWaiting!") } function GunTestPlaceWeaponOnTable() { EntFire( "@rl_start_pre_team", "Trigger", "", 1 ) EntFire( "@rl_stop_aim_wall", "Trigger", "", 0.5 ) } function IdTestStartActual(){ printl("===================IdTestStart - Actual") printl("===================IdTestStart - Actual") printl("===================IdTestStart - Actual") } function IdTestStart( ) { PlayVcd(16) printl("===================IdTestStart!") printl("===================IdTestStart!") printl("===================IdTestStart!") m_IdTestStart=1 } function IdTestComplete( ) { PlayVcd(19) printl("===================IdTestComplete!") printl("===================IdTestComplete!") printl("===================IdTestComplete!") m_IdTestComplete=1 i_FailureAmmoCount = 0 } function IdTestWaiting( ) { PlayVcd(ReturnRandom(180,337,0,0,0,0)) printl("===================IdTestWaiting!") printl("===================IdTestWaiting!") printl("===================IdTestWaiting!") } function IdTestFailed ( ) { if ( i_FailureAmmoCount == 0 ) { PlayVcd(18) i_FailureAmmoCount++ } else { PlayVcd(ReturnRandom(334,0,0,0,0,0)) } printl("===================IdTestFailed!") printl("===================IdTestFailed!") printl("===================IdTestFailed!") m_IdTestComplete=1 } function BurstTestStart( ) { m_BurstTestStarted = 1 printl("===================BurstTestStart!") printl("===================BurstTestStart!") printl("===================BurstTestStart!") } function BurstTestComplete( ) { PlayVcd(23) printl("===================BurstTestComplete!") printl("===================BurstTestComplete!") printl("===================BurstTestComplete!") i_FailureAmmoCount = 0 } function BurstTestFailed ( ) { if ( i_FailureAmmoCount == 0 ) { printl("===================BurstTestFailed - 0!") PlayVcd(295) i_FailureAmmoCount++ } else { printl("===================BurstTestFailed - 1+!") PlayVcd(ReturnRandom(294,295,0,0,0,0)) } printl("===================BurstTestFailed!") printl("===================BurstTestFailed!") printl("===================BurstTestFailed!") } function BurstBlockerTestStart( ) { m_BurstBlockerTestStarted = 1 printl("===================BurstBlockerTestStart!") printl("===================BurstBlockerTestStart!") printl("===================BurstBlockerTestStart!") } // this is completed test and on to the next one. function BurstBlockerTestComplete( ) { PlayVcd(25) printl("===================BurstBlockerTestComplete") printl("===================BurstBlockerTestComplete") printl("===================BurstBlockerTestComplete") } function BurstBlockerTestFailed ( ) { PlayVcd(ReturnRandom(295,333,0,0,0,0)) printl("===================BurstBlockerTestFailed!") printl("===================BurstBlockerTestFailed!") printl("===================BurstBlockerTestFailed!") } /////////////////////////// function CrouchTestIntro() { PlayVcd(700) printl("^^^ Opening wall ^^^ ") EntFire( "@rl_open_crouch_target_wall", "Trigger", "", 0 ) printl("===================^ CrouchTestIntro!") printl("===================^ CrouchTestIntro!") printl("===================^ CrouchTestIntro!") } function CrouchTestStart() { // only play this vcd once on the first run of the test if( !m_CrouchTestStarted ) { //PlayVcd(705) } m_CrouchTestStarted = 1 // start the crouch hint EntFire( "@rl_crouch_hint_and_dialog", "enable", 0, 0 ) EntFire( "@rl_crouch_hint_and_dialog", "trigger", 0, 4 ) printl("===================^ CrouchTestStart!") printl("===================^ CrouchTestStart!") printl("===================^ CrouchTestStart!") } // this is completed test and on to the next one. function CrouchTestComplete() { PlayVcd(70) printl("===================^ CrouchTestComplete") printl("===================^ CrouchTestComplete") printl("===================^ CrouchTestComplete") } function CrouchTestFailed() { PlayVcd(ReturnRandom(22,333,0,0,0,0)) printl("===================^ CrouchTestFailed!") printl("===================^ CrouchTestFailed!") printl("===================^ CrouchTestFailed!") } function SetCrouchTrainingPlayerCrouching() { crouchTrainingPlayerCrouching = true } function SetCrouchTrainingPlayerNotCrouching() { crouchTrainingPlayerCrouching = false } // This function gets called from the map when the player needs the commander to hint about crouching during crouch training function CrouchTestSuggestCrouching() { EntFire( "@crouch_training_crouch_hint", "showhint", 0 ) //old vcd //PlayVcd(271) if( !crouchTrainingPlayerCrouching ) {// play the "you should crouch" dialog PlayVcd(702) } else {// play the "crouching increases accuracy" dialog PlayVcd(704) } } function FailureAmmo( ) { // not sure where this is used yet, return from it until we figure it out return } function FailureTime( ) { printl("===================FailureTime!") printl("===================FailureTime!") printl("===================FailureTime!") } function BodyDamageIntro( ) { PlayVcd(26) printl("===================BodyDamageIntro!") printl("===================BodyDamageIntro!") printl("===================BodyDamageIntro!") } function StopRunningBodyDamIntro() { PlayVcd(38) } function BodyDamageStart( ) { PlayVcd(55) printl("===================BodyDamagestart!") printl("===================BodyDamagestart!") printl("===================BodyDamagestart!") } function BodyDamageComplete( ) { PlayVcd(27) printl("===================BodyDamageComplete!") printl("===================BodyDamageComplete!") printl("===================BodyDamageComplete!") } function BodyDamageFail( ) { switch (i_BodyDamageFailCount) { case 0: PlayVcd(36) i_BodyDamageFailCount=i_BodyDamageFailCount+1 break case 1: PlayVcd(137) i_BodyDamageFailCount=i_BodyDamageFailCount+1 break case 2: PlayVcd(138) i_BodyDamageFailCount=i_BodyDamageFailCount+1 break } printl("===================BodyDamageFail!") printl("===================BodyDamageFail!") printl("===================BodyDamageFail!") } function BodyDamageTimerStart( ) { printl("===================BodyDamageTimerStart!") printl("===================BodyDamageTimerStart!") printl("===================BodyDamageTimerStart!") } function BodyDamageTimerComplete( ) { PlayVcd(28) printl("===================BodyDamageTimerComplete!") printl("===================BodyDamageTimerComplete!") printl("===================BodyDamageTimerComplete!") } function BodyDamageHeadShot( ) { if (i_LocationDamage==0){ i_LocationDamage = Time() } else{ if (Time() - i_LocationDamage > 12) { switch (i_HeadDamageCounter) { case 1: PlayVcd(29) break case 2: PlayVcd(267) break case 3: PlayVcd(131) break case 4: PlayVcd(30) break case 5: PlayVcd(266) break case 5: PlayVcd(31) break } i_HeadDamageCounter=i_HeadDamageCounter+1 i_LocationDamage = Time() } } } function BodyDamageChestShot( ) { if (i_LocationDamage==0){ i_LocationDamage = Time() } else{ if (Time() - i_LocationDamage > 15) { switch (i_ChestDamageCounter) { case 1: PlayVcd(52) break case 2: PlayVcd(32) break case 3: PlayVcd(33) break case 4: PlayVcd(53) break case 5: PlayVcd(264) break } i_ChestDamageCounter=i_ChestDamageCounter+1 i_LocationDamage = Time() } } } function BodyDamageLegShot( ) { if (i_LocationDamage==0){ i_LocationDamage = Time() } else{ if (Time() - i_LocationDamage > 15) { switch (i_LegDamageCounter) { case 1: PlayVcd(34) break case 2: PlayVcd(35) break case 3: PlayVcd(54) break case 4: PlayVcd(268) break case 5: PlayVcd(269) break } i_LegDamageCounter=i_LegDamageCounter+1 i_LocationDamage = Time() } } } function BodyDamageCrouchForAccuracy() { PlayVcd(271) } function BodyDamageSwitchToPistol() { PlayVcd(511) // "You can switch to your pistol at any time." } function BodyDamageSwitchToOtherWeapon() { PlayVcd(80) // Switch weapons to continue } function ActiveTrainingSwitchToPistol() { PlayVcd(510) // "Switch to your pistol now." } function GrenadeIntro( ) { PlayVcd(1) printl("===================GrenadeIntro!") printl("===================GrenadeIntro!") printl("===================GrenadeIntro!") } function GrenadeHit( ) { if (i_GrenadeHitCounter==2 && m_GrenadeHitCagedDone==0){ PlayVcd(318) } if (i_GrenadeHitCounter==4 && m_GrenadeHitCagedDone==1){ PlayVcd(322) } i_GrenadeHitCounter=i_GrenadeHitCounter+1 printl("===================GrenadeHit!") printl("===================GrenadeHit!") printl("===================GrenadeHit!") } function GrenadeHitCaged( ) { PlayVcd(2) printl("===================GrenadeHit!Caged") printl("===================GrenadeHit!Caged") printl("===================GrenadeHit!Caged") m_GrenadeHitCagedDone=1 } function FlashBangIntro( ) { PlayVcd(3) printl("===================FlashBangIntro!") printl("===================FlashBangIntro!") printl("===================FlashBangIntro!") } function FlashBangNoFlashStart( ) { printl("===================FlashBangNoFlashStart!") printl("===================FlashBangNoFlashStart!") printl("===================FlashBangNoFlashStart!") } function FlashBangFlashStart( ) { printl("===================FlashBangFlashStart!") printl("===================FlashBangFlashStart!") printl("===================FlashBangFlashStart!") } function FlashBangFlashed( ) { if (m_StartedTimedCourse==0){ switch (i_FlashBangFlashedCounter) { case 0: PlayVcd(5) break case 1: PlayVcd(309) break case 2: PlayVcd(232) break case 3: PlayVcd(310) break case 4: PlayVcd(234) break case 5: PlayVcd(314) break } i_FlashBangFlashedCounter=i_FlashBangFlashedCounter+1 } else{ PlayVcd(ReturnRandom(232,233,234,0,0,0)) } printl("===================FlashBangFlashed!") printl("===================FlashBangFlashed!") printl("===================FlashBangFlashed!") } function FlashBangFailedTargets() { switch (i_FlashBangFailedTargets) { case 0: PlayVcd(309) break case 1: PlayVcd(253) break case 2: PlayVcd(310) break case 3: PlayVcd(313) break default: PlayVcd(314) break } i_FlashBangFailedTargets++ printl("===================FlashBangFailedTargets!") } function FlashBangFlashComplete( ) { // nice job avoiding that flashbang PlayVcd(6) printl("===================FlashBangFlashComplete!") printl("===================FlashBangFlashComplete!") printl("===================FlashBangFlashComplete!") } function FlashBangNoFlashComplete( ) { PlayVcd(4) printl("===================FlashBangNoFlashComplete!") printl("===================FlashBangNoFlashComplete!") printl("===================FlashBangNoFlashComplete!") } function BombIntro( ) { PlayVcd(8) printl("===================Bombintro!") printl("===================Bombintro!") printl("===================Bombintro!") } function BombTakeBomb( ) { PlayVcd(292) printl("===================BombTakeBomb!") printl("===================BombTakeBomb!") printl("===================BombTakeBomb!") } function BombPlantA( ) { if (m_BombPlantA==0){ PlayVcd(9) m_BombPlantA=1 } printl("===================BombPlantA!") printl("===================BombPlantA!") printl("===================BombPlantA!") } function BombBeingDefused() { if (m_BombBeingDefused==0){ PlayVcd(280) m_BombBeingDefused=1 } printl("===================BombBeingDefused!") printl("===================BombBeingDefused!") printl("===================BombBeingDefused!") } function BombDefused( ) { PlayVcd(10) printl("===================BombExploded!") printl("===================BombExploded!") printl("===================BombExploded!") } function BombExploded( ) { PlayVcd(ReturnRandom(147,500,0,0,0,0)) printl("===================BombExploded!") printl("===================BombExploded!") printl("===================BombExploded!") } function PlayerViewingWeaponDisplayCase() { // Here are all the guns available to you in the field. Sorry, but the suits will only allow us to use a few in training. PlayVcd( 706 ) } function iDEnemyFire ( ){ local curTime=Time() if (curTime-i_saidFireDamage>15){ i_saidFireDamage=curTime } } function iDFriendlyFire ( ){ local curTime=Time() if (curTime-i_saidFireDamage>15){ i_saidFireDamage=curTime } if (Time() - i_FriendlyFire > 15){ switch (i_FriendlyFireCounter) { case 1: PlayVcd(101) break case 2: PlayVcd(102) break case 3: PlayVcd(103) break case 4: PlayVcd(104) break } i_FriendlyFireCounter=i_FriendlyFireCounter+1 i_FriendlyFire = Time() } } function ActiveTrainingIntro(){ if (m_ReturnVisitor==0){ if (m_StartedTimedCourse==0){ PlayVcd(123) m_StartedTimedCourse=1 } } else{ if (m_StartedTimedCourse==0){ PlayVcd(263) m_StartedTimedCourse=1 } } printl("===================Active Intro!") printl("===================Active Intro!") printl("===================Active Intro!") //pickup gun } function ActiveTrainingTryAgain(){ printl("===================Active Training Try Again!") printl("===================Active Training Try Again!") printl("===================Active Training Try Again!") } function ActiveTrainingStart(){ PlayVcd(124) printl("===================ActiveTrainingStart!") printl("===================ActiveTrainingStart!") printl("===================ActiveTrainingStart!") //open door } function ActiveTrainingAmmoReminder() { PlayVcd(707) } function ActiveTrainingAskLeave() { //You can return to the G-O test center at anytime and repeat just this part of the training. PlayVcd(256) } function ActiveTrainingGoodbye() { // goodbye! PlayVcd(708) } function ActiveTrainingFriendlyFire(){ if (Time() - i_FriendlyFire > 15){ switch (i_FriendlyFireCounter) { case 1: PlayVcd(101) break case 2: PlayVcd(102) break case 3: PlayVcd(103) break case 4: PlayVcd(104) break } i_FriendlyFireCounter=i_FriendlyFireCounter+1 i_FriendlyFire = Time() } printl("===================ActiveTrainingFriendlyFire!") printl("===================ActiveTrainingFriendlyFire!") printl("===================ActiveTrainingFriendlyFire!") } function ActiveTrainingFirstStart(){ PlayVcd(117) printl("===================ActiveTrainingFirstStart!") printl("===================ActiveTrainingFirstStart!") printl("===================ActiveTrainingFirstStart!") } function ActiveTrainingRoom1Start(){ printl("===================ActiveTrainingRoom1Start!") printl("===================ActiveTrainingRoom1Start!") printl("===================ActiveTrainingRoom1Start!") } function ActiveTrainingRoom1End(){ PlayVcd(112) printl("===================ActiveTrainingRoom1End!") printl("===================ActiveTrainingRoom1End!") printl("===================ActiveTrainingRoom1End!") } function ActiveTrainingRoom1ReloadTip() { PlayVcd( ReturnRandom( 513,515,516,0,0,0 ) ) } function ActiveTrainingRoom2Start(){ PlayVcd(108) //PlayVcd(ReturnRandom(110,108,106,0,0,0)) printl("===================ActiveTrainingRoom2Start!") printl("===================ActiveTrainingRoom2Start!") printl("===================ActiveTrainingRoom2Start!") } function ActiveTrainingRoom2End(){ PlayVcd(115) printl("===================ActiveTrainingRoom2End!") printl("===================ActiveTrainingRoom2End!") printl("===================ActiveTrainingRoom2End!") } function ActiveTrainingRoom3Start(){ PlayVcd(116) printl("===================ActiveTrainingRoom3Start!") printl("===================ActiveTrainingRoom3Start!") printl("===================ActiveTrainingRoom3Start!") } function ActiveTrainingRoom3End(){ PlayVcd(114) printl("===================ActiveTrainingRoom3End!") printl("===================ActiveTrainingRoom3End!") printl("===================ActiveTrainingRoom3End!") } function ActiveTrainingRoom4Start(){ PlayVcd(110) printl("===================ActiveTrainingRoom4Start!") printl("===================ActiveTrainingRoom4Start!") printl("===================ActiveTrainingRoom4Start!") } function ActiveTrainingRoom4End(){ PlayVcd(106) printl("===================ActiveTrainingRoom4End!") printl("===================ActiveTrainingRoom4End!") printl("===================ActiveTrainingRoom4End!") } function ActiveTrainingRoom5Start(){ PlayVcd(118) printl("===================ActiveTrainingRoom5Start!") printl("===================ActiveTrainingRoom5Start!") printl("===================ActiveTrainingRoom5Start!") } function ActiveTrainingCompleteVerySlow(){ PlayVcd(ReturnRandom(236,246,258,0,0,0)) } function ActiveTrainingCompleteSlow(){ PlayVcd( ReturnRandom(248,0,0,0,0,0)) // old: 247, 249, 244, 253 } function ActiveTrainingCompleteMedium(){ PlayVcd( ReturnRandom(248,105,0,0,0,0)) // old: 243, 251, 255 } function ActiveTrainingCompleteFast(){ PlayVcd(ReturnRandom (121,0,0,0,0,0)) // old: 250 } function ActiveTrainingCompleteBeatCompany(){ PlayVcd(235) } function ActiveTrainingCompleteSlowBetter(){ PlayVcd(ReturnRandom (239,241,260,0,0,0)) } function ActiveTrainingCompleteMediumBetter(){ PlayVcd(ReturnRandom (238,241,260,0,0,0)) } function ActiveTrainingCompleteFastBetter(){ PlayVcd(ReturnRandom (238,242,0,0,0,0)) } function ActiveTrainingCompleteFirstBad(){ PlayVcd(120) } function ActiveTrainingCompleteFirstGood(){ PlayVcd(122) } function ActiveTrainingCompleteFirstBeatBest(){ PlayVcd(272) } function ActiveTrainingSuggestReloading() { PlayVcd(514) }