game_manager

	{
		spawn 
   		{
		remapshaderflush
		wait 200 //wait for all entities to spawn
		// Game rules
		wm_axis_respawntime	15
		wm_allied_respawntime	25
		wm_number_of_objectives	8
		wm_set_round_timelimit	60

		// Objectives
		//1 Blow up XF5U #1                 (axis obj)
		//2 Blow up XF5U #3                 (axis obj)
		//3 Destroy the North Gate          (axis obj)
		//4 Destroy the South Gate          (axis obj)
		//5 Destroy the Project Room Door   (axis obj)
		//6 Steal the XF5U Schematics       (axis obj)
		//7 Steal XF5U Fuel Formula         (axis obj)
		//8 Transmit the Documents          (axis obj)

		// Current main objectives for each team (0=Axis, 1=Allies)
		wm_objective_status 1 1 0
		wm_objective_status 1 0 0
		wm_objective_status 2 1 0
		wm_objective_status 2 0 0
		wm_objective_status 3 1 0
		wm_objective_status 3 0 0
		wm_objective_status 4 1 0
		wm_objective_status 4 0 0
		wm_objective_status 5 1 0
		wm_objective_status 5 0 0
		wm_objective_status 6 1 0
		wm_objective_status 6 0 0
		wm_objective_status 7 1 0
		wm_objective_status 7 0 0
		wm_objective_status 8 1 0
		wm_objective_status 8 0 0

		wait 500

		//Accum values
		accum 1 set 0 //Overall Axis status
		accum 2 set 0 //Overall Allied status

		// Stopwatch mode defending team (0=Axis, 1=Allies)
		//wm_set_defending_team	1 //I changed back to Allies

		// Winner on expiration of round timer (0=Axis, 1=Allies, -1=no winner at expiration)

		wm_setwinner 1

		setautospawn "Allied Spawn"	1 // Set Allied Spawn
		setautospawn "Axis Spawn"	0 // Set Axis spawn

		wait 2000

// *----------------------------------- vo ------------------------------------------*

		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_construct"

		wm_teamvoiceannounce 1 "allies_hq_compost_construct"
//*---------------------------------------------------------------------------------*

		disablespeaker alarm
		disablespeaker alarm2
		setstate open_door invisible
		setstate Axis_wobj1 invisible
		setstate Axis_wobj1_spawns invisible

   	}

//Objective Flags

	trigger axisobjectivecounter  //Destruction of Axis objectives
           	 {
                 	//Set accum to increase by 1 so we know that the objective has been completed
                 	accum 1 inc 1

                       	//Call function called checkgame in game_manager to check if the round has been won
                       	trigger game_manager axischeckgame
			trigger game_manager axischeckgame2
           	}

	trigger axischeckgame // checks to see if Axis win requirements have been met

            	{
                       	accum 1 abort_if_not_equal 3
			setstate open_door_hide invisible
			setstate open_door default
			setstate Allied_wobj invisible
			setstate Allied_wobj_spawns invisible
			setstate Axis_wobj1 default
			setstate Axis_wobj1_spawns default
			alertentity axis_wobj1_spawns
			setautospawn "Allied Spawn 2"	1 // Set Allied Spawn
			setautospawn "Axis Spawn 2"	0 // Set Axis Spawn
           	}

	trigger axischeckgame2 // checks to see if Axis win requirements have been met

            	{
                       	accum 1 abort_if_not_equal 5
                       	wm_setwinner 0
			wait 5500
                       	wm_endround
           	}

	trigger alliedcheckgame // checks to see if Allied win requirements have been met
            	{
                       	accum 2 abort_if_not_equal 2
                       	wm_setwinner 1
			wait 5500
                       	wm_endround

		}



}

//End of Game_manager section

//Rocket Fuel

