//**********************************************************************************************
//**                                                                                          **
//**	Welcome to the Map: Warring God's From ( Harry ) Tardis AKA Daniel Jones 01/09/2011   **
//** 	Version: Final                                                                        **
//**                                                                                          **
//**********************************************************************************************

game_manager
{
	spawn
	{
		// Set scenario information

		wm_axis_respawntime		15
		wm_allied_respawntime		15
		wm_set_round_timelimit		30
		wm_setwinner 			-1
		wm_number_of_objectives 8
		// accum 0 holds status of each flag as a bit
		// capped = set, not capped = reset

		globalaccum 0 set 0 //Axis score
		globalaccum 1 set 0 //Allied score
		globalaccum 2 set 0 //Difference

		// If the round timer expires, no one Have won
		// Set the round winner:  0 == AXIS, 1 == ALLIED

		// Change objective Icon
		remapshader "sprites/objective" "warringgods/objective"
		remapshaderflush
		
		wait 500
		
		// Objectives
		// 1: Secure Gold Allies  
		// 2: Stop the Axis from stealing the Allies Gold 
		// 3: Secure Gold Axis 
		// 4: Stop the Allies from stealing the Axis Gold 
		// 5: Build Allies Ladder 
		// 6: Destroy Allies Ladder 
		// 7: Build Axis Ladder 
		// 8: Destroy Axis Ladder 
		
		wm_objective_status 1 0 0
		wm_objective_status 1 1 0
		wm_objective_status 2 0 0
		wm_objective_status 2 1 0
		wm_objective_status 3 0 0
		wm_objective_status 3 1 0
		wm_objective_status 4 0 0
		wm_objective_status 4 1 0
		wm_objective_status 5 0 0
		wm_objective_status 5 1 0
		wm_objective_status 6 0 0
		wm_objective_status 6 1 0
		wm_objective_status 7 0 0
		wm_objective_status 7 1 0
		wm_objective_status 8 0 0
		wm_objective_status 8 1 0
		
		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "war_axis_def"
		wm_addteamvoiceannounce 0 "war_axis_get"
		
		wm_addteamvoiceannounce 1 "war_allies_get"
		wm_addteamvoiceannounce 1 "war_allies_def"

		wm_teamvoiceannounce 0 "war_axis_def"
		wm_teamvoiceannounce 0 "war_axis_get"
		
		wm_teamvoiceannounce 1 "war_allies_get"
		wm_teamvoiceannounce 1 "war_allies_def"
		// *---------------------------------------------------------------------------------*
		// wait for everything to settle
		wait 2000
		
		trigger game_manager bar0axis
		trigger game_manager bar0allies
	}

	trigger add_axis_goldbar
	{
		globalaccum 0 inc 1
		globalaccum 2 inc -1

		trigger axis_gold_crate findwinner
		trigger game_manager axis_Secured

		wm_teamvoiceannounce 0 "war_axis_captured"
		wm_teamvoiceannounce 1 "war_allies_captured"

		trigger gold_axis_full_1 show
		trigger gold_axis_trans_1 hide

		globalaccum 0 abort_if_less_than 2

		trigger gold_axis_full_2 show
		trigger gold_axis_trans_2 hide

		globalaccum 0 abort_if_less_than 3

		trigger gold_axis_full_3 show
		trigger gold_axis_trans_3 hide

		globalaccum 0 abort_if_less_than 4

		trigger gold_axis_full_4 show
		trigger gold_axis_trans_4 hide

		globalaccum 0 abort_if_less_than 5

		trigger gold_axis_full_5 show
		trigger gold_axis_trans_5 hide

		globalaccum 0 abort_if_less_than 6

		trigger gold_axis_full_6 show
		trigger gold_axis_trans_6 hide

		globalaccum 0 abort_if_less_than 7

		trigger gold_axis_full_7 show
		trigger gold_axis_trans_7 hide

		wm_objective_status 3 0 1
		wm_objective_status 3 1 2
		wm_objective_status 4 0 1
		wm_objective_status 4 1 2
		
		wm_announce "^1The Axis win!!"

		wm_setwinner 0
		wait 5000
		wm_endround
	}

	trigger timelimit_hit
	{
		trigger axis_gold_crate didaxiswin
		trigger allies_gold_crate didallieswin

	}

	trigger axis_Secured
	{
		globalaccum 2 inc 1
		globalaccum 0 trigger_if_equal 1 game_manager axis_Secured1
		globalaccum 0 trigger_if_equal 2 game_manager axis_Secured2
		globalaccum 0 trigger_if_equal 3 game_manager axis_Secured3
		globalaccum 0 trigger_if_equal 4 game_manager axis_Secured4
		globalaccum 0 trigger_if_equal 5 game_manager axis_Secured5
		globalaccum 0 trigger_if_equal 6 game_manager axis_Secured6
		globalaccum 0 trigger_if_equal 7 game_manager axis_Secured7
	}

	trigger axis_Secured1
	{
		wm_announce "^1Axis Have Secured The First Gold Crate!"
		trigger self bar1axis
	}

	trigger axis_Secured2
	{
		wm_announce "^1Axis Have Secured The Second Gold Crate!"
		trigger self bar2axis
	}

	trigger axis_Secured3
	{
		wm_announce "^1Axis Have Secured The Third Gold Crate!"
		trigger self bar3axis
	}

	trigger axis_Secured4
	{
		wm_announce "^1Axis Have Secured The Forth Gold Crate!"
		trigger self bar4axis
	}

	trigger axis_Secured5
	{
		wm_announce "^1Axis Have Secured The Fifth Gold Crate!"
		trigger self bar5axis
	}

	trigger axis_Secured6
	{
		wm_announce "^1Axis Have Secured The Sixth Gold Crate!"
		trigger self bar6axis
	}

	trigger axis_Secured7
	{		
		wm_announce "^1Axis Have Secured The Last Gold Crate!"
		trigger self bar7axis
	}

	trigger add_allies_goldbar
	{
		globalaccum 1 inc 1
		globalaccum 2 inc 1

		trigger axis_gold_crate findwinner
		trigger game_manager allies_Secured

		wm_teamvoiceannounce 0 "war_axis_captured"
		wm_teamvoiceannounce 1 "war_allies_captured"

		trigger gold_allies_full_1 show
		trigger gold_allies_trans_1 hide

		globalaccum 1 abort_if_less_than 2

		trigger gold_allies_full_2 show
		trigger gold_allies_trans_2 hide

		globalaccum 1 abort_if_less_than 3

		trigger gold_allies_full_3 show
		trigger gold_allies_trans_3 hide

		globalaccum 1 abort_if_less_than 4

		trigger gold_allies_full_4 show
		trigger gold_allies_trans_4 hide

		globalaccum 1 abort_if_less_than 5

		trigger gold_allies_full_5 show
		trigger gold_allies_trans_5 hide

		globalaccum 1 abort_if_less_than 6

		trigger gold_allies_full_6 show
		trigger gold_allies_trans_6 hide

		globalaccum 1 abort_if_less_than 7

		trigger gold_allies_full_7 show
		trigger gold_allies_trans_7 hide
		
		wm_objective_status 1 1 1
		wm_objective_status 1 0 2
		wm_objective_status 2 1 1
		wm_objective_status 2 0 2	
		
		wm_announce "^4The Allies win!!"
		
		wm_setwinner 1
		wait 5000
		wm_endround
	}

	trigger allies_Secured
	{
		globalaccum 2 inc -1
		globalaccum 1 trigger_if_equal 1 game_manager allies_Secured1
		globalaccum 1 trigger_if_equal 2 game_manager allies_Secured2
		globalaccum 1 trigger_if_equal 3 game_manager allies_Secured3
		globalaccum 1 trigger_if_equal 4 game_manager allies_Secured4
		globalaccum 1 trigger_if_equal 5 game_manager allies_Secured5
		globalaccum 1 trigger_if_equal 6 game_manager allies_Secured6
		globalaccum 1 trigger_if_equal 7 game_manager allies_Secured7
	}

	trigger allies_Secured1
	{
		wm_announce "^4Allied Have Secured The First Gold Crate!"
		trigger self bar1allies
	}
	trigger allies_Secured2
	{
		wm_announce "^4Allied Have Secured The Second Gold Crate!"
		trigger self bar2allies
	}
	trigger allies_Secured3
	{
		wm_announce "^4Allied Have Secured The Third Gold Crate!"
		trigger self bar3allies
	}
	trigger allies_Secured4
	{
		wm_announce "^4Allied Have Secured The Forth Gold Crate!"
		trigger self bar4allies
	}
	trigger allies_Secured5
	{
		wm_announce "^4Allied Have Secured The Fifth Gold Crate!"
		trigger self bar5allies
	}
	trigger allies_Secured6
	{
		wm_announce "^4Allied Have Secured The Sixth Gold Crate!"
		trigger self bar6allies
	}
	trigger allies_Secured7
	{
		wm_announce "^4Allied Have Secured The Last Gold Crate!"
		trigger self bar7allies
	}
}

