START_SCRIPT_FILE


#Begin integer variables

#Sectional On/Off switches
VDECL VINT SETUP         0
VDECL VINT MOVE          0
VDECL VINT MAP           0
VDECL VINT FIRST_ATTACK  0
VDECL VINT REPAIR        0
VDECL VINT TURRETS       0
VDECL VINT DEFEND        0
VDECL VINT FINAL_ATTACK  0


#Time delays for actions
VDECL VINT ACTION_TIME     0
VDECL VINT ACTION_TIME2    0
VDECL VINT ACTION_TIME3    0
VDECL VINT ACTION_TIME4    0
VDECL VINT BILLBOARD_TIME  0
VDECL VINT END_GAME_TIME   0


#On/Off switches for voices
VDECL VINT VOICE1   0
VDECL VINT VOICE2   0
VDECL VINT VOICE3   0
VDECL VINT VOICE4   0
VDECL VINT VOICE5   0
VDECL VINT VOICE6   0
VDECL VINT VOICE7   0
VDECL VINT VOICE8   0
VDECL VINT VOICE9   0
VDECL VINT VOICE10  0
VDECL VINT VOICE11  0
VDECL VINT VOICE12  0
VDECL VINT VOICE13  0
VDECL VINT VOICE14  0
VDECL VINT VOICE15  0
VDECL VINT VOICE16  0


#On/Off switches for billboards
VDECL VINT BILLBOARD1  0
VDECL VINT BILLBOARD2  0
VDECL VINT BILLBOARD3  0
VDECL VINT BILLBOARD4  0
VDECL VINT BILLBOARD5  0


#Checks for actions within sections
VDECL VINT CHECK_MOVE          0
VDECL VINT CHECK_MAP           0
VDECL VINT SET_CHECK_MAP       0
VDECL VINT CHECK_FIRST_ATTACK  0
VDECL VINT CHECK_REPAIR        0
VDECL VINT DID_REPAIR          0
VDECL VINT CHECK_DEFEND        0
VDECL VINT DID_DEFEND          0
VDECL VINT CHECK_FINAL_ATTACK  0
VDECL VINT END_GAME            0


#Msc variables
VDECL VINT BLDG_COUNT            0
VDECL VINT BOMBER_UPGRADE_COUNT  0
VDECL VINT TANK_UPGRADE_COUNT    0
VDECL VINT AAV_UPGRADE_COUNT     0
VDECL VINT SLDR_UPGRADE_COUNT    0
VDECL VINT POWER_UPGRADE_COUNT   0
VDECL VINT CORRECT_BLDG_COUNT    0
VDECL VINT RABI_BLDG_COUNT       0
VDECL VINT RABT_BLDG_COUNT       0
VDECL VINT WRAITH_HEALTH         0
VDECL VINT TURRET_COUNT          0
VDECL VINT SAMS_COUNT            0
VDECL VINT TURRET_DEFENSE_COUNT  0
VDECL VINT RABT_BLDG_COUNT       0
VDECL VINT RABA_BLDG_COUNT       0


#End integer variables



#Begin location variables
VDECL VLOC COMMAND          LOC ( 128, 92, 0 )
VDECL VLOC FIRST_ATTACK_LOC LOC ( 172, 115, 0 )
VDECL VLOC FINAL_ATTACK_LOC LOC ( 80, 111, 0 )

#End location variables


	#SETUP

        IF ( VBL_TEST SETUP EQUAL 0 ) THEN
	(
		CHANGE_VBL WRAITH_HEALTH SET PLAYER_TANK_HEALTH 0
		SET_USE_DEFAULT_VICTORY 0
		SET_GATE GATE1 1
		SET_GATE GATE2 1
		SET_GATE GATE3 1
		CHANGE_VBL ACTION_TIME SET GAME_TIME
		CHANGE_VBL ACTION_TIME ADD 5
		CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
		CHANGE_VBL BILLBOARD_TIME ADD 1
		CHANGE_VBL SETUP SET 1
	)


	#MOVE

