home *** CD-ROM | disk | FTP | other *** search
-
- NuclearMissileID = 0
- FinalCinematic = false
-
- -- Final, nuclear explosion cinematic
- function NuclearCinematic()
-
- FinalCinematic = true
-
- Camera.CinemaMove( Vector3(90,25,90), Vector3(146,8,150), 2 );
-
- local CinemaInvader = G.CreateAt( "Basic", Vector3( 125, 0, 130 ) );
- CinemaInvader.SetPosition( Vector3( 110, 20, 115 ) );
- CinemaInvader.TurnOffAI();
-
- Cursor.SetPosition( Vector3( 115, 25, 110 ) )
- Cursor.SetDirection( Vector3( 1,0,1 ) )
- GameWait(2)
-
- -- Move the hand
- G.SayPhraseScript( "It's ready!", CinemaInvader );
- CinemaInvader.Hop( 20 )
- TraitorTalk( "The nuclear missile is finally ready, Starting Countdown!" );
- GameWait(4)
-
- LargeTextColor = Color(0.8,0.2,0.2,1)
- LargeTextPopup( "5" );
- GameWait(1)
-
- G.SayPhraseScript( "Finally!", CinemaInvader );
- CinemaInvader.Hop( 20 )
- TraitorTalk( "Finally the invader threat will be eliminated!" );
- LargeTextPopup( "4" );
- GameWait(1)
- LargeTextPopup( "3" );
- GameWait(1)
- LargeTextPopup( "2" );
- GameWait(1)
- LargeTextPopup( "1" );
- GameWait(1)
-
- local NuclearMissile = G.AccessCog( NuclearMissileID )
- NuclearMissile.SetBehavior( "Missile" );
- local nukePos = NuclearMissile.GetPosition()
- local activateInv = G.CreateAt( "Ninja", nukePos + Vector3(4,0,0) )
- activateInv.TurnOffAI()
-
- -- Zoom to a hill where traitor & the hand is watching
- GameWait(6)
-
- -- Watch the missile blows up tower (Don't fail mission)
- TraitorTalk( "Oops, guess I should have positioned it better." );
- G.SayPhraseScript( "Oops..." , CinemaInvader );
- GameWait(5)
-
- CinemaInvader.SetDirection( Vector3(1,0,-1) )
- TraitorTalk( "Great working with you, I'll See you next time!" );
- G.SayPhraseScript( "Bye!" , CinemaInvader );
- GameWait(5)
-
- CinemaInvader.Hop( 20 )
- GameWait(0.25)
-
- -- Traitor tries to run away, hand grabs him
- CinemaInvader.SetDirection( Vector3(-1,0,1) )
- GameWait(0.25)
- CinemaInvader.SetVelocity( Vector3(-1,0,1) * 20 )
- GameWait(0.25)
-
-
-
-
- local moveDir = CinemaInvader.GetPosition() - Cursor.GetPosition();
- moveDir[1] = 0;
- Cursor.SetDirection( moveDir )
- Cursor.SetVelocity( moveDir * 1.25)
-
- -- Grab when over traitor
- GameWait(1)
- CinemaInvader.SetVelocity( Vector3(0,0,0) );
- Cursor.SetVelocity( Vector3(0,0,0) );
-
- local cinPos = CinemaInvader.GetPosition()
- Cursor.SetPosition( cinPos )
- Cursor.SetGrabMode( true )
-
- FadeOut(1);
- GameWait(1)
-
- Cursor.SetGrabMode( false )
-
- -- fade to black
- end
-
-
- --Common Level Start Code
- function LevelStartup()
-
- G.Create( "MenuData/HudCog.xml" );
- G.Create( "Data/GameCamera.xml" );
- G.Create( "Data/CursorCog.xml" );
-
- MainLevel = G.Create( "Data/Levels/Campaign10.xml" );
- MainLevel.CreateLevel();
-
- local tempPos = Tower.GetPosition()
- Camera.LookAtPosition( tempPos )
-
- local NuclearMissile = G.CreateAt( "missile", tempPos + Vector3( 0,0,20 ) );
- NuclearMissile.SetBehavior( "None" ); --"Missile" )
- NuclearMissileID = NuclearMissile.GetID()
-
- G.SetInvSpeed( 20 );
- HUD.EnterLevel();
- G.SetGameState( InLevel );
- G.SetPoints( 5 );
-
- G.SetLightTime( 0 );
- G.PostP( "None" );
- --TraitorTalk(" ");
-
- -- gameStartTime = 10000000;
-
- HUD.Message( "VictoryCondition" , "SetText", "Survive until the Missile Activates!" );
- HUD.Message( "LossCondition" , "SetText", "If the Tower or Missile falls you lose." );
-
- G.Create( "Data/SnowCell.xml" );
-
- TraitorCanBeHidden = true
-
-
- end
-
- LevelStartup()
-
- function LevelIntro()
-
- local tempPos = Tower.GetPosition()
- Camera.LookAtPosition( tempPos )
-
- gameStartTime = GameTime;
-
- ColorTextPopup( "Level 10: Nuclear Winter", Color(1,1,1,1) )
-
- G.DisableTrapAll()
-
- G.EnableTrap("wall");
- G.EnableTrap("bomb");
- G.EnableTrap("hammer");
- G.EnableTrap("fan");
- G.EnableTrap("spring");
- G.EnableTrap("zapper");
- G.EnableTrap("vortex");
- G.EnableTrap("axe");
- G.EnableTrap("poison");
- G.EnableTrap("flame");
- G.EnableTrap("bulb");
- G.EnableTrap("laser");
- G.EnableTrap("satellite");
-
- DisableTraitor()
- GameWait(1.5)
-
- G.EarnPoints( 250 );
-
- -- StartCinematic()
- -- NuclearCinematic();
- -- EndCinematic()
-
- -- G.SetGameState( Victory );
- end
-
- function LevelSequence()
-
- -- Layout:
- -- ---------------------
- -- | Tower || Missile |
- -- | || |
- -- ---------------------
- -- More open with Fewer/weaker traps
-
- -- Intro
- TraitorTalk("It's taken days but I think I've got it now.");
- GameWait(4)
- TraitorTalk("That big dome next to the tower hides a missile silo.");
- GameWait(4)
- TraitorTalk("With this new nuclear missile trap we'll finally be able to defeat the invaders.");
- GameWait(7)
- TraitorTalk("But I still need 10 minutes before it'll be operational!");
- GameWait(6)
-
- -- Phase 1: Exploding Ninjas (Spiker/Kamikaze/Ninja) Intense stuff to weed out beginners, large spawn radius
- ToughGuys = createSpawnStruct()
- ToughGuys.Prob.Spiker = 1.5
- ToughGuys.Prob.Kamikaze = 1.0
- ToughGuys.Prob.Ninja = 2.0
-
- ToughGuys.SpawnSpeed = 1.0;
- ToughGuys.MaxSpawn = 15;
- ToughGuys.TotalSpawn = 100;
- ToughGuys.GroupPercent = 0.01;
- ToughGuys.GroupSize = 2;
- ToughGuys.WhereToSpawn = CircleAroundTower
-
- AddWave( "ToughGuys", ToughGuys )
-
- GameWait( 120 )
- StopWave( "ToughGuys" )
-
- TraitorTalk("8 minutes before the missile activates.");
-
- GameWait( 15 )
-
- -- Phase 2: Stacker Strike (Basic/Stacker/Squad) Weaker wave, just tons of guys in close
- StackerWave = createSpawnStruct()
- StackerWave.Prob.Basic = 1.5
- StackerWave.Prob.Squad = 1.0
- StackerWave.Prob.Stacker = 2.0
-
- StackerWave.SpawnSpeed = 2.0;
- StackerWave.MaxSpawn = 50;
- StackerWave.TotalSpawn = 250;
- StackerWave.GroupPercent = 0.15;
- StackerWave.GroupSize = 3;
- StackerWave.WhereToSpawn = SmallCircleAroundTower
-
- AddWave( "StackerWave", StackerWave )
-
- GameWait( 120 )
- StopWave( "StackerWave" )
-
- TraitorTalk("6 minutes before the missile activates.");
-
- GameWait( 15 )
-
- -- Phase 3: Big Guys w/ Power Tools (Psychic/Driller/Miner/Bomber) Medium Wave, Bomber/Psychic close, miner/driller far
- BigGuys = createSpawnStruct()
- BigGuys.Prob.Psychic = 1.5
- BigGuys.Prob.Bomber = 1.0
-
- BigGuys.SpawnSpeed = 1.0;
- BigGuys.MaxSpawn = 50;
- BigGuys.TotalSpawn = 200;
- BigGuys.GroupPercent = 0.01;
- BigGuys.GroupSize = 2;
- BigGuys.WhereToSpawn = SmallCircleAroundTower
-
- PowerTools = createSpawnStruct()
- PowerTools.Prob.Driller = 1.0
- PowerTools.Prob.Miner = 1.5
-
- PowerTools.SpawnSpeed = 1.0;
- PowerTools.MaxSpawn = 50;
- PowerTools.TotalSpawn = 200;
- PowerTools.GroupPercent = 0.15;
- PowerTools.GroupSize = 3;
- PowerTools.WhereToSpawn = CircleAroundTower
-
- AddWave( "BigGuys", BigGuys )
- AddWave( "PowerTools", PowerTools )
- -- G.SetMaxKills( 250 )
-
- GameWait( 120 )
- StopWave( "BigGuys" )
- StopWave( "PowerTools" )
-
- TraitorTalk("Less than 4 minutes before the missile activates.");
-
- GameWait( 15 )
-
- TraitorTalk("They're attacking all-out now!");
- GameWait( 5 )
-
- -- Phase 4: Kitchen Sink (All) Emphasis on harder invaders, (some) random spawn location
- BigGuys.MaxSpawn = 50;
- BigGuys.TotalSpawn = 1000;
-
- PowerTools.MaxSpawn = 50;
- PowerTools.TotalSpawn = 1000;
-
- StackerWave.MaxSpawn = 50;
- StackerWave.TotalSpawn = 1000;
- StackerWave.WhereToSpawn = RandomAnywhere
-
- ToughGuys.MaxSpawn = 50;
- ToughGuys.TotalSpawn = 1000;
-
- AddWave( "BigGuys", BigGuys )
- AddWave( "PowerTools", PowerTools )
- AddWave( "StackerWave", StackerWave )
- AddWave( "ToughGuys", ToughGuys )
-
- GameWait( 120 )
-
- -- Get rid of the easy guys
-
- TraitorTalk("Only 1 minute left.");
-
- StopWave( "StackerWave" )
-
- GameWait( 30 )
-
- -- Just Kamikazes for the end (cinematic will spawn more guys)
- EndAllWaves()
-
- ToughGuys.Prob.Spiker = 0
- ToughGuys.Prob.Kamikaze = 1.0
- ToughGuys.Prob.Ninja = 0
- AddWave( "ToughGuys", ToughGuys )
-
- TraitorTalk("30 seconds left.");
-
- GameWait( 30 )
-
- EndAllWaves()
-
- -- Pause all invaders?
- G.KillAllInvaders();
-
- -- End Cinematic:
- TrapTextPopup("Missile")
-
- StartCinematic()
- NuclearCinematic();
- EndCinematic()
-
- G.SetGameState( Victory );
-
- end
-
- -- Check that the missile is not active either.
- function CheckLevelCompletion( )
-
- -- local tower = G.GetCogName("Tower");
- -- G.Mes( tostring( NuclearMissileID ) )
- local NuclearMissile = G.AccessCog( NuclearMissileID )
-
- if( (( Tower == nil or not Tower.IsValid() )or
- (NuclearMissile == nil or not NuclearMissile.IsValid()) ) and not FinalCinematic ) then
- G.SetGameState( Defeat );
- end
-
- if( not( GameState == InLevel ) ) then
- dofile( "Scripts/GameOver.lua" ); -- The gameover script should do all exit functionality:
- GMain["LevelUpdate"] = nil;
- end
- end
-
- function LevelUpdate()
-
- -- Make sure the player isn't trying to exit the level
- CheckLevelCompletion( )
- UpdateGameMusic()
- -- This is the intro, where you check for level
- if( levelRoutine ) then
- local con, error = coroutine.resume( levelRoutine )
-
- -- Start the Level Sequence:
- if( con == false and GameState == InLevel ) then
- G.Mes( error )
- levelRoutine = coroutine.create( LevelSequence )
- end
- end
- end
-
- levelRoutine = coroutine.create(LevelIntro);
-
- GMain["LevelUpdate"] = LevelUpdate;
-