rocket_fuel
{
spawn
{
wait 200
}

trigger stolen
{
	enablespeaker alarm
	//wm_teamvoiceannounce 1 "allies_hq_objtaken"
	//wm_teamvoiceannounce 0 "axis_hq_objtaken"
	wm_announce "^3TAKE THE FORMULA TO THE TRANSMITTER!!!"
	wm_announce "^3THE AXIS HAVE STOLEN THE FORMULA!!!"
	setstate rocket_fuel_cm_marker invisible
}

trigger returned
{
	disablespeaker alarm
	//wm_teamvoiceannounce 1 "allies_hq_objsec"
	//wm_teamvoiceannounce 0 "axis_hq_objsec"
	wm_announce "^3THE ALLIES HAVE RETURNED THE XF5U FUEL FORMULA!!!"
	wm_announce "^3THE FX5U FUEL FORMULA HAS BEEN RETURNED, PROTECT THE FORMULA!!!"
	setstate rocket_fuel_cm_marker default
}

	trigger dropped
	{

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "allies_hq_objlost"
		wm_teamvoiceannounce 0 "axis_hq_objlost"
		// *---------------------------------------------------------------------------------*
	}

trigger captured
	{
		disablespeaker alarm
		wm_announce "^3THE AXIS HAVE TRANSMITTED THE FX4U FUEL FORMULA!!!"
		wm_objective_status 7 0 1
		wm_objective_status 7 1 2
	}
}

allied_objectives //enter this as the scriptname value for the single trigger_flagonly_multiples entity
	{
death
	{

		wm_teamvoiceannounce 0 "axis_hq_objcap"
		wm_teamvoiceannounce 1 "allies_hq_objcap"
		trigger game_manager axisobjectivecounter
	}
} 

//V2 DOCS

v2_docs
{
spawn
{
wait 200
}

trigger stolen
{
	enablespeaker alarm2
	wm_announce "^3TAKE THE XF4U DOCS TO THE TRANSMITTER!!!"
	wm_announce "^3THE AXIS HAVE STOLEN THE FX4U DOCS!!!"
	setstate v2_docs_cm_marker invisible
}

trigger returned
{
	disablespeaker alarm2
	//wm_teamvoiceannounce 1 "allies_hq_objsec"
	//wm_teamvoiceannounce 0 "axis_hq_objsec"
	wm_announce "^3THE ALLIES HAVE RETURNED THE XF4U DOCS!!!"
	wm_announce "^3THE XF4U DOCS HAVE BEEN RETURNED, PROTECT THE DOCUMENTS!!!"
	setstate v2_docs_cm_marker default
}

	trigger dropped
	{

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "allies_hq_objlost"
		wm_teamvoiceannounce 0 "axis_hq_objlost"
		// *---------------------------------------------------------------------------------*
	}

trigger captured
	{
		disablespeaker alarm2
		wm_announce "^3THE AXIS HAVE TRANSMITTED THE XF4U DOCS!!!"
		wm_objective_status 6 0 1
		wm_objective_status 6 1 2
	}
}

allied_objectives //enter this as the scriptname value for the single trigger_flagonly_multiples entity
	{
death
	{

		wm_teamvoiceannounce 0 "axis_hq_objcap"
		wm_teamvoiceannounce 1 "allies_hq_objcap"
		trigger game_manager axisobjectivecounter
	}
} 

// DESTRUCTIBLE OBJECTIVES ================================================

// XF5U #1

v2_1_script
{
	spawn 
	{
		wait 200
		constructible_class 3 
	}

	death 
	{
		setstate xf5u_1_clips invisible
		setstate xf5u_1 invisible
		//disablespeaker north_steam

		wm_teamvoiceannounce 0 "axis_hq_objdest"
		wm_teamvoiceannounce 1 "allies_hq_objdest"
		wm_announce "^3AXIS HAVE DESTROYED THE XF5U #1!!!"


		//wm_objective_status 1 0 1
		//wm_objective_status 1 1 2

		trigger game_manager axisobjectivecounter

	}
}

// XF5U #3

v2_3_script
{
	spawn 
	{
		wait 200
		constructible_class 3 
	}

	death 
	{
		setstate xf5u_3_clips invisible
		//setstate xf5u_3 invisible
		//disablespeaker north_steam

		wm_teamvoiceannounce 0 "axis_hq_objdest"
		wm_teamvoiceannounce 1 "allies_hq_objdest"
		wm_announce "^3AXIS HAVE DESTROYED THE XF5U #3!!!"


		wm_objective_status 1 0 1
		wm_objective_status 1 1 2

		trigger game_manager axisobjectivecounter

	}
}

// XF5U #2

v2_2_script
{
	spawn 
	{
		wait 200
		constructible_class 3 
	}

	death 
	{
		setstate xf5u_2_clips invisible
		//disablespeaker  south_steam
		wm_teamvoiceannounce 0 "axis_hq_objdest"
		wm_teamvoiceannounce 1 "allies_hq_objdest"
		wm_announce "^3AXIS HAVE DESTROYED THE XF5U #2!!!"

		wm_objective_status 2 0 1
		wm_objective_status 2 1 2


		trigger game_manager axisobjectivecounter

	}
}