IF (VBL_TEST PLAYER_TANK_HEALTH 0 GREATER_THAN 0) THEN
(

        IF ( AND (( VBL_TEST SETUP EQUAL 1 ) ( VBL_TEST MOVE EQUAL 0 )) ) THEN
	(

		IF ( VBL_TEST CHECK_MOVE EQUAL 0 ) THEN
		(

			IF ( NOT ( CLOSE_PT HTANK 0 COMMAND 20 ) ) THEN
			(

				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME ) THEN
				(

					IF ( VBL_TEST VOICE1 EQUAL 0 ) THEN
					(
						# "Alright, sir, let's move North to a new command bunker."
						SET_NAV_POINT COMMAND ON
                                                PLAY_SOUND TMC01
						CHANGE_VBL VOICE1 SET 1
						CHANGE_VBL ACTION_TIME SET GAME_TIME
						CHANGE_VBL ACTION_TIME ADD 10
						CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 3
					)
					ELSE
					(

						IF ( VBL_TEST VOICE1 EQUAL 1 ) THEN
						(
							# "Commander, move towrads the flashing navigation point on your radar."
							PLAY_SOUND TMC02
							CHANGE_VBL VOICE1 SET 2
                                                        CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME ADD SOUND_LENGTH TMC02
                                                        CHANGE_VBL ACTION_TIME ADD 30
							CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME2 ADD SOUND_LENGTH TMC02
                                                        CHANGE_VBL ACTION_TIME2 ADD 2
                                                        CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
							CHANGE_VBL BILLBOARD_TIME ADD 3
						)
						ELSE
						(
							# "Pilot your Wraith to the nearby command bunker, sir."
							PLAY_SOUND TMC03
							CHANGE_VBL VOICE1 SET 1
							CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME ADD SOUND_LENGTH TMC03
                                                        CHANGE_VBL ACTION_TIME ADD 30
							CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME2 ADD SOUND_LENGTH TMC03
                                                        CHANGE_VBL ACTION_TIME2 ADD 3
                                                        CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
							CHANGE_VBL BILLBOARD_TIME ADD 3
						)
					)
				)


				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
				(
					SHOW_BILLBOARD {FOLLOW FLASHING NAV POINT ON RADAR} 5
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
			ELSE
			(

				IF ( AND (( VBL_TEST BILLBOARD1 EQUAL 0 ) ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME2 )) ) THEN
				(
					# "Good Sir"
					SET_NAV_POINT COMMAND OFF
					PLAY_SOUND TMC04
					SHOW_BILLBOARD {DESTINATION REACHED}
					CHANGE_VBL CHECK_MOVE SET 1
					CHANGE_VBL BILLBOARD1 SET 1
					CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                        CHANGE_VBL ACTION_TIME2 ADD SOUND_LENGTH TMC04
					CHANGE_VBL ACTION_TIME2 ADD 3
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME2
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
		)
		ELSE
		(

			IF ( AND (( VBL_TEST BILLBOARD2 EQUAL 0 ) ( CLOSE_PT HTANK 0 COMMAND 5 )) ) THEN
			(
				SHOW_BILLBOARD {CLAIM SQAURE REACHED \nPRESS 'F9' TO CALL IN A CITADEL} 5
				CHANGE_VBL BILLBOARD2 SET 1
				CHANGE_VBL ACTION_TIME2 SET GAME_TIME
				CHANGE_VBL ACTION_TIME2 ADD 4
			)


			IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME2 ) THEN
			(

				IF ( VBL_TEST VOICE2 EQUAL 0 ) THEN
				(
					# "Drive into the Claim Square and call in your second Citadel"
					PLAY_SOUND TMC05
					CHANGE_VBL VOICE2 SET 1
					CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                        CHANGE_VBL ACTION_TIME2 ADD 20
					CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
					CHANGE_VBL BILLBOARD_TIME ADD 3
				)
				ELSE
				(

					IF ( VBL_TEST VOICE2 EQUAL 1 ) THEN
					(
						# "The Claim Square is lowered and clearly marked by warning stripes."
						PLAY_SOUND TMC06
						CHANGE_VBL VOICE2 SET 2
						CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME2 ADD 30
						CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 1
					)
					ELSE
					(
						# "Sir, you need to be inside the Claim Square to call in a citadel."
						PLAY_SOUND TMC07
						CHANGE_VBL VOICE2 SET 0
						CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME2 ADD 30
						CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 3
					)
				)
			)


			IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
			(
				SHOW_BILLBOARD {IN THE CLAIM SQUARE, PRESS 'F9' FOR A CITADEL} 5
				CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME2
				CHANGE_VBL BILLBOARD_TIME ADD 1
			)



			IF ( AND (( CITADEL_OWNED 0 0 ) ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME3 )) ) THEN
			(

				IF ( VBL_TEST BILLBOARD4 EQUAL 0 ) THEN
				(
					CHANGE_VBL BILLBOARD4 SET 1
					CHANGE_VBL ACTION_TIME3 SET GAME_TIME
					CHANGE_VBL ACTION_TIME3 ADD 4
				)
				ELSE
				(
					# "Well done, sir"
					PLAY_SOUND TMC08
					SHOW_BILLBOARD {CITADEL CALLED IN}
					CHANGE_VBL MOVE SET 1
					CHANGE_VBL ACTION_TIME SET GAME_TIME
					CHANGE_VBL ACTION_TIME ADD 5
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
		)
	)


	IF ( AND (( VBL_TEST MOVE EQUAL 1 ) ( NOT ( CITADEL_OWNED 0 0 ) )) ) THEN
	(
		CHANGE_VBL MOVE SET 0
		CHANGE_VBL CHECK_MOVE SET 0
	)


	#MAP
	IF ( AND (( VBL_TEST MOVE EQUAL 1 ) ( VBL_TEST MAP EQUAL 0 )) ) THEN
	(

		IF ( NOT ( PLAYER_PROPS 0 IN_OVERHEAD_MAP ) ) THEN
		(

			IF ( VBL_TEST CHECK_MAP EQUAL 0 ) THEN
			(

				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME ) THEN
				(

					IF ( VBL_TEST VOICE3 EQUAL 0 ) THEN
					(
						# "Let's build some additional factories around this Citadel.""
						PLAY_SOUND TMC09
						CHANGE_VBL VOICE3 SET 1
						CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME ADD 25
						CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME2 ADD SOUND_LENGTH TMC09
                                                CHANGE_VBL ACTION_TIME2 ADD 1
						CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 3
					)
					ELSE
					(
						# "Please go to the satellite map, sir."
						PLAY_SOUND TMC10
						CHANGE_VBL VOICE3 SET 0
						CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME ADD 25
						CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME2 ADD SOUND_LENGTH TMC09
                                                CHANGE_VBL ACTION_TIME2 ADD 1
                                                CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 3
					)
				)


				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
				(
					SHOW_BILLBOARD {PRESS 'O' FOR MAP} 4
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
			ELSE
			(

				IF ( VBL_TEST CHECK_MAP EQUAL 1 ) THEN
				(
					GOTO_OVERHEAD 0
				)
				ELSE
				(
					CHANGE_VBL MAP SET 1
					CHANGE_VBL ACTION_TIME SET GAME_TIME
					CHANGE_VBL ACTION_TIME ADD 5
					CHANGE_VBL ACTION_TIME2 SET GAME_TIME
					CHANGE_VBL ACTION_TIME2 ADD 3
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
		)
		ELSE
		(

			IF ( VBL_TEST SET_CHECK_MAP EQUAL 0 ) THEN
			(
				CHANGE_VBL CHECK_MAP SET 1
				CHANGE_VBL SET_CHECK_MAP SET 1
				CHANGE_VBL ACTION_TIME2 SET GAME_TIME
				CHANGE_VBL ACTION_TIME2 ADD 3
				CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME2
				CHANGE_VBL BILLBOARD_TIME ADD 1
			)


			COUNT_OBJECTS 0 BOMBER_UPGRADE_BLDG BOMBER_UPGRADE_COUNT
			COUNT_OBJECTS 0 TANK_UPGRADE_BLDG TANK_UPGRADE_COUNT
			COUNT_OBJECTS 0 AAV_UPGRADE_BLDG AAV_UPGRADE_COUNT
			COUNT_OBJECTS 0 SLDR_UPGRADE_BLDG SLDR_UPGRADE_COUNT
			COUNT_OBJECTS 0 ENERGY_BLDG POWER_UPGRADE_COUNT
			#CHANGE_VBL SLDR_UPGRADE_COUNT SUB 1
			#CHANGE_VBL POWER_UPGRADE_COUNT SUB 1
			CHANGE_VBL BLDG_COUNT SET 0
			CHANGE_VBL BLDG_COUNT ADD BOMBER_UPGRADE_COUNT
			CHANGE_VBL BLDG_COUNT ADD TANK_UPGRADE_COUNT
			CHANGE_VBL BLDG_COUNT ADD AAV_UPGRADE_COUNT
			CHANGE_VBL BLDG_COUNT ADD SLDR_UPGRADE_COUNT
			CHANGE_VBL BLDG_COUNT ADD POWER_UPGRADE_COUNT
			CHANGE_VBL CORRECT_BLDG_COUNT SET 0


			IF ( VBL_TEST TANK_UPGRADE_COUNT EQUAL 1 ) THEN
			(
				CHANGE_VBL CORRECT_BLDG_COUNT ADD 1
			)


			IF ( VBL_TEST AAV_UPGRADE_COUNT EQUAL 1 ) THEN
			(
				CHANGE_VBL CORRECT_BLDG_COUNT ADD 1
			)


			IF ( VBL_TEST BOMBER_UPGRADE_COUNT EQUAL 1 ) THEN
			(
				CHANGE_VBL CORRECT_BLDG_COUNT ADD 1
			)


			IF ( VBL_TEST BLDG_COUNT LESS_THAN 3 ) THEN
			(

				IF ( AND (( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME2 ) ( VBL_TEST SET_CHECK_MAP EQUAL 1 )) ) THEN
				(

					IF ( VBL_TEST VOICE4 EQUAL 0 ) THEN
					(
						# "Good.  Build a tank, an AAV, and a bomber factory to complement the factories you built earlier."
						PLAY_SOUND TMC11
						CHANGE_VBL VOICE4 SET 1
						CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME2 ADD 20
						CHANGE_VBL ACTION_TIME3 SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME3 ADD SOUND_LENGTH TMC11
                                                CHANGE_VBL ACTION_TIME3 ADD 1
						CHANGE_VBL ACTION_TIME4 SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME4 ADD SOUND_LENGTH TMC11
                                                CHANGE_VBL ACTION_TIME4 ADD 1
						CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 6
					)
					ELSE
					(

						IF ( VBL_TEST VOICE4 EQUAL 1 ) THEN
						(
							# "Sir, you need a tank, an AAV, and a bomber factory."
							PLAY_SOUND TMC12
							CHANGE_VBL VOICE4 SET 2
							CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME2 ADD 30
							CHANGE_VBL ACTION_TIME3 SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME3 ADD SOUND_LENGTH TMC12
                                                        CHANGE_VBL ACTION_TIME3 ADD 1
							CHANGE_VBL ACTION_TIME4 SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME4 ADD SOUND_LENGTH TMC12
                                                        CHANGE_VBL ACTION_TIME4 ADD 1
                                                        CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
							CHANGE_VBL BILLBOARD_TIME ADD 4
						)
						ELSE
						(
							# "Let's get those factories built, Commander."
							PLAY_SOUND TMC13
							CHANGE_VBL VOICE4 SET 1
							CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME2 ADD 30
							CHANGE_VBL ACTION_TIME3 SET GAME_TIME
							CHANGE_VBL ACTION_TIME3 ADD 3
							CHANGE_VBL ACTION_TIME4 SET GAME_TIME
							CHANGE_VBL ACTION_TIME4 ADD 3
							CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
							CHANGE_VBL BILLBOARD_TIME ADD 3
						)
					)
				)


				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
				(
					SHOW_BILLBOARD {AT TOP RIGHT, CLICK FACTORY BUTTONS} 6
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME2
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
			ELSE
			(

				IF ( VBL_TEST CORRECT_BLDG_COUNT EQUAL 3 ) THEN
				(

					IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME4 ) THEN
					(

						IF ( VBL_TEST VOICE5 EQUAL 0 ) THEN
						(
							CHANGE_VBL VOICE5 SET 1
							CHANGE_VBL ACTION_TIME4 SET GAME_TIME
							CHANGE_VBL ACTION_TIME4 ADD 6
						)
						ELSE
						(

							IF ( VBL_TEST VOICE5 EQUAL 1 ) THEN
							(
								# "Good, sir.  Remember, again, that all units and factories cost power to build."
								CHANGE_VBL CHECK_MAP SET 2
								PLAY_SOUND TMC15
								CHANGE_VBL VOICE5 SET 2
								CHANGE_VBL ACTION_TIME4 SET GAME_TIME
								CHANGE_VBL ACTION_TIME4 ADD 10
								CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME4
								CHANGE_VBL BILLBOARD_TIME ADD 1
							)
							ELSE
							(

								IF ( VBL_TEST VOICE5 EQUAL 12 ) THEN
								(
									# "Now, let's return to your Wraith."
									PLAY_SOUND TMC16
									CHANGE_VBL VOICE5 SET 3
									CHANGE_VBL ACTION_TIME4 SET GAME_TIME
                                                                        CHANGE_VBL ACTION_TIME4 ADD 20
									CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
									CHANGE_VBL BILLBOARD_TIME ADD 2
								)
								ELSE
								(
									# "Please return to your Wraith, Commander."
									PLAY_SOUND TMC17
									CHANGE_VBL VOICE5 SET 2
									CHANGE_VBL ACTION_TIME4 SET GAME_TIME
                                                                        CHANGE_VBL ACTION_TIME4 ADD 20
									CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
									CHANGE_VBL BILLBOARD_TIME ADD 2
								)
							)
						)
					)


					IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
					(
						SHOW_BILLBOARD {PRESS 'O' OR 'ESC' TO EXIT} 5
						CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME4
						CHANGE_VBL BILLBOARD_TIME ADD 1
					)
				)
				ELSE
				(

					IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME3 ) THEN
					(

						IF ( VBL_TEST VOICE15 EQUAL 0 ) THEN
						(
							CHANGE_VBL VOICE15 SET 1
							CHANGE_VBL ACTION_TIME3 SET GAME_TIME
							CHANGE_VBL ACTION_TIME3 ADD 6
						)
						ELSE
						(
							# "You haven't built the correct factories, Commander."
							PLAY_SOUND TMC14
							CHANGE_VBL ACTION_TIME2 SET GAME_TIME
							CHANGE_VBL ACTION_TIME2 ADD 5
							CHANGE_VBL ACTION_TIME3 SET GAME_TIME
							CHANGE_VBL ACTION_TIME3 ADD 10
							CHANGE_VBL ACTION_TIME4 SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME3 ADD SOUND_LENGTH TMC14
                                                        CHANGE_VBL ACTION_TIME4 ADD 2
							CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
							CHANGE_VBL BILLBOARD_TIME ADD 3
						)
					)


					IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
					(
						SHOW_BILLBOARD {AT MIDDLE RIGHT, CLICK FACTORY, THEN CLICK 'SELL'} 6
						CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME3
						CHANGE_VBL BILLBOARD_TIME ADD 1
					)
				)
			)
		)
	)


	#ATTACK
	IF ( AND (( VBL_TEST MAP EQUAL 1 ) ( VBL_TEST FIRST_ATTACK EQUAL 0 )) ) THEN
	(

		IF ( VBL_TEST CHECK_FIRST_ATTACK EQUAL 0 ) THEN
		(

			IF ( NOT ( CLOSE_PT HTANK 0 FIRST_ATTACK_LOC 30 ) ) THEN
			(

				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME ) THEN
				(

					IF ( VBL_TEST VOICE6 EQUAL 0 ) THEN
					(
						# "Let's use your new units to attck an enemy compound.  Proceed East."
						SET_NAV_POINT FIRST_ATTACK_LOC ON
						PLAY_SOUND TMC18
						CHANGE_VBL VOICE6 SET 1
						CHANGE_VBL ACTION_TIME SET GAME_TIME
						CHANGE_VBL ACTION_TIME ADD 10
						CHANGE_VBL ACTION_TIME2 SET GAME_TIME
						CHANGE_VBL ACTION_TIME2 ADD 5
						CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 3
					)
					ELSE
					(

						IF ( VBL_TEST VOICE6 EQUAL 1 ) THEN
						(
							# "Find the navigation point on your radar and move towards it, sir."
							PLAY_SOUND TMC19
							CHANGE_VBL VOICE6 SET 2
							CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME ADD 30
							CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME2 ADD SOUND_LENGTH TMC19
                                                        CHANGE_VBL ACTION_TIME2 ADD 1
                                                        CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
							CHANGE_VBL BILLBOARD_TIME ADD 1
						)
						ELSE
						(
							# "Attack the enemy compound in the east, Commander."
							PLAY_SOUND TMC20
							CHANGE_VBL VOICE6 SET 0
							CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME ADD 30
							CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME2 ADD SOUND_LENGTH TMC20
                                                        CHANGE_VBL ACTION_TIME2 ADD 1
							CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
							CHANGE_VBL BILLBOARD_TIME ADD 3
						)
					)
				)


				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
				(
					SHOW_BILLBOARD {FOLLOW FLASHING NAV POINT ON RADAR} 5
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
			ELSE
			(
				SET_NAV_POINT FIRST_ATTACK_LOC OFF


				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME2 ) THEN
				(

					IF ( VBL_TEST VOICE16 EQUAL 0 ) THEN
					(
						# "Use tanks and AAVs to engage enemy forces.  Use bombers to destroy enemy factories."
						PLAY_SOUND TMC21
						SHOW_BILLBOARD {YOU ARE AT THE GATE}
						CHANGE_VBL ACTION_TIME2 SET GAME_TIME
						CHANGE_VBL ACTION_TIME2 ADD SOUND_LENGTH TMC21
                                                CHANGE_VBL ACTION_TIME2 ADD 25
						CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD SOUND_LENGTH TMC21
                                                CHANGE_VBL VOICE16 SET 4
					)
					ELSE
					(
						CHANGE_VBL ACTION_TIME2 SET GAME_TIME
						CHANGE_VBL ACTION_TIME2 ADD 40
						SET_GATE GATE2 0
						CHANGE_VBL CHECK_FIRST_ATTACK SET 1
					)
				)


				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
				(
					SHOW_BILLBOARD {PRESS 'F2' FOR TANKS \nPRESS 'F3' FOR AAVS \nPRESS 'F4' FOR BOMBERS} 7
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME2
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
#I need to set up a system here that pushes the user to engage the enemy
#there are two sounds when the gate goes down
#1- Please attack the enemy compound, sir.  Billboard-Follow flashing nav poin on radar
#2- Follow flashing nav point on your radar, Commander.
		)
		ELSE
		(

			IF ( CLOSE_PT HTANK 0 COMMAND 5 ) THEN
			(
				CHANGE_VBL CHECK_FIRST_ATTACK SET 0
				CHANGE_VBL VOICE6 SET 0
			)


			COUNT_OBJECTS 5 SLDR_GNRTR_BLDG RABI_BLDG_COUNT
			COUNT_OBJECTS 5 AITANK_GNRTR_BLDG RABT_BLDG_COUNT

			#Set variables to the number of preplaced generators
			IF ( OR (( VBL_TEST RABI_BLDG_COUNT EQUAL 3 ) ( VBL_TEST RABT_BLDG_COUNT EQUAL 3 )) ) THEN
			(

				IF ( VBL_TEST GAME_TIME GREATER_THAN ACTION_TIME2 ) THEN
				(

					IF ( VBL_TEST VOICE7 EQUAL 0 ) THEN
					(
						# "Use your bombers to destroy factories!"
						PLAY_SOUND TMC24
						CHANGE_VBL VOICE7 SET 1
						CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME2 ADD 40
						CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 2
					)
					ELSE
					(

						IF ( VBL_TEST VOICE7 EQUAL 1 ) THEN
						(
							# "Keep pressing the attack, Commander."
							PLAY_SOUND TMC25
							CHANGE_VBL VOICE7 SET 2
							CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME2 ADD 40
							CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
							CHANGE_VBL BILLBOARD_TIME ADD 2
						)
						ELSE
						(

							IF ( VBL_TEST VOICE7 EQUAL 2 ) THEN
							(
								# "Use your units against the enemy, sir!"
								PLAY_SOUND TMC26
								CHANGE_VBL VOICE7 SET 0
								CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                                CHANGE_VBL ACTION_TIME2 ADD 40
								CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
								CHANGE_VBL BILLBOARD_TIME ADD 2
							)
						)
					)
				)


				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
				(

					IF ( VBL_TEST BILLBOARD3 EQUAL 0 ) THEN
					(
						SHOW_BILLBOARD {ONLY BOMBERS AND TROOPS DESTROY ENEMY FACTORIES} 7
						CHANGE_VBL BILLBOARD3 SET 1
						CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME2
						CHANGE_VBL BILLBOARD_TIME ADD 1
					)
					ELSE
					(

						IF ( VBL_TEST BILLBOARD3 EQUAL 1 ) THEN
						(
							SHOW_BILLBOARD {PRESS 'F2' FOR TANKS \nPRESS 'F3' FOR AAVS \nPRESS 'F4' FOR BOMBERS} 7
							CHANGE_VBL BILLBOARD3 SET 2
							CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME2
							CHANGE_VBL BILLBOARD_TIME ADD 1
						)
						ELSE
						(
							SHOW_BILLBOARD {TANKS AND AAVS KEEP ENEMY UNITS AT BAY} 6
							CHANGE_VBL BILLBOARD3 SET 0
							CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME2
							CHANGE_VBL BILLBOARD_TIME ADD 1
						)
					)
				)
			)
			ELSE
			(
				CHANGE_VBL FIRST_ATTACK SET 1
				#It is crashing, why can't I change this variable?
				#CHANGE_VBL PLAYER_TANK_HEALTH 0 ADD 1
				#CHANGE_VBL PLAYER_TANK_HEALTH 0 SUB 1
				CHANGE_VBL ACTION_TIME SET GAME_TIME
				CHANGE_VBL ACTION_TIME ADD 5
				CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
				CHANGE_VBL BILLBOARD_TIME ADD 1
			)
		)
	)


	#REPAIR
	IF ( AND (( VBL_TEST FIRST_ATTACK EQUAL 1 ) ( VBL_TEST REPAIR EQUAL 0 )) ) THEN
	(

		IF ( VBL_TEST CHECK_REPAIR EQUAL 0 ) THEN
		(

			IF ( NOT ( CLOSE_PT HTANK 0 COMMAND 20 ) ) THEN
			(

				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME ) THEN
				(
					SET_NAV_POINT COMMAND ON

					IF ( VBL_TEST VOICE8 EQUAL 0 ) THEN
					(
						# "Well done, Commander.  Let's return to your citadel."
						PLAY_SOUND TMC27
						CHANGE_VBL VOICE8 SET 1
						CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME ADD 30
						CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME2 ADD SOUND_LENGTH TMC27
                                                CHANGE_VBL ACTION_TIME2 ADD 1
                                                CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 3
					)
					ELSE
					(
						# "Sir, please return to your Citadel."
						PLAY_SOUND TMC28
						CHANGE_VBL VOICE8 SET 0
						CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME ADD 30
						CHANGE_VBL ACTION_TIME2 SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME2 ADD SOUND_LENGTH TMC28
                                                CHANGE_VBL ACTION_TIME2 ADD 1
                                                CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 2
					)
				)


				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
				(
					SHOW_BILLBOARD {FOLLOW FLASHING NAV POINT ON RADAR} 5
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
			ELSE
			(

				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME2 ) THEN
				(
					# "Good, commander."
					SET_NAV_POINT COMMAND OFF
					PLAY_SOUND TMC29
					SHOW_BILLBOARD {DESTINATION REACHED}
					CHANGE_VBL CHECK_REPAIR SET 1
					CHANGE_VBL ACTION_TIME3 SET GAME_TIME
					CHANGE_VBL ACTION_TIME3 ADD 5
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME3
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
		)
		ELSE
		(

			IF ( VBL_TEST WRAITH_HEALTH EQUAL PLAYER_TANK_HEALTH 0 ) THEN
			(
				CHANGE_VBL DID_REPAIR SET 1
			)


			IF ( VBL_TEST DID_REPAIR EQUAL 0 ) THEN
			(

				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME3 ) THEN
				(

					IF ( VBL_TEST VOICE9 EQUAL 0 ) THEN
					(
						# "Let's repair your Wriath by moving into the Citdel's Claim Square."
						PLAY_SOUND TMC30
						CHANGE_VBL VOICE9 SET 1
						CHANGE_VBL ACTION_TIME3 SET GAME_TIME
						CHANGE_VBL ACTION_TIME3 ADD 10
						CHANGE_VBL ACTION_TIME4 SET GAME_TIME
						CHANGE_VBL ACTION_TIME4 ADD 5
						CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 3
					)
					ELSE
					(

						IF ( VBL_TEST VOICE9 EQUAL 1 ) THEN
						(
							# "Move inside the Claim Square to repair your Wriath, sir."
							PLAY_SOUND TMC31
							CHANGE_VBL VOICE9 SET 2
							CHANGE_VBL ACTION_TIME3 SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME3 ADD 30
							CHANGE_VBL ACTION_TIME4 SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME4 ADD SOUND_LENGTH TMC31
                                                        CHANGE_VBL ACTION_TIME4 ADD 1
                                                        CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
							CHANGE_VBL BILLBOARD_TIME ADD 3
						)
						ELSE
						(

							IF ( VBL_TEST VOICE9 EQUAL 2 ) THEN
							(
								# "The Claim Square is lowered and clearly by warning stripes."
								PLAY_SOUND TMC32
								CHANGE_VBL VOICE9 SET 0
								CHANGE_VBL ACTION_TIME3 SET GAME_TIME
								CHANGE_VBL ACTION_TIME3 ADD 10
								CHANGE_VBL ACTION_TIME4 SET GAME_TIME
                                                                CHANGE_VBL ACTION_TIME4 ADD SOUND_LENGTH TMC32
                                                                CHANGE_VBL ACTION_TIME4 ADD 1
                                                                CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
								CHANGE_VBL BILLBOARD_TIME ADD 3
							)
						)
					)
				)


				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
				(
					SHOW_BILLBOARD {MOVE INTO THE CLAIM SQUARE AND PRESS 'F'} 6
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME3
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
			ELSE
			(

				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME4 ) THEN
				(
					# "Good.  Your Wraith is repaired, and its weapons replenished."
					PLAY_SOUND TMC33
					CHANGE_VBL REPAIR SET 1
					CHANGE_VBL ACTION_TIME SET GAME_TIME
					CHANGE_VBL ACTION_TIME ADD 5
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
		)
	)


	#TURRETS
	IF ( AND (( VBL_TEST REPAIR EQUAL 1 ) ( VBL_TEST TURRETS EQUAL 0 )) ) THEN
	(

		IF ( CLOSE_PT HTANK 0 COMMAND 20 ) THEN
		(
			SET_NAV_POINT COMMAND OFF
			COUNT_OBJECTS 0 TURRET TURRET_COUNT
			COUNT_OBJECTS 0 SAMS SAMS_COUNT
			CHANGE_VBL TURRET_DEFENSE_COUNT SET 0
			CHANGE_VBL TURRET_DEFENSE_COUNT ADD TURRET_COUNT
			CHANGE_VBL TURRET_DEFENSE_COUNT ADD SAMS_COUNT


			IF ( VBL_TEST TURRET_DEFENSE_COUNT EQUAL 3 ) THEN
			(
				CHANGE_VBL TURRETS SET 1
				CHANGE_VBL ACTION_TIME SET GAME_TIME
				CHANGE_VBL ACTION_TIME ADD 5
				CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
				CHANGE_VBL BILLBOARD_TIME ADD 1
			)
			ELSE
			(

				IF ( VBL_TEST GAME_TIME GREATER_THAN ACTION_TIME ) THEN
				(

					IF ( VBL_TEST VOICE10 EQUAL 0 ) THEN
					(
						# "For added defense, let's place turrets and SAM sites around your Citadel."
						PLAY_SOUND TMC34
						CHANGE_VBL VOICE10 SET 1
						CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME ADD 20
						CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 3
					)
					ELSE
					(
						# "Place 3 guns around the perimeter of your Citadel"
						PLAY_SOUND TMC35
						CHANGE_VBL VOICE10 SET 0
						CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME ADD 20
						CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 2
					)
				)


				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
				(

					IF ( VBL_TEST BILLBOARD5 EQUAL 0 ) THEN
					(
						SHOW_BILLBOARD {ONLY 3 GUNS PER CITADEL} 6
						CHANGE_VBL BILLBOARD5 SET 1
						CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 1
					)
					ELSE
					(
						SHOW_BILLBOARD {AIM AT THE GROUND \nPRESS 'F5' FOR TURRETS \nPRESS 'F6' FOR SAMS}
						CHANGE_VBL BILLBOARD5 SET 0
						CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 1
					)
				)
			)
		)
		ELSE
		(

			IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME2 ) THEN
			(
				SET_NAV_POINT COMMAND ON
				# "Sir, please return to your Citadel."
				SHOW_BILLBOARD {FOLLOW FLASHING NAV POINT ON RADAR} 5
				PLAY_SOUND TMC36
				CHANGE_VBL ACTION_TIME2 SET GAME_TIME
				CHANGE_VBL ACTION_TIME2 ADD 10
			)
		)
	)




#Create system to check for fallen turrets
#Have billboard {Rebuild guns by pressing 'F5' and 'F6}
#Other billboard {Deploy units against the enemy.

	#DEFEND
	IF ( AND (( VBL_TEST TURRETS EQUAL 1 ) ( VBL_TEST DEFEND EQUAL 0 )) ) THEN
	(

		IF ( VBL_TEST CHECK_DEFEND EQUAL 0 ) THEN
		(

			IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME ) THEN
			(

				IF ( VBL_TEST VOICE11 EQUAL 0 ) THEN
				(
					# "Okay sir, your Citadel is well fortified.  Now watch it fend off an enemy attack."
					PLAY_SOUND TMC37
					CHANGE_VBL VOICE11 SET 1
					CHANGE_VBL ACTION_TIME SET GAME_TIME
					CHANGE_VBL ACTION_TIME ADD 6
				)
				ELSE
				(
					# "Here comes the enemy."
					PLAY_SOUND TMC38
					CHANGE_VBL CHECK_DEFEND SET 1
					CHANGE_VBL ACTION_TIME SET GAME_TIME
					CHANGE_VBL ACTION_TIME ADD 3
				)
			)
		)
		ELSE
		(

			IF ( VBL_TEST DID_DEFEND EQUAL 0 ) THEN
			(

				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME ) THEN
				(
					CREATE_UNIT TANK1 5 AI_TANK LOC ( 128, 75, 0 ) YAW (0) NULL NULL
					CREATE_UNIT TANK2 5 AI_TANK LOC ( 128, 75, 0 ) YAW (0) NULL NULL
					CREATE_UNIT TANK3 5 AI_TANK LOC ( 128, 75, 0 ) YAW (0) NULL NULL
					CREATE_UNIT AAV1  5 AAV     LOC ( 128, 75, 0 ) YAW (0) NULL NULL
					CREATE_UNIT AAV2  5 AAV     LOC ( 128, 75, 0 ) YAW (0) NULL NULL
					CHANGE_VBL DID_DEFEND SET 1
					CHANGE_VBL ACTION_TIME SET GAME_TIME
					CHANGE_VBL ACTION_TIME ADD 30
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
			ELSE
			(

				IF ( AND (( AND (( LIVED_AND_DIED TANK1 ) ( LIVED_AND_DIED TANK2 )) ) ( AND (( LIVED_AND_DIED TANK3 ) ( LIVED_AND_DIED AAV1 )) )) ) THEN
				(

					IF ( LIVED_AND_DIED AAV2 ) THEN
					(
						CHANGE_VBL DEFEND SET 1
						CHANGE_VBL ACTION_TIME SET GAME_TIME
						CHANGE_VBL ACTION_TIME ADD 7
						CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 1
					)
				)


				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME ) THEN
				(

					IF ( VBL_TEST VOICE14 EQUAL 0 ) THEN
					(
						# "Try finishing off the enemy yourself. Sir"
						PLAY_SOUND TMC39
						CHANGE_VBL VOICE14 SET 1
						CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME ADD 30
						CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 2
					)
					ELSE
					(
						# "Finish off the enemy, Commander."
						PLAY_SOUND TMC40
						CHANGE_VBL VOICE14 SET 0
						CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME ADD 30
						CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 2
					)
				)


				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
				(
					SHOW_BILLBOARD {USE YOUR WRAITH OR \nPRESS 'F12' TO CONTROL CITADEL} 5
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
		)
	)


	#FINAL_ATACK


	IF ( VBL_TEST FINAL_ATTACK EQUAL 1 ) THEN
	(

		IF ( CLOSE_PT HTANK 0 COMMAND 5 ) THEN
		(
			CHANGE_VBL FINAL_ATTACK SET 0
			CHANGE_VBL CHECK_FINAL_ATTACK SET 0
			CHANGE_VBL VOICE12 SET 1
			CHANGE_VBL ACTION_TIME SET GAME_TIME
			CHANGE_VBL ACTION_TIME ADD 5
			CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
			CHANGE_VBL BILLBOARD_TIME ADD 1
		)
	)



	IF ( AND (( VBL_TEST DEFEND EQUAL 1 ) ( VBL_TEST FINAL_ATTACK EQUAL 0 )) ) THEN
	(

		IF ( VBL_TEST CHECK_FINAL_ATTACK EQUAL 0 ) THEN
		(

			IF ( NOT ( CLOSE_PT HTANK 0 FINAL_ATTACK_LOC 25 ) ) THEN
			(

				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME ) THEN
				(

					IF ( VBL_TEST VOICE12 EQUAL 0 ) THEN
					(
						# "Well done, sir.  Now proceed West for your final combat exercise."
						PLAY_SOUND TMC41
						SET_NAV_POINT FINAL_ATTACK_LOC ON
						CHANGE_VBL VOICE12 SET 1
						CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                CHANGE_VBL ACTION_TIME ADD 30
						CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
						CHANGE_VBL BILLBOARD_TIME ADD 3
					)
					ELSE
					(

						IF ( VBL_TEST VOICE12 EQUAL 1 ) THEN
						(
							# "Follow the nav poinnt on your radar, Commander."
							PLAY_SOUND TMC42
							CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME ADD 30
							CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
							CHANGE_VBL BILLBOARD_TIME ADD 3
							CHANGE_VBL VOICE12 SET 2

						)
						ELSE
						(
							# "Please proceed West, sir."
							PLAY_SOUND TMC43
							CHANGE_VBL VOICE12 SET 1
							CHANGE_VBL ACTION_TIME SET GAME_TIME
                                                        CHANGE_VBL ACTION_TIME ADD 30
							CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
							CHANGE_VBL BILLBOARD_TIME ADD 2
						)
					)
				)


				IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
				(
					SHOW_BILLBOARD {FOLLOW FLASHING NAV POINT ON RADAR} 4
					CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME
					CHANGE_VBL BILLBOARD_TIME ADD 1
				)
			)
			ELSE
			(
				SET_NAV_POINT FINAL_ATTACK_LOC OFF
				SET_GATE GATE3 0
				CHANGE_VBL CHECK_FINAL_ATTACK SET 1
				CHANGE_VBL ACTION_TIME2 SET GAME_TIME
				CHANGE_VBL ACTION_TIME2 ADD 45
				CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME2
				CHANGE_VBL BILLBOARD_TIME ADD 1
			)
		)
		ELSE
		(

			IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL ACTION_TIME2 ) THEN
			(

				IF ( VBL_TEST VOICE13 EQUAL 0 ) THEN
				(
					# "Keep presssing the attack, Commander."
					PLAY_SOUND TMC48
					CHANGE_VBL VOICE13 SET 1
					CHANGE_VBL ACTION_TIME2 SET GAME_TIME
					CHANGE_VBL ACTION_TIME2 ADD 35
					CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
					CHANGE_VBL BILLBOARD_TIME ADD 2
				)
				ELSE
				(
					# "Use your units against the enemy, sir!"
					PLAY_SOUND TMC49
					CHANGE_VBL VOICE13 SET 0
					CHANGE_VBL ACTION_TIME2 SET GAME_TIME
					CHANGE_VBL ACTION_TIME2 ADD 35
					CHANGE_VBL BILLBOARD_TIME SET GAME_TIME
					CHANGE_VBL BILLBOARD_TIME ADD 2
				)
			)


			IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL BILLBOARD_TIME ) THEN
			(
				SHOW_BILLBOARD {ONLY TROOPS AND BOMBERS DESTROY FACTORIES} 7
				CHANGE_VBL BILLBOARD_TIME SET ACTION_TIME2
				CHANGE_VBL BILLBOARD_TIME ADD 1
			)


			COUNT_OBJECTS 5 SLDR_GNRTR_BLDG RABI_BLDG_COUNT
			COUNT_OBJECTS 5 AITANK_GNRTR_BLDG RABT_BLDG_COUNT
			COUNT_OBJECTS 5 AAV_GNRTR_BLDG RABA_BLDG_COUNT


			IF ( AND (( VBL_TEST RABI_BLDG_COUNT EQUAL 0 ) ( VBL_TEST RABT_BLDG_COUNT EQUAL 0 )) ) THEN
			(

				IF ( VBL_TEST RABA_BLDG_COUNT EQUAL 0 ) THEN
				(

					IF ( VBL_TEST GAME_TIME GREATER_THAN_EQUAL END_GAME_TIME ) THEN
					(

						IF ( VBL_TEST END_GAME EQUAL 0 ) THEN
						(
							CHANGE_VBL END_GAME SET 1
							CHANGE_VBL END_GAME_TIME SET GAME_TIME
							CHANGE_VBL END_GAME_TIME ADD 3
							CHANGE_VBL ACTION_TIME2 SET END_GAME_TIME
							CHANGE_VBL ACTION_TIME2 ADD 1
						)
						ELSE
						(
							IF ( VBL_TEST END_GAME EQUAL 1 ) THEN
							(
                                                                END_MISSION 0 1 15 {\n  GOOD JOB ON TRAINING MISSION 3, COMMANDER! \n  NOW YOU'RE READY FOR REAL ACTION. \n IF YOU FORGET YOUR TRAINING, REMEMBER THAT ALL OF THE FUNCTIONS AND THEIR DEFAULT KEYS ARE LISTED IN MID - GAME HELP.}
								CHANGE_VBL END_GAME SET 2
								CHANGE_VBL END_GAME_TIME SET GAME_TIME
								CHANGE_VBL END_GAME_TIME ADD 3
								CHANGE_VBL ACTION_TIME2 SET END_GAME_TIME
								CHANGE_VBL ACTION_TIME2 ADD 999
							)
							ELSE
							(
                                                                # "ENEMY FACTORIES DESTROYED, COMMANDER.  CONGRATULATIONS, YOU HAVE COMPLETED YOUR TRAINING."
								PLAY_SOUND TMC50
								CHANGE_VBL FINAL_ATTACK SET 1
							)
						)
					)
				)
			)
		)
	)

)
END_SCRIPT_FILE