START_SCRIPT_FILE

VDECL VINT PU_TIME_DELAY 30
VDECL VINT PU_TIME 0
VDECL VINT RANDOM_LOC 0


VDECL VLOC PU_1  LOC (72,240,0)
VDECL VLOC PU_2  LOC (192,248,0)
VDECL VLOC PU_3  LOC (244,228,0)
VDECL VLOC PU_4  LOC (176,216,0)
VDECL VLOC PU_5  LOC (56,164,0)
VDECL VLOC PU_6  LOC (204,132,0)
VDECL VLOC PU_7  LOC (232,136,0)
VDECL VLOC PU_8  LOC (68,96,0)
VDECL VLOC PU_9  LOC (108,92,0)
VDECL VLOC PU_10 LOC (16,24,0)
VDECL VLOC PU_11 LOC (76,12,0)
VDECL VLOC PU_12 LOC (212,32,0)
VDECL VLOC PU_13 LOC (208,48,0)

VDECL VINT CITADEL         0
VDECL VINT PLAYER_SLOT     0
VDECL VINT MISSION_FAILED  0

VDECL VINT P1_CIT_COUNT 0
VDECL VINT P2_CIT_COUNT 0
VDECL VINT P3_CIT_COUNT 0
VDECL VINT P4_CIT_COUNT 0
VDECL VINT IM_CIT_COUNT 0


VDECL VINT CIT_MESSAGE_SWITCH  0


