/////////////////////////////////////////////////////////////////
// Game manager object
game_manager
{

	////////////////////////////////////////////////
	// Initialising

	// When game starts
	spawn
	{
		// Level initialisation
		wm_set_round_timelimit 12
		wm_setwinner 0
		wait 500
		
		wm_axis_respawntime	20
		wm_allied_respawntime	15
		wm_number_of_objectives 5
		wm_set_round_timelimit	20


		// Set Defending Team for SW Mode
		wm_set_defending_team 0

		// Set objectives
		// 1-Maingate
		// 2-SideWall
		// 3-GarageDoor
		// 4-steal doc
		// 5-transmit doc
		// 6-cpallies
		// 7-cpaxis
		// 8-empty
		// 0:blank|1:tick|2:cross
		// Allies = 1, Axis = 0

		wm_number_of_objectives 6

		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

		// Initial respawn times
		
		wait 100
		globalaccum 2 set 1 
		setautospawn "allied spawn" 1
                 setautospawn "forward spawn" 0
		

		wait 200

		
	}
        
	
}
/////////////////////////////////////////////////////////////////
// The actual relic
docs
{
	spawn
	{
	}

	// Axis capture the relic
	trigger stolen
	{
		// Hide objectivce marker on command map
		setstate docs_toi invisible
		setstate docs_map_marker invisible

		// Mark objective as in Axis control
		wm_objective_status 6 0 2
		wm_objective_status 6 1 1
	}

	// Allies return the relic
	trigger returned
	{
		// Show objectivce marker on command map
		setstate docs_toi default
		setstate docs_map_marker default

		// Mark objective as in Allied control
		wm_objective_status 6 0 0
		wm_objective_status 6 1 0
	}

	// Axis escape with the relic
	trigger captured
	{
		// Mark objective as completed

		// Mark axis as the winners
		wm_setwinner 1



		// Tell everyone
		wm_announce "Allies Have transmitted the Documments"

		// Wait a few seconds
		wait 3000

		// End the round
		wm_endround
	}
}


docs_drop_zone
{
	// When object is created
	spawn
	{
	}
}



forwardspawn_flag
{
	spawn
	{
	 accum 0 set 0	// 0-Axis, 1-Allied
	

	          
	}


	trigger axis_capture
	{

		accum 0 abort_if_not_equal 1

		accum 0 set 0

		
		                  
		

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "radar_axis_bunker_stop"

		wm_teamvoiceannounce 1 "radar_allies_bunker_capture"

		wm_addteamvoiceannounce 0 "radar_axis_bunker_stop"

		wm_addteamvoiceannounce 1 "radar_allies_bunker_capture"
		// *---------------------------------------------------------------------------------*
	setautospawn "allied spawn" 1
		setautospawn "forward spawn" 0

		alertentity forwardspawn_wobj
		wait 200
      
	}

	trigger allied_capture
	{

		accum 0 abort_if_not_equal 0

		accum 0 set 1

			

	
				wait 1000

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "radar_axis_bunker_captured"

		wm_teamvoiceannounce 1 "radar_allies_bunker_captured"

		wm_addteamvoiceannounce 0 "radar_axis_bunker_captured"

		wm_addteamvoiceannounce 1 "radar_allies_bunker_captured"
		// *---------------------------------------------------------------------------------*
	setautospawn "forward spawn" 1
	setautospawn "axis spawn" 0
	
alertentity forwardspawn_wobj	
wait 200


	}

	

	trigger force_allied
	{
		accum 0 abort_if_equal 1 // Do Allied own the flag?
setautospawn "forward spawn" 1
	setautospawn "axis spawn" 0

		alertentity forwardspawn_wobj
            alertentity forwardspawn_spawns
		
            

		
	}

	trigger kill
	{
		remove
	}	

	
	
}

garagedoor //porte de garage
{
	spawn
	{
		wait 200

		constructible_class 3
	}

	death
	{
		trigger forwardspawn_flag force_allied // Switch forward spawn to Allied ONLY

		

		trigger forwardspawn_flag kill

		wm_announce "Allies have breached the Garage Door"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "radar_axis_radars_defend"

		wm_addteamvoiceannounce 1 "radar_allies_radars_steal"

		wm_teamvoiceannounce 0 "radar_axis_entrance1_destroyed"
		wm_teamvoiceannounce 0 "radar_axis_radars_defend"

		wm_teamvoiceannounce 1 "radar_allies_entrance1_destroyed"
		wm_teamvoiceannounce 1 "radar_allies_radars_steal"

		wm_removeteamvoiceannounce 0 "radar_axis_entrances_defend"
		wm_removeteamvoiceannounce 0 "radar_axis_entrance1_defend"
		wm_removeteamvoiceannounce 0 "radar_axis_bunker_stop"

		wm_removeteamvoiceannounce 1 "radar_allies_entrances_destroy"
		wm_removeteamvoiceannounce 1 "radar_allies_entrance1_destroy"
		wm_removeteamvoiceannounce 1 "radar_allies_bunker_capture"

		// *---------------------------------------------------------------------------------*

		wm_objective_status 		3 0 2
		wm_objective_status 		3 1 1

		wm_set_main_objective	1 0
		wm_set_main_objective	1 1
	}
}
maingate //Broken section of Old City wall
{
	spawn
	{
		wait 200

		constructible_class 3
	}

	death
	{
		

		wm_announce "Allies have breached the Main Gate"

		

		wm_objective_status 		1 0 2
		wm_objective_status 		1 1 1

		
	}
}

