game_manager
{       
spawn
        {        
        wm_allied_respawntime 7 
        wm_axis_respawntime 7 

        wm_set_round_timelimit 30

        wm_number_of_objectives 4

		// Objectives:
		// 1. get gold
		// 2. defend gold
		// 3. constuct
		// 4. destroy


        wm_set_main_objective		1	0
        wm_set_main_objective		1	1
		wm_objective_status 1 1 2    //get enemy gold
		wm_objective_status 1 0 2
		wm_objective_status 2 1 0    //defend our gold
		wm_objective_status 2 0 0
		wm_objective_status 3 1 2    //construct
		wm_objective_status 3 0 2
		wm_objective_status 4 1 1    //destroy
		wm_objective_status 4 0 1


        // Stopwatch mode defending team (0=Axis, 1=Allies)
        wm_set_defending_team 0   //????

        wm_setwinner -1

        accum 1 set 0 //allies gold counter
        accum 2 set 0 //axis gold counter

        globalaccum 3 set 0 //timelimit not hit
        globalaccum 4 set 0 //allied bunker not built
        globalaccum 5 set 0 //axis bunker not built

//Bunker
      setchargetimefactor 1 soldier 0.5 
      setchargetimefactor 1 lieutenant 0.5 
      setchargetimefactor 1 medic 0.5 
      setchargetimefactor 1 engineer 0.5 
      setchargetimefactor 1 covertops 0.5 
      sethqstatus 1 0
      setchargetimefactor 1 soldier 0.5 
      setchargetimefactor 1 lieutenant 0.5 
      setchargetimefactor 1 medic 0.5 
      setchargetimefactor 1 engineer 0.5 
      setchargetimefactor 1 covertops 0.5 
      sethqstatus 1 0



               //------------ Voice sounds
                wait 2000



		wm_addteamvoiceannounce 0 "df_axis_const_bunk"
		wm_teamvoiceannounce 0 "df_axis_const_bunk"

		wm_addteamvoiceannounce 1 "df_allies_const_bunk"
		wm_teamvoiceannounce 1 "df_allies_const_bunk"

		wm_addteamvoiceannounce 0 "df_axis_get_gold"
		wm_teamvoiceannounce 0 "df_axis_get_gold"

		wm_addteamvoiceannounce 1 "df_allies_get_gold"
		wm_teamvoiceannounce 1 "df_allies_get_gold"  
 
        }      

	// ================================================
	// ============ The Secret Dokuments ==============
	// ================================================

	trigger gotAlliesO 
	{
		accum 2 inc 1
		trigger game_manager checkgameAxis
		wm_teamvoiceannounce 0 "df_axis_obj_cap"
		wm_teamvoiceannounce 1 "df_allies_obj_lost"
	}

	trigger axis_object_stolen
	{
         //wm_announce "Allied have stolen "
      	}

	trigger axis_object_returned
	{
         //wm_announce "Axis have returned "  
	}

	trigger gotAxisO 
	{
		accum 1 inc 1
		trigger game_manager checkgameAllies
		wm_teamvoiceannounce 1 "df_allies_obj_cap"
		wm_teamvoiceannounce 0 "df_axis_obj_lost"
	}

	trigger allies_object_stolen
	{
         //wm_announce "Axis have stolen "
      	}

	trigger allies_object_returned
	{
         //wm_announce "Allies have returned " 
	}
	
	trigger checkgameAllies
	{
              trigger game_manager Updatewinner
		accum 1 abort_if_not_equal 5
		wm_objective_status 1 1 1
		wm_objective_status 2 0 2

		wm_announce "^1!^7!^1!^7!^1Allies have collected all the gold"
                wait 2000
		wm_setwinner 1
		wm_endround
	}
	trigger checkgameAxis
	{
              trigger game_manager Updatewinner
		accum 2 abort_if_not_equal 5
		wm_objective_status 1 0 1
		wm_objective_status 2 1 2

		wm_announce "^1!^7!^1!^7!^1Axis have collected all the gold"
                wait 2000
		wm_setwinner 0
		wm_endround
	}

	trigger Updatewinner
	{
                wm_setwinner 1

                accum 1 trigger_if_equal 6 game_manager CheckAxis6
                accum 1 trigger_if_equal 5 game_manager CheckAxis5
                accum 1 trigger_if_equal 4 game_manager CheckAxis4
                accum 1 trigger_if_equal 3 game_manager CheckAxis3
                accum 1 trigger_if_equal 2 game_manager CheckAxis2
                accum 1 trigger_if_equal 1 game_manager CheckAxis1
                accum 1 trigger_if_equal 0 game_manager CheckAxis0
         globalaccum 3 abort_if_not_equal 1
         trigger game_manager CheckBunkerAd
	}

	trigger MakeBunkerAd
	{
 			   wm_announce "^1!^7!^1!^7!^1Timelimit hit!"
	 	   	   wm_announce "^1!^7!^1!^7!^1It's a draw. Get the bunker advantage!"
                           wm_announce "^1!^7!^1!^7!^1Bunkers are now destoyable with all exposive weapons."
			   trigger alliedbunker breaka
			   trigger axisbunker breaka
	}

	trigger CheckBunkerAd
	{
                          globalaccum 4 trigger_if_equal 1 game_manager CheckBunkerAx
                          globalaccum 5 trigger_if_equal 1 game_manager CheckBunkerAl	 
	}
	trigger CheckBunkerAx
	{
         globalaccum 5 abort_if_equal 1
	 wm_announce "^1!^7!^1!^7!^1Allied have the bunker advantage. Allied win."
	 wait 2000
	 wm_setwinner 1
	 wm_endround
	}
	trigger CheckBunkerAl
	{
         globalaccum 4 abort_if_equal 1
	 wm_announce "^1!^7!^1!^7!^1Axis have the bunker advantage. Axis win."
	 wait 2000
	 wm_setwinner 0
	 wm_endround
	}


	trigger CheckAxis6
	{
                          wm_setwinner 1
                          accum 2 abort_if_less_than 6
                          wm_setwinner 0                  
                          accum 2 abort_if_not_equal 6
                          wm_setwinner -1			  
	}
	trigger CheckAxis5
	{
                          wm_setwinner 1
                          accum 2 abort_if_less_than 5
                          wm_setwinner 0
                          accum 2 abort_if_not_equal 5
                          wm_setwinner -1
	}
	trigger CheckAxis4
	{
                          wm_setwinner 1
                          accum 2 abort_if_less_than 4
                          wm_setwinner 0
                          accum 2 abort_if_not_equal 4
                          wm_setwinner -1
	}
	trigger CheckAxis3
	{
                          wm_setwinner 1
                          accum 2 abort_if_less_than 3
                          wm_setwinner 0
                          accum 2 abort_if_not_equal 3
                          wm_setwinner -1
	}
	trigger CheckAxis2
	{
                          wm_setwinner 1
                          accum 2 abort_if_less_than 2
                          wm_setwinner 0
                          accum 2 abort_if_not_equal 2
                          wm_setwinner -1
	}
	trigger CheckAxis1
	{
                          wm_setwinner 1
                          accum 2 abort_if_less_than 1
                          wm_setwinner 0
                          accum 2 abort_if_not_equal 1
                          wm_setwinner -1
	}
	trigger CheckAxis0
	{
                          wm_setwinner 1
                          accum 2 abort_if_less_than 0    //<- does nofing
                          wm_setwinner 0
                          accum 2 abort_if_not_equal 0
                          wm_setwinner -1
	}

}