gold_axis_full_1
{
	spawn
	{
		setstate gold_axis_full_1 invisible
	}

	trigger show
	{
		setstate gold_axis_full_1 default
	}
}

gold_axis_full_2
{
	spawn
	{
		setstate gold_axis_full_2 invisible
	}

	trigger show
	{
		setstate gold_axis_full_2 default
	}
}

gold_axis_full_3
{
	spawn
	{
		setstate gold_axis_full_3 invisible
	}

	trigger show
	{
		setstate gold_axis_full_3 default
	}
}
gold_axis_full_4
{
	spawn
	{
		setstate gold_axis_full_4 invisible
	}

	trigger show
	{
		setstate gold_axis_full_4 default
	}
}
gold_axis_full_5
{
	spawn
	{
		setstate gold_axis_full_5 invisible
	}

	trigger show
	{
		setstate gold_axis_full_5 default
	}
}
gold_axis_full_6
{
	spawn
	{
		setstate gold_axis_full_6 invisible
	}

	trigger show
	{
		setstate gold_axis_full_6 default
	}
}
gold_axis_full_7
{
	spawn
	{
		setstate gold_axis_full_7 invisible
	}

	trigger show
	{
		setstate gold_axis_full_7 default
	}
}

gold_axis_trans_1
{
	spawn
	{
		setstate gold_axis_trans_1 default
	}

	trigger hide
	{
		setstate gold_axis_trans_1 invisible
	}
}