sidewall //Broken section of Old City wall
{
	spawn
	{
		wait 200

		constructible_class 3
	}

	death
	{
		

		wm_announce	"Allies have breached the Side Entrance!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "radar_axis_entrance2_destroyed"

		wm_teamvoiceannounce 1 "radar_allies_entrance2_destroyed"

		wm_removeteamvoiceannounce 0 "radar_axis_entrances_defend"
		wm_removeteamvoiceannounce 0 "radar_axis_entrance2_defend"

		wm_removeteamvoiceannounce 1 "radar_allies_entrances_destroy"
		wm_removeteamvoiceannounce 1 "radar_allies_entrance2_destroy"
		// *---------------------------------------------------------------------------------*


		

		wm_objective_status 		2 0 2
		wm_objective_status 		2 1 1

		
	}
}


alliesradio_damaged
{ 
spawn 
{ 
wait 400 
setstate alliesradio_damaged invisible 
setstate alliesdamaged_model invisible 
} 

trigger hide 
{ 
setstate alliesradio_damaged invisible 
setstate alliesdamaged_model invisible 
} 

trigger show 
{ 
accum 0 abort_if_equal 0 
setstate alliesradio_damaged default 
setstate alliesdamaged_model default 
} 

trigger enable 
{ 
accum 0 set 1 
} 
} 

alliesradio_closed 
{ 
trigger hide 
{ 
setstate alliesradio_closed invisible 
setstate alliesclosed_model invisible 
} 

trigger show 
{ 
accum 0 abort_if_equal 1 
setstate alliesradio_closed default 
setstate alliesclosed_model default 
} 

trigger disable 
{ 
accum 0 set 1 
setstate alliesradio_closed invisible 
setstate alliesclosed_model invisible 
} 
} 

alliesradio_built 
{ 
spawn 
{ 
wait 400 

constructible_class 2 

trigger alliesradio_built setup 
} 

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 
{ 
trigger alliesopened_model trans 

trigger alliesradio_damaged hide 
trigger alliesradio_closed hide 
} 

built final 
{ 
trigger alliesopened_model show 

trigger alliesradio_damaged enable 
trigger alliesradio_closed disable 
trigger alliedcpspawns_obj on


trigger alliesopened_model enable_allies_features 

enablespeaker allies_compost_sound 
} 

decayed final 
{ 
trigger alliesopened_model hide 

trigger alliesradio_damaged show 
trigger alliesradio_closed show 
} 

death 
{ 
trigger alliesopened_model hide 

trigger alliesradio_damaged show 

trigger alliesopened_model disable_allies_features 
trigger alliedcpspawns_obj off

disablespeaker allies_compost_sound 
} 
} 

alliesopened_model 
{ 
spawn 
{ 
wait 400 
setstate alliesopened_model invisible 
} 

trigger show 
{ 
setstate alliesopened_model default 
} 

trigger hide 
{ 
setstate alliesopened_model invisible 
} 

trigger trans 
{ 
setstate alliesopened_model underconstruction 
} 

trigger enable_allies_features 
{ 
setchargetimefactor 1 soldier 0.75 
setchargetimefactor 1 lieutenant 0.75 
setchargetimefactor 1 medic 0.75 
setchargetimefactor 1 engineer 0.75 
setchargetimefactor 1 covertops 0.75 
sethqstatus 1 1 

wm_announce "Allies 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" 
// *----------------------------------- vo ------------------------------------------* 

wm_objective_status 4 0 2 
wm_objective_status 4 1 1 

} 

trigger disable_allies_features 
{ 
// Some kind of UI pop-up to alert players 
wm_announce "Axis team has destroyed the Allies Command Post!" 

// *----------------------------------- vo ------------------------------------------* 
wm_addteamvoiceannounce 0 "allies_hq_compost_construct" 

wm_teamvoiceannounce 0 "allies_hq_compost_damaged" 
// *----------------------------------- vo ------------------------------------------* 

setchargetimefactor 1 soldier 1 
setchargetimefactor 1 lieutenant 1 
setchargetimefactor 1 medic 1 
setchargetimefactor 1 engineer 1 
setchargetimefactor 1 covertops 1 
sethqstatus 1 0 

wm_objective_status 4 1 0 
wm_objective_status 4 0 0 
} 
} 