gotAxisO //The Allies sending the Secret Documents.
{
	spawn
	{
	}

	death
	{
		trigger game_manager gotAxisO
	}
}

gotAlliesO //The Allies sending the Secret Documents.
{
	spawn
	{
	}

	death
	{
		trigger game_manager gotAlliesO
	}
}

alf1 
{
   spawn
   {
      setstate alfcm1 default
   } 
   trigger stolen 
   { 
      setstate alfcm1 invisible 
      //wm_announce "Allied Gold 1 taken"
   } 
   trigger returned 
   { 
      setstate alfcm1 default 
      //wm_announce "Allied Gold 1 returned"
   }
   trigger captured 
   { 
      setstate alfcm1 invisible
      wm_announce "Allied Gold 1 captured"
   }
}

alf2 
{
   spawn
   {
      setstate alfcm2 default
   } 
   trigger stolen 
   { 
      setstate alfcm2 invisible 
      //wm_announce "Allied Gold 2 taken"
   } 
   trigger returned 
   { 
      setstate alfcm2 default 
      //wm_announce "Allied Gold 2 returned"
   }
   trigger captured 
   { 
      setstate alfcm2 invisible
      wm_announce "Allied Gold 2 captured"
   }
}

alf3 
{
   spawn
   {
      setstate alfcm3 default
   } 
   trigger stolen 
   { 
      setstate alfcm3 invisible 
      //wm_announce "Allied Gold 3 taken"
   } 
   trigger returned 
   { 
      setstate alfcm3 default 
      //wm_announce "Allied Gold 3 returned"
   }
   trigger captured 
   { 
      setstate alfcm3 invisible
      wm_announce "Allied Gold 3 captured"
   }
}

