//bazaar scripting by detoeni
//last edited 17.3.2004

game_manager 
{ 
	spawn 
	{ 
		// Game rules 
		wm_axis_respawntime	10
		wm_allied_respawntime	10
		wm_number_of_objectives 3
		wm_set_round_timelimit	10
		
		//objectives

		//1 who has relic
		//2 has relic been stolen
		//3 has the box been opened
		// Current main objectives for each team (0=Axis, 1=Allies)
		wm_set_main_objective		1	0
		wm_set_main_objective		1	1
		
		wm_objective_status 1 0 1 //axis are defending the relic
		wm_objective_status 1 1 0 //allies have not escaped with the relic
		wm_objective_status 2 0 1 //axis have the relic
		wm_objective_status 2 1 0 //allies dont have the relic
		wm_objective_status 3 0 1 //axis are defending the box
		wm_objective_status 3 1 0 //allies have not opened the box

		wait 500
		setautospawn	"axis spawn" 0
		setautospawn	"allied spawn" 1

		wm_set_defending_team 0		//axis is defending team 

		wm_setwinner 0 			//axis will be winners when time runs out 

		accum 1 set 0 //equal to 1 when allies escape
	} 
 
	trigger checkgame 
	{ 
		accum 1 abort_if_not_equal 1 
		wm_setwinner 1 
		wait 500 
		wm_endround 
	} 

	trigger objective1 
	{ 
		wm_objective_status 1 1 1 //allies have escaped with the relic
		wm_objective_status 1 0 0 //axis failed to win
		accum 1 set 1 
		wm_announce "Allied team has run off with the relic!" 
		trigger game_manager checkgame 
	} 

	trigger objective2 
	{ 
		wm_objective_status 3 1 1 //allies have distroyed the box
		wm_objective_status 3 0 0 //axis failed to defend the box
	} 

	trigger axis_object_stolen 
	{ 
		setstate relic_dummy invisible 
		setstate relic_dummy_mcm invisible
		wm_objective_status 2 1 1 // Allies have stolen the relic 
		wm_objective_status 2 0 0 // Axis have lost the relic 
	} 

	trigger axis_object_returned 
	{ 
		setstate relic_dummy default
		setstate relic_dummy_mcm default  
		wm_objective_status 2 0 1 // Axis have returned the relic 
		wm_objective_status 2 1 0 // Allies have lost the relic 
	} 
}

// *********************************************
// ***************** relic stuff ***************
// *********************************************

relic 
{
      trigger stolen 
      { 
          	trigger game_manager axis_object_stolen
      } 

      trigger returned 
      { 
     		trigger game_manager axis_object_returned  
      } 

      trigger captured 
      { 
		
      } 
}

// *********************************************
// ***************** build stuff ***************
// *********************************************
 
box_construction 
{ 
	spawn 	
	{ 
		wait 200 
		constructible_class 3 
   	} 
   	death 
   	{ 
		trigger game_manager objective2
      	setstate relic_box_toi invisible 
      	setstate box_fixed invisible 
		setstate box_damaged default 
		setstate relic_dummy default
		setstate relic_dummy_mcm default 
    		setstate box_dummy invisible 
		setstate box_dummy_mcm invisible
		setstate blast_clip invisible
		setstate lms_box_clip invisible 

      	wm_announce   "Allies have destroyed the Box!!" 
    } 
} 

box_damaged
{
	spawn
	{
		wait 200 
		setstate box_damaged invisible 	
	}
}

box_dummy
{
	spawn
	{
	}
}

box_dummy_mcm
{
	spawn
	{
	}
}

// *********************************************
// ****************** flag stuff ***************
// *********************************************

relic_hold
{
	death
	{
		trigger game_manager objective1 
	}
}

relic_dummy
{
	spawn
	{
		wait 200 
		setstate relic_dummy invisible 
	}
}

relic_dummy_mcm
{
	spawn
	{
		wait 200 
		setstate relic_dummy_mcm invisible 
	}
}

// *********************************************
// ************** lms ammo health **************
// *********************************************

lms_box_clip
{
	spawn
	{
	}
}

lms_n_surply_toi
{
	spawn
	{
		wait 500
		setstate lms_n_surply_toi invisible
		setstate lms_n_surply_mcm invisible
		setstate lms_n_surply_mcm invisible
		setstate lms_n_health_trigger invisible
		setstate lms_n_health_cab invisible
		setstate lms_n_health_clip invisible
		setstate lms_n_ammo_trigger invisible
		setstate lms_n_ammo_cab invisible
		setstate lms_n_ammo_clip invisible
	}
	death
	{
	}
}

lms_s_surply_toi
{
	spawn
	{
		wait 500
		setstate lms_s_surply_toi invisible
		setstate lms_s_surply_mcm invisible
		setstate lms_s_surply_mcm invisible
		setstate lms_s_health_trigger invisible
		setstate lms_s_health_cab invisible
		setstate lms_s_health_clip invisible
		setstate lms_s_ammo_trigger invisible
		setstate lms_s_ammo_cab invisible
		setstate lms_s_ammo_clip invisible
	}
	death
	{
	}
}