// XF5U #4
//
//v2_4_script
//{
//	spawn 
//	{
//		wait 200
//		constructible_class 3 
//	}
//
//	death 
//	{
//		setstate xf5u_4_clips invisible
//		//setstate xf5u_3 invisible
//		//disablespeaker north_steam
//
//		wm_teamvoiceannounce 0 "axis_hq_objdest"
//		wm_teamvoiceannounce 1 "allies_hq_objdest"
//		wm_announce "^3AXIS HAVE DESTROYED THE XF5U #4!!!"
//
//
//		//wm_objective_status 1 0 1
//		//wm_objective_status 1 1 2
//
//		trigger game_manager axisobjectivecounter
//
//	}
//}

//docs_safe1_script

docs_safe1_script
{
	spawn 
	{
		wait 200
		constructible_class 3 
	}

	death 
	{
		wm_teamvoiceannounce 1 "allies_hq_objdest"
		wm_teamvoiceannounce 0 "axis_hq_objdest"
		wm_announce "^3AXIS HAVE DESTROYED THE XF4U SCHEMATICS SAFE DOOR!!!"
	}
}


//project_room_door_script

project_room_door_script
{
	spawn 
	{
		wait 200
		constructible_class 3 
	}

	death 
	{
		wm_teamvoiceannounce 1 "allies_hq_objdest"
		wm_teamvoiceannounce 0 "axis_hq_objdest"
		wm_announce "^3AXIS HAVE DESTROYED THE XF4U PROJECT ROOM DOOR!!!"

		wm_objective_status 5 0 1
		wm_objective_status 5 1 2

		//trigger game_manager axisobjectivecounter

	}
}


//South Gate Script

axisconstruct_script
{ 
	spawn 
	{ 
		wait 400 
		constructible_class 2 
		trigger self startup
	} 
	
	buildstart final 
	{ 
	} 

	built final 
	{ 
		setstate axisconstruct_target default 
		setstate axisconstruct_materials invisible
		wm_teamvoiceannounce 1 "allies_hq_conconst_b"
		wm_announce "^3ALLIES HAVE CONSTRUCTED THE SOUTH GATE!!!"
		wm_objective_status 4 0 2
		wm_objective_status 4 1 1
	} 

	decayed final 
	{ 
		trigger self startup 
	} 

	death 
	{ 
		trigger self startup
		wm_teamvoiceannounce 1 "allies_hq_condest_a"
		wm_teamvoiceannounce 0 "axis_hq_condest_a"
		wm_announce "^3THE SOUTH GATE HAS BEEN BREACHED!!!"
		wm_objective_status 4 0 1
		wm_objective_status 4 1 2
	} 

	trigger startup 
	{ 
		setstate axisconstruct_target invisible
		setstate axisconstruct_materials default 
	} 
}

//North Gate Script

axisconstruct2_script
{ 
	spawn 
	{ 
		wait 400 
		constructible_class 2 
		trigger self startup
	} 
	
	buildstart final 
	{ 
	} 

	built final 
	{ 
		setstate axisconstruct2_target default 
		setstate axisconstruct2_materials invisible
		wm_teamvoiceannounce 1 "allies_hq_conconst_a"
		wm_announce "^3ALLIES HAVE CONSTRUCTED THE NORTH GATE!!!"
		wm_objective_status 3 0 2
		wm_objective_status 3 1 1
	} 

	decayed final 
	{ 
		trigger self startup 
	} 

	death 
	{ 
		trigger self startup

		wm_teamvoiceannounce 1 "allies_hq_condest_b"
		wm_teamvoiceannounce 0 "axis_hq_condest_b"
		wm_announce "^3THE NORTH GATE HAS BEEN BREACHED!!!"
		wm_objective_status 3 0 1
		wm_objective_status 3 1 2
	} 

	trigger startup
	{
		setstate axisconstruct2_target invisible
		setstate axisconstruct2_materials default
	}
}

//firetrails

trail1
{
 spawn
 {
  wait 200
  attachtotag mover1 tag_x0y0z0
 }
}