IF(VBL_TEST PU_TIME LESS_THAN GAME_TIME) THEN
(
        CHANGE_VBL PU_TIME SET GAME_TIME
        CHANGE_VBL PU_TIME ADD PU_TIME_DELAY

        CHANGE_VBL RANDOM_LOC SET RANDOM_INT 13

        IF(AND((VBL_TEST RANDOM_LOC EQUAL 0) (NOT(IS_ALIVE LOC_0))))THEN
        (
                CREATE_FIXED_PU LOC_0 0 PU_1 PU_RANDOM 1
        )
        IF(AND((VBL_TEST RANDOM_LOC EQUAL 1) (NOT(IS_ALIVE LOC_1))))THEN
        (
                CREATE_FIXED_PU LOC_1  0 PU_2 PU_RANDOM 1
        )
        IF(AND((VBL_TEST RANDOM_LOC EQUAL 2) (NOT(IS_ALIVE LOC_2))))THEN
        (
                CREATE_FIXED_PU LOC_2  0 PU_3 PU_RANDOM 1
        )
        IF(AND((VBL_TEST RANDOM_LOC EQUAL 3) (NOT(IS_ALIVE LOC_3))))THEN
        (
                CREATE_FIXED_PU LOC_3  0 PU_4 PU_RANDOM 1
        )
        IF(AND((VBL_TEST RANDOM_LOC EQUAL 4) (NOT(IS_ALIVE LOC_4))))THEN
        (
                CREATE_FIXED_PU LOC_4  0 PU_5 PU_RANDOM 1
        )
        IF(AND((VBL_TEST RANDOM_LOC EQUAL 5) (NOT(IS_ALIVE LOC_5))))THEN
        (
                CREATE_FIXED_PU LOC_5  0 PU_6 PU_RANDOM 1
        )
        IF(AND((VBL_TEST RANDOM_LOC EQUAL 6) (NOT(IS_ALIVE LOC_6))))THEN
        (
                CREATE_FIXED_PU LOC_6  0 PU_7 PU_RANDOM 1
        )
        IF(AND((VBL_TEST RANDOM_LOC EQUAL 7) (NOT(IS_ALIVE LOC_7))))THEN
        (
                CREATE_FIXED_PU LOC_7  0 PU_8 PU_RANDOM 1
        )
        IF(AND((VBL_TEST RANDOM_LOC EQUAL 8) (NOT(IS_ALIVE LOC_8))))THEN
        (
                CREATE_FIXED_PU LOC_7  0 PU_9 PU_RANDOM 1
        )
        IF(AND((VBL_TEST RANDOM_LOC EQUAL 9) (NOT(IS_ALIVE LOC_9))))THEN
        (
                CREATE_FIXED_PU LOC_9  0 PU_10 PU_RANDOM 1
        )
        IF(AND((VBL_TEST RANDOM_LOC EQUAL 10) (NOT(IS_ALIVE LOC_10))))THEN
        (
                CREATE_FIXED_PU LOC_10  0 PU_11 PU_RANDOM 1
        )
        IF(AND((VBL_TEST RANDOM_LOC EQUAL 11) (NOT(IS_ALIVE LOC_11))))THEN
        (
                CREATE_FIXED_PU LOC_11  0 PU_12 PU_RANDOM 1
        )
        IF(AND((VBL_TEST RANDOM_LOC EQUAL 12) (NOT(IS_ALIVE LOC_12))))THEN
        (
                CREATE_FIXED_PU LOC_12  0 PU_13 PU_RANDOM 1
        )
)



	CHANGE_VBL P1_CIT_COUNT SET 0
	CHANGE_VBL P2_CIT_COUNT SET 0
	CHANGE_VBL P3_CIT_COUNT SET 0
	CHANGE_VBL P4_CIT_COUNT SET 0
	CHANGE_VBL IM_CIT_COUNT SET 0

	FOR CITADEL EQUAL 0 TO 9 DO
	(

		IF ( CITADEL_OWNED 0 CITADEL ) THEN
		(
			CHANGE_VBL P1_CIT_COUNT ADD 1
		)
		IF ( CITADEL_OWNED 1 CITADEL ) THEN
		(
			CHANGE_VBL P2_CIT_COUNT ADD 1
		)
		IF ( CITADEL_OWNED 2 CITADEL ) THEN
		(
			CHANGE_VBL P3_CIT_COUNT ADD 1
		)
		IF ( CITADEL_OWNED 3 CITADEL ) THEN
		(
			CHANGE_VBL P4_CIT_COUNT ADD 1
		)
		IF ( CITADEL_OWNED 4 CITADEL ) THEN
		(
			CHANGE_VBL IM_CIT_COUNT ADD 1
		)
	)


	IF ( VBL_TEST CIT_MESSAGE_SWITCH EQUAL 0 ) THEN
	(

		IF ( VBL_TEST P1_CIT_COUNT EQUAL 6 ) THEN
		(
			SHOW_BILLBOARD {PLAYER ONE OWNS TWO THIRDS OF THE CITADELS}
		)
		IF ( VBL_TEST P2_CIT_COUNT EQUAL 6 ) THEN
		(
			SHOW_BILLBOARD {PLAYER TWO OWNS TWO THIRDS OF THE CITADELS}
		)
		IF ( VBL_TEST P3_CIT_COUNT EQUAL 6 ) THEN
		(
			SHOW_BILLBOARD {PLAYER THREE OWNS TWO THIRDS OF THE CITADELS}
		)
		IF ( VBL_TEST P4_CIT_COUNT EQUAL 3 ) THEN
		(
			SHOW_BILLBOARD {PLAYER FOUR OWNS TWO THIRDS OF THE CITADELS}
		)
		IF ( VBL_TEST IM_CIT_COUNT EQUAL 3 ) THEN
		(
			SHOW_BILLBOARD {THE IMPERIUM OWNS TWO THIRDS OF THE CITADELS}
		)
	)
	ELSE
	(
		IF ( VBL_TEST P1_CIT_COUNT EQUAL 5 ) THEN
		(
			CHANGE_VBL CIT_MESSAGE_SWITCH SET 0
		)
		IF ( VBL_TEST P2_CIT_COUNT EQUAL 5 ) THEN
		(
			CHANGE_VBL CIT_MESSAGE_SWITCH SET 0
		)
		IF ( VBL_TEST P3_CIT_COUNT EQUAL 5 ) THEN
		(
			CHANGE_VBL CIT_MESSAGE_SWITCH SET 0
		)
		IF ( VBL_TEST P4_CIT_COUNT EQUAL 5 ) THEN
		(
			CHANGE_VBL CIT_MESSAGE_SWITCH SET 0
		)
		IF ( VBL_TEST IM_CIT_COUNT EQUAL 5 ) THEN
		(
			CHANGE_VBL CIT_MESSAGE_SWITCH SET 0
		)
	)




	IF ( CITADEL_OWNED_W_STRG_TOWER 4 ALL ) THEN
	(
		CHANGE_VBL MISSION_FAILED SET 1
	)
	FOR PLAYER_SLOT EQUAL 0 TO 4 DO
	(
		IF ( CITADEL_OWNED_W_STRG_TOWER PLAYER_SLOT ALL ) THEN
		(
			END_MISSION PLAYER_SLOT 1 10 {MISSION ACCOMPLISHED}
			CHANGE_VBL MISSION_FAILED SET 1
		)
	)



	FOR PLAYER_SLOT EQUAL 0 TO 4 DO
	(
		IF ( VBL_TEST MISSION_FAILED EQUAL 1 ) THEN
		(

			IF ( NOT ( CITADEL_OWNED PLAYER_SLOT 0 ) ) THEN
			(
				END_MISSION PLAYER_SLOT 0 10 {MISSION FAILED}
			)
		)
	)



END_SCRIPT_FILE