alf4 
{
   spawn
   {
      setstate alfcm4 default
   } 
   trigger stolen 
   { 
      setstate alfcm4 invisible 
      //wm_announce "Allied Gold 4 taken"
   } 
   trigger returned 
   { 
      setstate alfcm4 default 
      //wm_announce "Allied Gold 4 returned"
   }
   trigger captured 
   { 
      setstate alfcm4 invisible
      wm_announce "Allied Gold 4 captured"
   }
}

alf5 
{
   spawn
   {
      setstate alfcm5 default
   } 
   trigger stolen 
   { 
      setstate alfcm5 invisible 
      //wm_announce "Allied Gold 5 taken"
   } 
   trigger returned 
   { 
      setstate alfcm5 default 
      //wm_announce "Allied Gold 5 returned"
   }
   trigger captured 
   { 
      setstate alfcm5 invisible
      wm_announce "Allied Gold 5 captured"
   }
}


axf1 
{
   spawn
   {
      setstate axfcm1 default
   } 
   trigger stolen 
   { 
      setstate axfcm1 invisible 
      //wm_announce "Axis Gold 1 taken"
      playsound sound\misc\skill_up.wav
   } 
   trigger returned 
   { 
      setstate axfcm1 default 
      //wm_announce "Axis Gold 1 returned"
   }
   trigger captured 
   { 
      setstate axfcm1 invisible
      wm_announce "Axis Gold 1 captured"
   }
}

axf2 
{
   spawn
   {
   setstate axfcm2 default
   } 
   trigger stolen 
   { 
      setstate axfcm2 invisible 
      //wm_announce "Axis Gold 2 taken"
   } 
   trigger returned 
   { 
      setstate axfcm2 default 
      //wm_announce "Axis Gold 2 returned"
   }
   trigger captured 
   { 
      setstate axfcm2 invisible
      wm_announce "Axis Gold 2 captured"
   }
}

axf3 
{
   spawn
   {
   setstate axfcm3 default
   } 
   trigger stolen 
   { 
      setstate axfcm3 invisible 
      //wm_announce "Axis Gold 3 taken"
   } 
   trigger returned 
   { 
      setstate axfcm3 default 
      //wm_announce "Axis Gold 3 returned"
   }
   trigger captured 
   { 
      setstate axfcm3 invisible
      wm_announce "Axis Gold 3 captured"
   }
}

axf4 
{
   spawn
   {
   setstate axfcm4 default
   } 
   trigger stolen 
   { 
      setstate axfcm4 invisible 
      //wm_announce "Axis Gold 4 taken"
   } 
   trigger returned 
   { 
      setstate axfcm4 default 
      //wm_announce "Axis Gold 4 returned"
   }
   trigger captured 
   { 
      setstate axfcm4 invisible
      wm_announce "Axis Gold 4 captured"
   }
}

axf5 
{
   spawn
   {
   setstate axfcm5 default
   } 
   trigger stolen 
   { 
      setstate axfcm5 invisible 
      //wm_announce "Axis Gold 5 taken"
   } 
   trigger returned 
   { 
      setstate axfcm5 default 
      //wm_announce "Axis Gold 5 returned"
   }
   trigger captured 
   { 
      setstate axfcm5 invisible
      wm_announce "Axis Gold 5 captured"
   }
}


//THE BUNKERS