gold_axis_trans_2
{
	spawn
	{
		setstate gold_axis_trans_2 default
	}

	trigger hide
	{
		setstate gold_axis_trans_2 invisible
	}
}

gold_axis_trans_3
{
	spawn
	{
		setstate gold_axis_trans_3 default
	}

	trigger hide
	{
		setstate gold_axis_trans_3 invisible
	}
}
gold_axis_trans_4
{
	spawn
	{
		setstate gold_axis_trans_4 default
	}

	trigger hide
	{
		setstate gold_axis_trans_4 invisible
	}
}
gold_axis_trans_5
{
	spawn
	{
		setstate gold_axis_trans_5 default
	}

	trigger hide
	{
		setstate gold_axis_trans_5 invisible
	}
}
gold_axis_trans_6
{
	spawn
	{
		setstate gold_axis_trans_6 default
	}

	trigger hide
	{
		setstate gold_axis_trans_6 invisible
	}
}
gold_axis_trans_7
{
	spawn
	{
		setstate gold_axis_trans_7 default
	}

	trigger hide
	{
		setstate gold_axis_trans_7 invisible
	}
}

gold_allies_full_1
{
	spawn
	{
		setstate gold_allies_full_1 invisible
	}

	trigger show
	{
		setstate gold_allies_full_1 default
	}
}

gold_allies_full_2
{
	spawn
	{
		setstate gold_allies_full_2 invisible
	}

	trigger show
	{
		setstate gold_allies_full_2 default
	}
}

gold_allies_full_3
{
	spawn
	{
		setstate gold_allies_full_3 invisible
	}

	trigger show
	{
		setstate gold_allies_full_3 default
	}
}
gold_allies_full_4
{
	spawn
	{
		setstate gold_allies_full_4 invisible
	}

	trigger show
	{
		setstate gold_allies_full_4 default
	}
}
gold_allies_full_5
{
	spawn
	{
		setstate gold_allies_full_5 invisible
	}

	trigger show
	{
		setstate gold_allies_full_5 default
	}
}
gold_allies_full_6
{
	spawn
	{
		setstate gold_allies_full_6 invisible
	}

	trigger show
	{
		setstate gold_allies_full_6 default
	}
}
gold_allies_full_7
{
	spawn
	{
		setstate gold_allies_full_7 invisible
	}

	trigger show
	{
		setstate gold_allies_full_7 default
	}
}

gold_allies_trans_1
{
	spawn
	{
		setstate gold_allies_trans_1 default
	}

	trigger hide
	{
		setstate gold_allies_trans_1 invisible
	}
}

gold_allies_trans_2
{
	spawn
	{
		setstate gold_allies_trans_2 default
	}

	trigger hide
	{
		setstate gold_allies_trans_2 invisible
	}
}

gold_allies_trans_3
{
	spawn
	{
		setstate gold_allies_trans_3 default
	}

	trigger hide
	{
		setstate gold_allies_trans_3 invisible
	}
}
gold_allies_trans_4
{
	spawn
	{
		setstate gold_allies_trans_4 default
	}

	trigger hide
	{
		setstate gold_allies_trans_4 invisible
	}
}
gold_allies_trans_5
{
	spawn
	{
		setstate gold_allies_trans_5 default
	}

	trigger hide
	{
		setstate gold_allies_trans_5 invisible
	}
}
gold_allies_trans_6
{
	spawn
	{
		setstate gold_allies_trans_6 default
	}

	trigger hide
	{
		setstate gold_allies_trans_6 invisible
	}
}
gold_allies_trans_7
{
	spawn
	{
		setstate gold_allies_trans_7 default
	}

	trigger hide
	{
		setstate gold_allies_trans_7 invisible
	}
}

