home *** CD-ROM | disk | FTP | other *** search
- ---------------------------------------------------------------------------
- OLD LEVEL SCRIPT TEXT:
- ---------------------------------------------------------------------------
-
-
- TraitorTalk("Good morning! Ah, would you look at this weather. What better way to start off the week?")
- GameWait(6)
- TraitorTalk("In case you don't remember me from the tutorial, I'm Traitor.")
- GameWait(5)
- TraitorTalk("I'll be helping you out for a while.")
- GameWait(4)
-
- TraitorTalk("You may be wondering, 'Why do I need his help? Everything looks calm and peaceful.' ");
- GameWait(5)
- TraitorTalk("But just you wait. Since you were kind enough to let me seek refuge in your tower, ")
- GameWait(5)
- TraitorTalk("you'll be rewarded with the wrath of my Invader brethren.");
- GameWait(5)
- TraitorTalk("See, they're not too happy at me for being a... well, being a traitor, ");
- GameWait(5)
- TraitorTalk("and they're also not too happy that you're protecting me.");
- GameWait(5)
-
- TraitorTalk("So anyway, let me show my appreciation by giving you a hand defending the place. ")
- GameWait(6)
- TraitorTalk("Won't be long until my former friends start showing up to pay us a visit.");
- GameWait(6)
-
- -- drop walls
- GameWait(3)
- -- drop traps
- GameWait(3)
-
- TraitorTalk("There, now isn't that better?")
- GameWait(2)
-
- -- pan camera to parachuting invaders
- GameWait(1)
-
- TraitorTalk("Uh oh, looks like they're here already. ... I think I'll sit this one out.")
- GameWait(6)
- TraitorTalk("You have fun now, and... *gulp* ... good luck.")
- GameWait(4)
- G.ActivateTrapDrop()
- end
-
- function TraitorScript_InGame1()
- EnableTraitor();
- TraitorTalk("See those little green ones that look like me?")
- GameWait(4)
- TraitorTalk("So handsome... those are Basic Invaders.");
- GameWait(4)
- TraitorTalk("Not much to 'em, I guess. Just give 'em a toss to get rid of 'em.");
- GameWait(6)
- DisableTraitor();
- end
-
- function TraitorScript_InGame2()
- EnableTraitor();
- TraitorTalk("Hey, look there. That box-looking guy there is a Stacker.")
- GameWait(5)
- TraitorTalk("He's pretty slow and weak, but he's got a neat little trick he does.");
- GameWait(5)
- TraitorTalk("He can hunker down in front of a wall, and allow other Invaders to climb up and over that wall.");
- GameWait(8)
- DisableTraitor();
- end
-
- function TraitorScript_InGame3()
- EnableTraitor();
- TraitorTalk("Now there's a mean guy. That nasty pick-axe shaped Invader is called a Miner.")
- GameWait(5)
- TraitorTalk("He's got an angry streak as wide as... something really wide.");
- GameWait(4)
- TraitorTalk("He'll attack anything he sees! That could put a serious chink in your defenses.");
- GameWait(7)
-
-
- LargeTextPopup( "Level 2: \n Krazy Kamikazes", Color(1,1,1,1) )
-
- G.DisableTrapAll()
- G.EnableTrap("wall");
- G.EnableTrap("laser");
- G.EnableTrap("spring");
- DisableTraitor()
- GameWait(.5)
- EnableTraitor()
- Traitor.SetGuiPosition( "TraitorWindow" , Vector3(0.6, -0.5, 1) );
-
- TraitorTalk("*Yawn* Hey, how're you? I slept great last night, that couch is real comfy!")
- GameWait(6)
- TraitorTalk("How did that thing with the other Invaders go?")
- GameWait(4)
- TraitorTalk("You're still here, so I guess that means you won. Good for you!")
- GameWait(5)
- TraitorTalk("... and, good for me too, hehe.")
- GameWait(3)
-
- --explosion
- GameWait(1)
- TraitorTalk("What was that?!")
- GameWait(1)
- --pan camera to kamikaze running into a wall
- TraitorTalk("Oh no, they must be really mad now!")
- GameWait(3)
- TraitorTalk("They're sending in the demolitionists to try and tear down our defenses.")
- GameWait(6)
- TraitorTalk("Lets get this place into fighting shape!");
- GameWait(3)
-
- -- drop springs
- GameWait(3)
-
- TraitorTalk("Those Spring Traps alone wont be enough.")
- GameWait(4)
- TraitorTalk("These guys will probably just run right by 'em.")
- GameWait(5)
- TraitorTalk("Oh, wait a minute! Here we go, try this...")
- GameWait(3)
-
- -- drop fans
- GameWait(3)
-
- TraitorTalk("These will help push all those hot-heads into the Spring Traps.")
- GameWait(6)
- TraitorTalk("Here, you better put some more down.")
- GameWait(3)
-
- G.EnableTrap("fan")
- -- explosion
- GameWait(1)
-
- TraitorTalk("Yikes! Let me know when its over!")
- GameWait(3)
- DisableTraitor()
- end
-
- function TraitorScript_InGame1()
- EnableTraitor();
- TraitorTalk("Boy those Kamikazes are fast!")
- GameWait(3)
- TraitorTalk("Be sure you get rid of them before they get to close to the tower.");
- GameWait(6)
- TraitorTalk("They can do some serious damage if they hit!");
- GameWait(5)
- DisableTraitor();
- end
-
- function TraitorScript_InGame2()
- EnableTraitor();
- TraitorTalk("Those Bombers may look slow, but they pack a mighty wallop.")
- GameWait(5)
- TraitorTalk("They've got a countdown timer, and when it hits zero, they blow up!");
- GameWait(6)
- TraitorTalk("Almost makes you feel sorry for them, doesn't it.");
- GameWait(5)
- DisableTrait
-
-
-
- --
- -- This file describes the functions and various ways to create Spawn Waves:
- -- Groups of enemies that will spawn at the same time of position to attack the enemy.
- --
-
- -- This determines where the enemies spawn
- SpawnMode
- SpawnLocation
-
- Circle Spawn -- Standard
- No Waves -- Starting a level
- Wait for Kills -- After so many kills, spawn this wave
- Wait for Time -- After this much time ...
-
- ...
-
- The main thing is to allow the scripts to set the spawning time and frequency.
- The problem is that the spawners are in a separate file (For --- Knows what reason)
- Solution:
- Move spawners to the same file as the config.
-
- Campaign File Layout:
-
- ---------------------------------------------------------------------------
- LEVEL CODE
- ---------------------------------------------------------------------------
-
- bool Setup = false
- Setup()
- {
- -- Create all the objects and stuff for the level to start
- -- This ends with a paused screen looking at ... something ...
- }
-
- bool IntroOver = false
-
- -- This should be SKIPABLE
- LevelStart()
- {
- -- After unpausing the level proper starts with this
- -- This does the intro with Traitor, and that is all
- Traitor.Say( "Talk talk talk" );
- SpawnStuff
- etc.
- }
-
- -- NOT SKIPABLE (Though we may add in cheats to help us test)
- InGame()
- {
- -- This function describes the in-game sequence of events that leads to victory. Ex:
- Traitor.Say( "Look, here comes a lot of guys" )
- Spawner.StartWave( 1 )
-
- -- The player must survive for 2 Minutes or 50 guys
- WaitForTimeOrKills( 120, 50 )
- Spawners.StopWave()
- Traitor.Say( "I think they're letting up!" )
-
- -- Make sure the rest are killed (30 seconds and they all die)
- WaitForClearEnemies( 30 )
- dg.Invaders()
- Traitor.Say( "That's all of them!" )
-
- Traitor.Say( "You Should Repair or something!" )
- WaitForTime( 30 )
-
- Traitor.Say( "Crap! Here come more! )
- Spawners.StartWave( 2 )
-
- WaitForTimeOrKills( 120, 50 )
- Spawners.StopWave()
- Traitor.Say( "I think they're letting up!" )
-
- -- Make sure the rest are killed (30 seconds and they all die)
- WaitForClearEnemies( 30 )
-
- Traitor.Say( "That's great! You survived! Hooray!" )
-
- ---------------- ANY INGAME VICTORY STUFFF WOULD GO HERE -----------------
-
-
- -- The level is now over
- LevelVictory = true
- }
-
- LevelOverCheck()
- {
- -- Check to see if the level is over for any reason, and exit if so.
- -- This has a custom destruction option for the level
- }
-
- ---------------------------------------------------------------------------
- SPAWNING CODE
- ---------------------------------------------------------------------------
-
- SpawnWaves = {}
- DefaultWaveStruct = {}
-
- -- SPAWN STATS --
- DefaultWaveStruct.SpawnSpeed = 0.0;
- DefaultWaveStruct.MaxSpawn = 0;
- DefaultWaveStruct.GroupPercent = 0.0;
- DefaultWaveStruct.GroupSize = 0;
- DefaultWaveStruct.WhereToSpawn = RandomAnywhere()
-
- -- INVADER SPAWN PERCENTS: --
- DefaultWaveStruct.Prob = {};
- DefaultWaveStruct.Prob.miner = 0.0;
- DefaultWaveStruct.Prob.squad = 0.0;
- DefaultWaveStruct.Prob.bomber = 0.0;
- DefaultWaveStruct.Prob.kamikaze = 0.0;
- DefaultWaveStruct.Prob.driller = 0.0;
- DefaultWaveStruct.Prob.psychic = 0.0;
- DefaultWaveStruct.Prob.ninja = 0.0;
- DefaultWaveStruct.Prob.spiker = 0.0;
- DefaultWaveStruct.Prob.stacker = 0.0;
- DefaultWaveStruct.Prob.basic = 0.0;
- DefaultWaveStruct.ProbTotal = 0.0;
-
- -- INTERNAL VARIABLES --
- DefaultWaveStruct.NumSpawnNext = 0.0;
- DefaultWaveStruct.NextGroupSize = 1;
-
- SpawnWaves[0] = DefaultWaveStruct
-
- ------------------- EXAMPLE WAVES ---------------------
- BasicWave = DefaultWaveStruct
-
- BasicWave.Prob.basic = 1.0;
-
- BasicWave.SpawnSpeed = 0.5;
- BasicWave.MaxSpawn = 25;
- BasicWave.GroupPercent = 0.1;
- BasicWave.GroupSize = 3;
- BasicWave.WhereToSpawn = CircleAroundTower()
-
- ------------------- EXAMPLE WAVES ---------------------
- KamikazeWave = DefaultWaveStruct
-
- BasicWave.Prob.basic = 1.0;
-
- BasicWave.SpawnSpeed = 0.5;
- BasicWave.MaxSpawn = 25;
- BasicWave.GroupPercent = 0.1;
- BasicWave.GroupSize = 3;
- BasicWave.WhereToSpawn = CircleAroundTower()
-
-
-
-
-
-
- StartWave( num, waveStruct )
- {
- if( SpawnWaves[num] == nil )
- SpawnWaves[num] = waveStruct
- else
- -- THIS IS AN ERROR!
- }
-
- EndWave( num )
- {
- if( not( SpawnWaves[num] == nil ) )
- SpawnWaves[num] = nil
- }
-
- EndAllWaves()
- {
- SpawnWaves = nil
- }
-
- SpawnUpdate()
- {
- -- Check what wave is spawning:
- wave = GetCurWave()
-
- if( wave.ShouldSpawn() )
- wave.DoSpawn()
-
- }
-
- MaxNumInvaders = 100 -- Max simultaneous
- SpawnRate = 0.1 -- NumInvaders per second
- GroupPercent = 0.5 -- How many invaders are spawned as part of a group?
- GroupSize = 5 -- How many invaders are in a group (max)
- TotalToSpawn = 0 -- Limit on number to spawn ... This is one way of doing it ...
-
- -- Increments time, and checks if a spawn should be done now:
- ShouldSpawn()
- {
- curNumSpawn += SpawnRate * TimeDiff
-
- if( curNumSpawn > curGroupSize )
- {
- -- Check waht the restriction on # of invaders is
- if( MaxNumInvaders < numInvaders + groupSize )
- return true;
- }
-
- return false
- }
-
- -- This is a function that is need for spawning
- GetSpawnLocation()
- {
- -- Since we moved away from the "Spawners" system, this is better for the game:
- -- Here are some defaults:
-
- -- Remember that squad leaders also serve as mobile spawn locations, so use them here:
- if( squads.exist() && rand(0, 1 ) > 0.1 )
- return squad.position
-
- return CircleAroundTower( radius );
- return HardCodedSpawnpoints( );
- return RandomAnywhere( );
-
- }
-
- -- Knowing that a spawn is valid (May be called by level) spawn it
- DoSpawn()
- {
- -- Find WHERE to spawn
- location = GetSpawnLocation()
-
- for( groupSize )
- {
- -- Find What type to spawn, and spawn it!
- -- Using the probabilities given, spawn the guy:
- }
- }
-