trail2
{
 spawn
 {
  wait 200
  attachtotag mover2 tag_x0y0z0
 }
}

trail3
{
 spawn
 {
  wait 200
  attachtotag mover3 tag_x0y0z0
 }
}

//mover1
//{
// spawn
// {
//  wait 200
//  trigger self move
// }
//
// trigger move
// {
//  setspeed 100 0 0 
//  wait 100
//  setspeed 0 0 0
// }
//}

mover1
{
 spawn
 {
  wait 200
  trigger self move
 }

 trigger move
 {
  setspeed 800 0 -300 
  wait 3500
  setspeed 0 -100 0
  wait 3000
  setspeed -800 0 300
  wait 3500
  setspeed 0 100 0
  wait 3000
  trigger self move
 }

}

mover2
{
 spawn
 {
  wait 200
  trigger self move
 }

 trigger move
 {
  setspeed 800 0 -400 
  wait 3000
  setspeed 0 -100 0
  wait 3000
  setspeed -800 0 400
  wait 3000
  setspeed 0 100 0
  wait 3000
  trigger self move
 }

}

mover3
{
 spawn
 {
  wait 200
  trigger self move
 }

 trigger move
 {
  setspeed 800 0 -500 
  wait 3700
  setspeed 0 -100 0
  wait 3000
  setspeed -800 0 500
  wait 3700
  setspeed 0 100 0
  wait 3000
  trigger self move
 }

}

// NEUTRAL COMMAND POST ================================================
// FROM Goldrush Thx SD!!! prefab by seven 2003 

allied_compost_built
{
	spawn
	{
		wait 400
		trigger allied_compost_built setup

		constructible_class 2
	}

	trigger setup
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0
	}

	buildstart final
	{
		setstate allied_compost_built_model underconstruction
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible
	}

	built final
	{
		setstate allied_compost_built_model default
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible

		trigger allied_compost_built_model enable_allied_features

		enablespeaker allies_compost_sound
	}

	decayed final
	{
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default
	}

	death
	{
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger allied_compost_built_model disable_allied_features

		disablespeaker allies_compost_sound
	}
}

allied_compost_built_model
{
	spawn
	{
		wait 400
		setstate allied_compost_built_model invisible
	}

	trigger enable_allied_features
	{
		setchargetimefactor 1 soldier 0.70
		setchargetimefactor 1 lieutenant 0.70
		setchargetimefactor 1 medic 0.70
		setchargetimefactor 1 engineer 0.70
		setchargetimefactor 1 covertops 0.70
		sethqstatus 1 1

		wm_announce	"Allied Command Post constructed. Charge speed increased!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed_allies"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed"

		wm_removeteamvoiceannounce 1 "allies_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

	}

	trigger disable_allied_features
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0

		wm_announce	"Axis team has destroyed the Allied Command Post!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_construct"

		wm_teamvoiceannounce 1 "allies_hq_compost_damaged"
		// *---------------------------------------------------------------------------------*

	}
}

axis_compost_built
{
	spawn
	{
		wait 400
		trigger axis_compost_built setup

		constructible_class 2
	}

	trigger setup
	{
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0
	}

	buildstart final
	{
		setstate axis_compost_built_model underconstruction
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible
	}

	built final
	{
		setstate axis_compost_built_model default
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible

		trigger axis_compost_built_model enable_axis_features

		enablespeaker axis_compost_sound
	}

	decayed final
	{
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default
	}

	death
	{
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger axis_compost_built_model disable_axis_features

		disablespeaker axis_compost_sound
	}
}

axis_compost_built_model
{
	spawn
	{
		wait 400
		setstate axis_compost_built_model invisible
	}

	trigger enable_axis_features
	{
		setchargetimefactor 0 soldier 0.70
		setchargetimefactor 0 lieutenant 0.70
		setchargetimefactor 0 medic 0.70
		setchargetimefactor 0 engineer 0.70
		setchargetimefactor 0 covertops 0.70
		sethqstatus 0 1

		wm_announce	"Axis Command Post constructed. Charge speed increased!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"

		wm_removeteamvoiceannounce 0 "axis_hq_compost_construct"
		// *---------------------------------------------------------------------------------*


	}

	trigger disable_axis_features
	{
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0

		wm_announce	"Allied team has destroyed the Axis Command Post!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_damaged"

		wm_teamvoiceannounce 1 "allies_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

	}
}