home *** CD-ROM | disk | FTP | other *** search
-
- function LightningStrike( pos )
- -- Make sure ON terrain
- local level = G.GetCogName("Level");
- pos[1] = level.GetHeight( pos[0], pos[2] )
-
- G.ZapStrike( pos );
- G.CreateAt( "LightningExplosion", pos )
- end
-
-
- -- Lightning and storms
- function ElectrifriedCinematic()
-
- G.SimpleLoadSoundVar( "Zap", "SFX/ZapperActivate", 4 )
-
- TraitorTalk( "It's looking like rather stormy out there!" );
-
- local tower = G.GetCogName("Tower");
- local towerPos = tower.GetPosition();
-
- local CinemaInvader = G.CreateAt( "Basic", Vector3( 122, 0, 134 ) )
- local CinemaInvader2 = G.CreateAt( "Basic", Vector3( 132, 0, 134 ) );
-
- CinemaInvader.TurnOffAI();
- CinemaInvader2.TurnOffAI();
-
- CinemaInvader.SetDirection( Vector3(1,0,0) )
- CinemaInvader2.SetDirection( Vector3(-1,0,0) )
-
- Camera.CinemaMove( towerPos + Vector3(-40,40,-40), towerPos+ Vector3(0,20,0), 3 );
- GameWait(3)
-
- GameWait(1)
-
- -- Lightning strikes!
- LightningStrike( towerPos + Vector3(0, 0, 30) );
- GameWait(0.5)
- LightningStrike( towerPos + Vector3(75, 0, 0) );
-
- TraitorTalk( "Yikes! Lightning!" );
- GameWait(2)
-
- TraitorTalk( "I hope it doesn't hit anything important!" );
- GameWait(4)
-
- -- Hits the tower!
- LightningStrike( towerPos + Vector3(2, 0, 0) );
- GameWait(0.25)
- LightningStrike( towerPos + Vector3(0, 0, 4) );
- GameWait(0.25)
- LightningStrike( towerPos + Vector3(1, 0, -2) );
- GameWait(0.25)
-
- Camera.CinemaMove( towerPos + Vector3(-40,40,-40), towerPos+ Vector3(0,30,0), 0.25 );
- G.ZapStrike( towerPos + Vector3(0, 30, 0 ) );
- G.CreateAt( "LightningExplosion", towerPos + Vector3(0, 30, 0 ) )
- GameWait(0.5)
-
- G.SimplePlaySound( "Zap" );
- G.ZapIt( Tower );
-
- GameWait(0.3)
- G.SimplePlaySound( "Zap" );
- GameWait(0.3)
- G.SimplePlaySound( "Zap" );
- GameWait(0.3)
-
- Tower.TakeDamage( 250 );
-
- G.SimplePlaySound( "Zap" );
- GameWait(0.3)
-
- -- Damage tower
-
- TraitorTalk( "Oh no! It hit the tower!" );
- GameWait(3)
-
- TraitorTalk( "That's some major damage, repairs will be impossible." );
- GameWait(4)
-
- -- It looks like
- local camPos = Vector3(130,40,170)
- Camera.CinemaMove( camPos, Vector3(126,0,130), 4 );
- TraitorTalk( "What's that? Oh no, not invaders!" )
- GameWait(4)
-
- -- Spawn an invader, and kill with lightning
- local invPos = CinemaInvader.GetPosition()
- local invPos2 = CinemaInvader2.GetPosition()
-
- G.SayPhraseScript( "Darn, \n it's raining.", CinemaInvader2 );
- GameWait( 2 );
- G.EndCurrentPhrase( CinemaInvader2 )
-
- Camera.CinemaMove( camPos, invPos, 0.5 );
- CinemaInvader.Hop( 20 )
- G.SayPhraseScript( "Great, \n now I'm wet." , CinemaInvader );
- GameWait( 2 );
- G.EndCurrentPhrase( CinemaInvader )
-
- LightningStrike( invPos );
- GameWait(1)
-
- Camera.CinemaMove( camPos, invPos2, 0.5 );
- CinemaInvader2.Hop( 20 )
- G.SayPhraseScript( "AAAAHHHH!" , CinemaInvader2 );
- GameWait( 2 );
- G.EndCurrentPhrase( CinemaInvader2 )
-
- -- Later:
- TraitorTalk( "All these lightning strikes makes me think!" )
- LightningStrike( invPos2 );
- GameWait(5)
-
- G.KillAllInvaders()
-
- TraitorTalk( "Hold off these guys while I develop my idea!" )
-
- 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/Campaign8.xml" );
- MainLevel.CreateLevel();
-
- G.SetInvSpeed( 20 );
- HUD.EnterLevel();
- G.SetGameState( InLevel );
- G.SetPoints( 0 );
-
- G.SetLightTime( 3 );
- G.PostP( "None" );
- --TraitorTalk(" ");
-
- G.Create( "Data/RainCell.xml" );
-
-
- -- gameStartTime = 10000000;
-
- HUD.Message( "VictoryCondition" , "SetText", "Survive the Chaotic Invasion!" );
- HUD.Message( "LossCondition" , "SetText", "If the Tower falls you lose." );
-
- TraitorCanBeHidden = true
- end
-
- LevelStartup()
-
- function LevelIntro()
-
- local tempPos = Tower.GetPosition()
- Camera.LookAtPosition( tempPos )
-
- gameStartTime = GameTime;
-
- ColorTextPopup( "Level 8: Electri-fried!", Color(1,1,1,1) )
-
- G.DisableTrapAll()
-
- G.EnableTrap("bomb");
- G.EnableTrap("wall");
-
- G.EnableTrap("fan");
- G.EnableTrap("hammer");
- G.EnableTrap("poison");
- G.EnableTrap("bulb");
- G.EnableTrap("vortex");
-
- DisableTraitor()
- GameWait(1.5)
-
- StartCinematic()
- ElectrifriedCinematic()
- EndCinematic()
-
- end
-
- SpawnPoints = {}
-
- function LevelSequence()
-
- -- 1st Have a tower and some walls and let the Basic guys attack.
- Traitor.SetGuiPosition( "TraitorWindow" , Vector3(0.6, -0.5, 1) );
-
- -- Set the spawn points
-
- -- Start Spawning the guys
- BasicWave = createSpawnStruct()
-
- BasicWave.Prob.Basic = 2.0;
- BasicWave.Prob.Miner = 1.0;
- BasicWave.Prob.Ninja = 1.0;
-
- BasicWave.SpawnSpeed = 1.0;
- BasicWave.MaxSpawn = 25;
- BasicWave.TotalSpawn = 48;
- BasicWave.GroupPercent = 0.15;
- BasicWave.GroupSize = 1;
- BasicWave.WhereToSpawn = SmallCircleAroundTower
-
- PsychicWave = createSpawnStruct()
-
- PsychicWave.Prob.Psychic = 1.0;
-
- PsychicWave.SpawnSpeed = 0.9;
- PsychicWave.MaxSpawn = 25;
- PsychicWave.TotalSpawn = 25;
- PsychicWave.GroupPercent = 0.15;
- PsychicWave.GroupSize = 1;
- PsychicWave.WhereToSpawn = RandomAnywhere
-
- AddWave( "BasicAttack", BasicWave )
- G.EarnPoints( 100 );
- G.SetMaxKills( 50 )
-
-
-
- -- GameWait(4)
- -- TraitorTalk("That's odd... the vortexes are at this place too.")
- -- GameWait(4)
- -- TraitorTalk("I don't see any psychics around.")
- -- GameWait(3)
- -- TraitorTalk("Oh well. We have other things to worry about right now.")
- -- GameWait(10)
-
- InvadersKilledWait( 50 )
-
- TraitorTalk("I think I've got almost it...")
- GameWait(3)
-
- TraitorTalk("Huh? What was that?")
- GameWait(3)
-
- AddWave( "PsychicAttack", PsychicWave )
- G.SetMaxKills( 75 )
-
- TraitorTalk("There are Psychics teleporting in!")
- GameWait(6)
-
- InvadersKilledWait( 75 )
-
- TrapTextPopup("Bug Zapper")
- G.EarnPoints( 200 )
- G.EnableTrap("zapper");
-
- TraitorTalk( "I've figured out how to harness the power of lightning!" )
- -- TraitorTalk("Here, I've got something for you. Its a giant Bug Zapper trap." )
- GameWait(5)
- TraitorTalk( "Its a giant Bug Zapper trap, it does major damage to anyone close by.");
- GameWait(4)
- TraitorTalk( "Place them around the base to zap groups of invaders as they appear!")
- GameWaitOrMoney(20)
-
- BasicWave.TotalSpawn = 75
- BasicWave.Prob.Stacker = 0.5;
- BasicWave.Prob.Psychic = 1.0;
- G.SetMaxKills( 150 )
-
- BasicWave.GroupPercent = 0.5;
- BasicWave.GroupSize = 5;
-
- GameWait(10)
-
- InvadersKilledWait( 150 )
- StopWave( "PsychicAttack" )
- StopWave( "BasicAttack" )
- WaitForClearEnemies( 30 )
-
- TraitorTalk("Whew, what a rush!")
- GameWait(3)
- TraitorTalk("Now we can harness the power of the elements!")
- GameWait(6)
-
- G.SetGameState( Victory );
-
- TraitorTalk("Those invaders don't stand a chance!")
- GameWait(5)
-
-
-
- -- TraitorTalk("So here's where all the vortexes lead to!")
- -- GameWait(4)
- -- TraitorTalk("Maybe this wasn't the best spot to build a base...")
- -- GameWait(7)
-
- -- TraitorTalk("With this base here we can use the vortex whenever we want!")
- -- GameWait(5)
- -- TraitorTalk("I think we might be winning against the invaders.")
- -- GameWait(4)
- -- TraitorTalk("That attack seemed pretty intense. Almost desperate...")
- -- GameWait(4)
-
- --G.SetGameState( Victory );
-
- end
-
- lastLightningStrike = GameTime
- timeToStrike = 10
-
- function LevelUpdate()
-
- -- Random Lightning strikes (after intro)
- if( lastLightningStrike + timeToStrike < GameTime ) then
- lastLightningStrike = GameTime
- timeToStrike = math.random( 15, 25 )
-
- local centerPos = Vector3( 256, 0, 256 );
-
- -- Check that the tower still exists, and get it's center:
- if( Tower ~= nil and Tower.IsValid() ) then
- centerPos = Tower.GetPosition()
- end
-
- -- Min radius == 10
- local offsetPos = Vector3( math.random( 256 ) - 128, 0, math.random( 256 ) - 128 )
- while( offsetPos[0] * offsetPos[0] + offsetPos[2] * offsetPos[2] < 125 ) do
- offsetPos = Vector3( math.random( 256 ) - 128, 0,math.random( 256 ) - 128 )
- end
- LightningStrike( centerPos + offsetPos )
- end
-
-
- -- 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;
-