alliedbunker
{
 	spawn
	{
	 wait 200
	 trigger self setup
	 constructible_class 3
	 constructible_constructxpbonus 9
	 constructible_destructxpbonus 15
	 constructible_chargebarreq 1.7
	}
	trigger setup
	{
	 setstate alliedbunker invisible
	 setstate alliedbuild default
	 setstate albksh invisible

	 setstate cabinet_health_model invisible          
	 setstate alliedhealthtrigger invisible
	 setstate cabinet_ammo_model invisible          
	 setstate alliedammotrigger invisible

      setchargetimefactor 1 soldier 1.0 
      setchargetimefactor 1 lieutenant 1.0 
      setchargetimefactor 1 medic 1.0 
      setchargetimefactor 1 engineer 1.0 
      setchargetimefactor 1 covertops 1.0 
      sethqstatus 1 0
      wm_allied_respawntime 10
	}
trigger breaka
{
constructible_class 1
constructible_health 4500
constructible_chargebarreq 1.3
wm_teamvoiceannounce 1 "df_allies_needs"
wm_teamvoiceannounce 1 "df_allies_needf"
wm_teamvoiceannounce 1 "df_allies_dstypo"
wm_addteamvoiceannounce 1 "df_allies_needs"
wm_addteamvoiceannounce 1 "df_allies_needf"
wm_addteamvoiceannounce 1 "df_allies_dstypo"
wm_removeteamvoiceannounce 1 "df_allies_get_gold"
}
	buildstart final
	{
	 setstate alliedbunker underconstruction
	 //setstate alliedbuild default
	}
	built final
	{
	 setstate alliedbunker default
	 setstate alliedbuild invisible
	 setstate albksh default

	 setstate cabinet_health_model default
	 setstate alliedhealthtrigger default
	 setstate cabinet_ammo_model default
	 setstate alliedammotrigger default

      	 setchargetimefactor 1 soldier 0.5 
      	 setchargetimefactor 1 lieutenant 0.5 
      	 setchargetimefactor 1 medic 0.5 
      	 setchargetimefactor 1 engineer 0.5 
      	 setchargetimefactor 1 covertops 0.5 
	 sethqstatus 1 1
	 wm_allied_respawntime 5

	 wm_removeteamvoiceannounce 1 "df_allies_const_bunk"
         wm_announce "^1!^7!^1!^7!^1Allied bunker constructed"
	 globalaccum 4 set 1
	 trigger game_manager Updatewinner
	}
	decayed final
	{
	 setstate alliedbunker invisible
	 //setstate alliedbuild default
	}
	death
	{
	 setstate alliedbunker invisible
	 setstate alliedbuild default
	 setstate albksh invisible

	 setstate cabinet_health_model invisible          
	 setstate alliedhealthtrigger invisible
	 setstate cabinet_ammo_model invisible          
	 setstate alliedammotrigger invisible

      	 setchargetimefactor 1 soldier 1.0 
      	 setchargetimefactor 1 lieutenant 1.0 
      	 setchargetimefactor 1 medic 1.0 
      	 setchargetimefactor 1 engineer 1.0 
      	 setchargetimefactor 1 covertops 1.0 
	 wm_allied_respawntime 10
	 sethqstatus 1 0

	 wm_addteamvoiceannounce 1 "df_allies_const_bunk"
	 wm_teamvoiceannounce 1 "df_allies_const_bunk"
         wm_announce "^1!^7!^1!^7!^1Allied bunker destroyed"
	 globalaccum 4 set 0
	 trigger game_manager Updatewinner
	}

}