alliedcpspawns_obj
{
	spawn
	{
		wait 100
		setstate alliedcpspawns_obj invisible
		setstate alliedcpspawns invisible
	}

	trigger on
	{
		setstate alliedcpspawns_obj default
		setstate alliedcpspawns default
	}

	trigger off
	{
		setstate alliedcpspawns_obj invisible
		setstate alliedcpspawns invisible
	}
}

alliedcpspawns
{
	spawn
	{
		wait 100
		setstate alliedcpspawns invisible
		setstate alliedcpspawns_obj invisible
	}
}


//AXIS COMMAND POST

axisradio_damaged
{ 
spawn 
{ 
wait 400 
setstate axisradio_damaged invisible 
setstate axisdamaged_model invisible 
} 

trigger hide 
{ 
setstate axisradio_damaged invisible 
setstate axisdamaged_model invisible 
} 

trigger show 
{ 
accum 0 abort_if_equal 0 
setstate axisradio_damaged default 
setstate axisdamaged_model default 
} 

trigger enable 
{ 
accum 0 set 1 
} 
} 

axisradio_closed 
{ 
trigger hide 
{ 
setstate axisradio_closed invisible 
setstate axisclosed_model invisible 
} 

trigger show 
{ 
accum 0 abort_if_equal 1 
setstate axisradio_closed default 
setstate axisclosed_model default 
} 

trigger disable 
{ 
accum 0 set 1 
setstate axisradio_closed invisible 
setstate axisclosed_model invisible 
} 
} 

axisradio_built 
{ 
spawn 
{ 
wait 400 

constructible_class 2 

trigger axisradio_built setup 
} 

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 
{ 
trigger axisopened_model trans 

trigger axisradio_damaged hide 
trigger axisradio_closed hide 
} 

built final 
{ 
trigger axisopened_model show 

trigger axisradio_damaged enable 
trigger axisradio_closed disable 



trigger axisopened_model enable_axis_features 

enablespeaker axis_compost_sound 
} 

decayed final 
{ 
trigger axisopened_model hide 

trigger axisradio_damaged show 
trigger axisradio_closed show 
} 

death 
{ 
trigger axisopened_model hide 

trigger axisradio_damaged show 

trigger axisopened_model disable_axis_features 
trigger axiscpspawns_obj off

disablespeaker axis_compost_sound 
} 
} 

axisopened_model 
{ 
spawn 
{ 
wait 400 
setstate axisopened_model invisible 
} 

trigger show 
{ 
setstate axisopened_model default 
} 

trigger hide 
{ 
setstate axisopened_model invisible 
} 

trigger trans 
{ 
setstate axisopened_model underconstruction 
} 

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

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

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

wm_teamvoiceannounce 1 "axis_hq_compost_constructed_axis" 

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

wm_objective_status 7 0 2 
wm_objective_status 7 1 1 

} 

trigger disable_axis_features 
{ 
// Some kind of UI pop-up to alert players 
wm_announce "Allied team has destroyed the Allies Command Post!" 

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

wm_teamvoiceannounce 0 "axis_hq_compost_damaged" 
// *----------------------------------- vo ------------------------------------------* 

setchargetimefactor 0 soldier 1 
setchargetimefactor 0 lieutenant 1 
setchargetimefactor 0 medic 1 
setchargetimefactor 0 engineer 1 
setchargetimefactor 0 covertops 1 
sethqstatus 0 0 

wm_objective_status 7 1 0 
wm_objective_status 7 0 0 
} 
} 

//MG42 CONSTRUCTIBLE

mg42cons_script 
{ 
spawn 
{ 
wait 200 
constructible_class 2 
trigger self startup 
} 

buildstart final 
{ 
} 

built final 
{ 
//setstate m_extra default 
setstate mg42cons_mg42 default 
setstate mg42cons_materials invisible 

// Some kind of UI pop-up to alert players 
wm_announce "Allied team has built the construction!" 
} 

decayed final 
{ 
trigger self startup 
} 

death 
{ 
trigger self startup 
// Some kind of UI pop-up to alert players 
wm_announce "Axis team has destroyed the construction!" 
} 

trigger startup 
{ 
//setstate construction_extra invisible 
setstate mg42cons_mg42 invisible 
setstate mg42cons_materials default 
repairmg42 mg42cons_mg42 
} 
} 


//SIDE WALL
sidewall_cons
{ 
spawn 
{ 
wait 200 
constructible_class 2 
trigger self startup 
} 

buildstart final 
{ 
} 

built final 
{ 
//setstate m_extra default 
setstate sidewall_materials invisible 

// Some kind of UI pop-up to alert players 
wm_announce "Axis team has built the construction!" 
} 

decayed final 
{ 
trigger self startup 
} 

death 
{ 
trigger self startup 
// Some kind of UI pop-up to alert players 
wm_announce "Allied team has destroyed the construction!" 
} 

trigger startup 
{ 
//setstate construction_extra invisible 
setstate sidewall_materials default 

} 
} 