axis_gold_flag
{
	death
	{
		trigger game_manager add_axis_goldbar
	}
}

allied_gold_flag
{
	death
	{
		trigger game_manager add_allies_goldbar
	}
}

axis_gold_crate
{
	spawn
	{
		globalaccum 0 set 0 // gold counter
	}

	trigger stolen
	{
		setstate axis_gold_crate invisible
	}

	trigger Secured
	{
		setstate axis_gold_crate default
	}

	trigger returned
	{
		wm_teamvoiceannounce 0 "war_axis_returned"
		wm_teamvoiceannounce 1 "war_allies_returned"
	}

	trigger findwinner
	{
		wm_setwinner -1
		globalaccum 2 abort_if_equal 0
		wm_setwinner 1
		globalaccum 2 abort_if_greater_than -1
		wm_setwinner 0
	}
	trigger didaxiswin
	{
		globalaccum 2 abort_if_greater_than 0
		wm_objective_status 3 0 1
		wm_objective_status 3 1 2
		wm_objective_status 4 0 1
		wm_objective_status 4 1 2		
		wm_announce "^1The Axis win!!"
	}
}

allies_gold_crate
{
	spawn
	{
		globalaccum 0 set 0 // gold counter
	}

	trigger stolen
	{
		setstate allies_gold_crate invisible
	}

	trigger Secured
	{
		setstate allies_gold_crate default
	}

	trigger returned
	{
		wm_teamvoiceannounce 0 "war_axis_returned"
		wm_teamvoiceannounce 1 "war_allies_returned"
	}

	trigger didallieswin
	{
		globalaccum 2 abort_if_less_than 0
		wm_objective_status 1 1 1
		wm_objective_status 1 0 2
		wm_objective_status 2 1 1
		wm_objective_status 2 0 2
		wm_announce "^4The Allies win!!"
	}
}
// ============================
// Main elevator
// ============================
elevator_commands
{
	trigger goto1
	{
		globalaccum 3 abort_if_equal 1
		trigger lift buttonsinvisible
		wait 100
		globalaccum 3 trigger_if_equal 2 lift 2goto1
	}
	trigger goto2
	{
		globalaccum 3 abort_if_equal 2
		trigger lift buttonsinvisible
		wait 100
		globalaccum 3 trigger_if_equal 1 lift 1goto2
	}
}
lift
{
	spawn
	{
		wait 100
		gotomarker path2 300
		globalaccum 3 set 1
		accum 0 set 0
	}
	trigger 2goto1
	{
		wait 100
		playsound sound/movers/switches/switch_01.wav volume 500
		wait 2000
		gotomarker path2 300
		wait 100
		globalaccum 3 set 1
		wait 100
		trigger self buttonsdefault
	}
	trigger 1goto2
	{
		wait 100
		playsound sound/movers/switches/switch_01.wav volume 500
		wait 2000
		gotomarker path1 300
		wait 100
		globalaccum 3 set 2
		wait 100
		trigger self buttonsdefault
	}
	trigger buttonsinvisible
	{
		
		setstate level1_button_trigger invisible
		setstate level2_button_trigger invisible
		setstate level1_elevator_trigger_goto2 invisible
		setstate level2_elevator_trigger_goto1 invisible
	}
	trigger buttonsdefault
	{
		setstate level1_button_trigger default
		setstate level2_button_trigger default
		setstate level1_elevator_trigger_goto2 default
		setstate level2_elevator_trigger_goto1 default
	}
}
// ============================
// Main elevator end
// ============================
// ============================
//  allied elevator
// ============================
allied_elevator_commands
{
	trigger gotoA
	{
		globalaccum 4 abort_if_equal 1
		trigger allied buttonsinvisible
		wait 100
		globalaccum 4 trigger_if_equal 2 allied BgotoA
	}

	trigger gotoB
	{
		globalaccum 4 abort_if_equal 2
		trigger allied buttonsinvisible
		wait 100
		globalaccum 4 trigger_if_equal 1 allied AgotoB
	}
}
allied
{
	spawn
	{
		wait 100
		gotomarker allied1 300
		globalaccum 4 set 1
		accum 4 set 0
	}
	trigger BgotoA
	{
		wait 100
		playsound sound/movers/switches/switch_01.wav volume 500
		wait 2000
		gotomarker allied1 300
		wait 100
		globalaccum 4 set 1
		wait 100
		trigger self buttonsdefault
	}
	trigger AgotoB
	{
		wait 100
		playsound sound/movers/switches/switch_01.wav volume 500
		wait 2000
		gotomarker allied2 300
		wait 100
		globalaccum 4 set 2
		wait 100
		trigger self buttonsdefault
	}
	trigger buttonsinvisible
	{
		
		setstate levelA_button_trigger invisible
		setstate levelB_button_trigger invisible
		setstate levelA_elevator_trigger_gotoB invisible
		setstate levelB_elevator_trigger_gotoA invisible
	}
	trigger buttonsdefault
	{
		setstate levelA_button_trigger default
		setstate levelB_button_trigger default
		setstate levelA_elevator_trigger_gotoB default
		setstate levelB_elevator_trigger_gotoA default
	}
}
// ============================
// allied elevator end
// ============================
// ============================
//  axis elevator
// ============================
axis_elevator_commands
{
	trigger gotoY
	{
		globalaccum 5 abort_if_equal 1
		trigger axis buttonsinvisible
		wait 100
		globalaccum 5 trigger_if_equal 2 axis ZgotoY
	}
	trigger gotoZ
	{
		globalaccum 5 abort_if_equal 2
		trigger axis buttonsinvisible
		wait 100
		globalaccum 5 trigger_if_equal 1 axis YgotoZ
	}
}
axis
{
	spawn
	{
		wait 100
		gotomarker axis1 300
		globalaccum 5 set 1
		accum 5 set 0
	}
	trigger ZgotoY
	{
		wait 100
		playsound sound/movers/switches/switch_01.wav volume 500
		wait 2000
		gotomarker axis1 300
		wait 100
		globalaccum 5 set 1
		wait 100
		trigger self buttonsdefault
	}
	trigger YgotoZ
	{
		wait 100
		playsound sound/movers/switches/switch_01.wav volume 500
		wait 2000
		gotomarker axis2 300
		wait 100
		globalaccum 5 set 2
		wait 100
		trigger self buttonsdefault
	}
	trigger buttonsinvisible
	{
		setstate levelY_button_trigger invisible
		setstate levelZ_button_trigger  invisible
		setstate levelY_elevator_trigger_gotoZ  invisible
		setstate levelZ_elevator_trigger_gotoY  invisible
	}
	trigger buttonsdefault
	{
		setstate levelY_button_trigger  default
		setstate levelZ_button_trigger  default
		setstate levelY_elevator_trigger_gotoZ  default
		setstate levelZ_elevator_trigger_gotoY  default
	}
}
// ==========================
// axis elevator end
// ==========================
// ================================================
//		axis ladder
// ================================================
axisladder
{
	spawn
	{
		wait 50
		trigger self setup
		constructible_class	2	// 2=Satchel 3=Dyna
	}

	trigger setup
	{
		setstate axisladder_materials default		// Crate Models
		setstate axisladder_clip default		// Clip brushes
		setstate axisladder_flag default
	}

	built final
	{
		setstate axisladder_materials invisible		// Crate Models
		setstate axisladder_clip invisible		// Clip brushes
		setstate axisladder_flag invisible
		wm_objective_status 7 0 1
		wm_objective_status 7 1 2
		wm_announce "Axis Team Have Built The Ladder!"
	}

	decayed final
	{
		trigger self setup
	}

	death
	{
		trigger self setup
		wm_objective_status 8 0 2
		wm_objective_status 8 1 1
		wm_announce "Allied Team Have Destroyed The Ladder!" 
	}
}
// ================================================
//		allied ladder
// ================================================
alliedladder
{
	spawn
	{
		wait 50
		trigger self setup
		constructible_class	2	// 2=Satchel 3=Dyna
	}

	trigger setup
	{
		setstate alliedladder_materials default		// Crate Models
		setstate alliedladder_clip default		// Clip brushes
		setstate alliedladder_flag default
	}

	built final
	{
		setstate alliedladder_materials invisible	// Crate Models
		setstate alliedladder_clip invisible		// Clip brushes
		setstate alliedladder_flag invisible
		wm_objective_status 5 1 1
		wm_objective_status 5 0 2	
		wm_announce "Allied Team Have Built The Ladder!"
	}

	decayed final
	{
		trigger self setup
	}

	death
	{
		trigger self setup
		wm_objective_status 6 1 2
		wm_objective_status 6 0 1
		wm_announce "Axis Team Have Destroyed The Ladder!" 
	}
}
// ========================== END ========================== \\