axisbunker
{
 	spawn
	{
	 wait 200
	 trigger self setup
	 constructible_class 3
	 constructible_constructxpbonus 9
	 constructible_destructxpbonus 15
	 constructible_chargebarreq 1.7
	}
	trigger setup
	{
	 setstate axisbunker invisible
	 setstate axisbuild default
	 setstate axbksh invisible

	 setstate xcabinet_health_model invisible          
	 setstate axishealthtrigger invisible
	 setstate xcabinet_ammo_model invisible          
	 setstate axisammotrigger invisible

      setchargetimefactor 0 soldier 1.0 
      setchargetimefactor 0 lieutenant 1.0 
      setchargetimefactor 0 medic 1.0 
      setchargetimefactor 0 engineer 1.0 
      setchargetimefactor 0 covertops 1.0 
      sethqstatus 0 0
      wm_axis_respawntime 10
	}
trigger breaka
{
constructible_class 1
constructible_health 4500
constructible_chargebarreq 1.3
wm_teamvoiceannounce 0 "df_axis_needs"
wm_teamvoiceannounce 0 "df_axis_needf"
wm_teamvoiceannounce 0 "df_axis_dstypo"
wm_addteamvoiceannounce 0 "df_axis_needs"
wm_addteamvoiceannounce 0 "df_axis_needf"
wm_addteamvoiceannounce 0 "df_axis_dstypo"
wm_removeteamvoiceannounce 0 "df_axis_get_gold"
}
	buildstart final
	{
	 setstate axisbunker underconstruction
	// setstate axisbuild default
	}
	built final
	{
	 setstate axisbunker default
	 setstate axisbuild invisible
	 setstate axbksh default

	 setstate xcabinet_health_model default
	 setstate axishealthtrigger default
	 setstate xcabinet_ammo_model default
	 setstate axisammotrigger default

      	 setchargetimefactor 0 soldier 0.5
      	 setchargetimefactor 0 lieutenant 0.5
      	 setchargetimefactor 0 medic 0.5
      	 setchargetimefactor 0 engineer 0.5
      	 setchargetimefactor 0 covertops 0.5
      	 sethqstatus 0 1
	 wm_axis_respawntime 5

	 wm_removeteamvoiceannounce 0 "df_axis_const_bunk"
         wm_announce "^1!^7!^1!^7!^1Axis bunker constructed"
	 globalaccum 5 set 1
	 trigger game_manager Updatewinner
	}
	decayed final
	{
	 setstate axisbunker invisible
	 //setstate axisbuild default

	 setstate xcabinet_health_model invisible          
	 setstate axishealthtrigger invisible
	 setstate xcabinet_ammo_model invisible          
	 setstate axisammotrigger invisible
	}
	death
	{
	 setstate axisbunker invisible
	 setstate axisbuild default
	 setstate axbksh invisible

	 setstate xcabinet_health_model invisible          
	 setstate axishealthtrigger invisible
	 setstate xcabinet_ammo_model invisible          
	 setstate axisammotrigger invisible

      	 setchargetimefactor 0 soldier 1.0 
      	 setchargetimefactor 0 lieutenant 1.0 
      	 setchargetimefactor 0 medic 1.0 
      	 setchargetimefactor 0 engineer 1.0 
      	 setchargetimefactor 0 covertops 1.0 
         sethqstatus 0 0
	 wm_axis_respawntime 10

	 wm_addteamvoiceannounce 0 "df_axis_const_bunk"
	 wm_teamvoiceannounce 0 "df_axis_const_bunk"
         wm_announce "^1!^7!^1!^7!^1Axis bunker destroyed"
	 globalaccum 5 set 0
	 trigger game_manager Updatewinner
	}

}

albksh
{
 	spawn
	{
	}
}

axbksh
{
 	spawn
	{
	}
}


timeuptrigger
{
	trigger timeup
	{
	        wait 1800000
                globalaccum 3 set 1
		trigger game_manager CheckBunkerAd
	 	wait 1000
		trigger game_manager MakeBunkerAd
	}
}


//mg s

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

   trigger startup 
   { 
      setstate all_mg invisible 
      setstate alliedmgbld default 
	setstate allmg_shdw invisible
   } 

   buildstart final 
   { 
      setstate all_mg underconstruction
   } 

   built final 
   { 
      setstate all_mg default 
      setstate alliedmgbld invisible 
	setstate allmg_shdw default 
      wm_announce   "^1!^7!^1!^7!^1Allied mg built!" 
   } 

   decayed final 
   { 
      trigger self startup 
   } 

   death 
   { 
      trigger self startup 
      wm_announce   "^1!^7!^1!^7!^1Allied mg destroyed!" 
   } 

} 

allmg_shdw 
{
   spawn
	{
	}
}

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

   trigger startup 
   { 
      setstate ax_mg invisible 
      setstate axismgbld default 
	setstate axmg_shdw invisible
   } 

   buildstart final 
   { 
      setstate ax_mg underconstruction
   } 

   built final 
   { 
      setstate ax_mg default 
      setstate axismgbld invisible 
	setstate axmg_shdw default 
      wm_announce   "^1!^7!^1!^7!^1Axis mg built!" 
   } 

   decayed final 
   { 
      trigger self startup 
   } 

   death 
   { 
      trigger self startup 
      wm_announce   "^1!^7!^1!^7!^1Axis mg destroyed!" 
   } 

} 

axmg_shdw 
{
   spawn
	{
	}
}