//Script made by -SSF-Sage and pegazus
//Have fun! Contact me with E-mail at ssf.sage at gmail dot com
//Last edited on 6. December 2014 by Sage
//     LLL          oooo      LLL
//     LLL        oo    oo    LLL 
//     LLL       oo      oo   LLL 
//     LLL       oo	 oo   LLL        ftw!
//     LLL		oo    oo    LLL
//     LLLLLLLL     oooo      LLLLLLLL
//
//Globalaccum usage:
//0:
//bit 0 = barrier 1 state
//bit 1 = barrier 2 state
//
//1:	radio counter state
//2:	radio counter time
//6:  send signal announce
//7:  steal blueprint announce
//8:  command house doors state
game_manager 
{
	spawn
	{
		wait 10 
		trigger self tank_remap_shader

		trigger tank_turret trigger turn


		wait 50
		wm_axis_respawntime 20	// Axis respawn time 20
		wm_allied_respawntime 10 	// Allied respawn time 15
		wm_set_round_timelimit 15	// Map timelimit
		wm_number_of_objectives 6       // Map objectives
		
		// 1: First Barrier
		// 2: Second Barrier
		// 3: Transmit the message
		// 4: Steal the Blueprints
		// 5: Escape with blueprints
		// 6: Allied command post

		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

		// Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team 0
		
		// Winner on expiration of round timer (0=Axis, 1=Allies)
		wm_setwinner 0

  		setautospawn "First allied spawn" 1
		setautospawn "Axis City Spawn" 0

		setstate axis_road_spawns_wobj default
		setstate axis_cave_spawns_wobj default
		setstate axis_city_spawns_wobj default
		setstate axis_garage_spawns_wobj default
		setstate axis_hangar_spawns_wobj default
	
		setstate allied_cp_spawns_wobj invisible
		setstate allied_cparea_spawns_wobj invisible
		setstate allied_road_spawns_wobj invisible
		setstate allied_city_spawns_wobj invisible


		setstate axis_city_spawns default
		setstate axis_cave_spawns default
		setstate axis_road_spawns default
		setstate axis_garage_spawns default
		setstate axis_hangar_spawns default


		setstate allied_cp_spawns invisible
		setstate allied_cave_spawns invisible		
		setstate allied_road_spawns invisible
		setstate allied_city_spawns invisible
		setstate allied_cparea_spawns invisible

		setstate fw_190_toi invisible
		setstate bf_109_toi invisible
		
		globalaccum 5 set 0
		globalaccum 6 set 0
		globalaccum 7 set 0
		globalaccum 8 set 0

		accum 0 set 0		//documents are not captured
		accum 1 set 0		//plane is not destroyed

		wait 2000

		wm_addteamvoiceannounce 0 "c_ax_tankbar_construct"
		wm_teamvoiceannounce 0 "c_ax_tankbar_construct"

		wm_addteamvoiceannounce 1 "c_al_tankbar_destroy"
		wm_teamvoiceannounce 1 "c_al_tankbar_destroy"
	}

	trigger passed_barrier_1
	{
		setstate allied_city_spawns default
		setstate allied_city_spawns_wobj default

		setstate axis_city_spawns invisible
		setstate axis_city_spawns_wobj invisible
		
		setautospawn "Allied city spawn" 1
		setautospawn "Axis Road spawn" 0

		wm_axis_respawntime 15

 		wm_announce "Allied team passed the Tank Barrier #1 and has taken over the city!"  

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

		wm_teamvoiceannounce 0 "c_ax_tank_barrier1"
		wm_teamvoiceannounce 1 "c_al_tank_barrier1"

		// *---------------------------------------------------------------------------------*
	}
	
	trigger passed_barrier_2
	{
		setstate allied_road_spawns default
		setstate allied_road_spawns_wobj default

		setstate axis_road_spawns invisible	
		setstate axis_road_spawns_wobj invisible
		
		setautospawn "Command Post spawn" 1
		setautospawn "Axis Cave spawn" 0

 		wm_announce "Allied team passed the Tank Barrier #2!"

		//*--------------------vo----------------------------------
		wm_removeteamvoiceannounce 1 "c_al_tankbar_destroy"
		wm_removeteamvoiceannounce 0 "c_ax_tankbar_construct"

		wm_teamvoiceannounce 0 "c_ax_tank_barrier2"

		wm_teamvoiceannounce 1 "c_al_tank_barrier2"

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

		//In case it will never be built
		wm_objective_status 2 0 2 
		wm_objective_status 2 1 1

		wm_announce	"^1Time Extended: ^w+15 mins"
		wm_set_round_timelimit	30
	}

	trigger close_to_airport
	{
		wm_announce "Allied team is approaching the Airport!"
		
		//the Axis Forces are cornered...muaha.. They can't spawn at caves anymore

		setstate axis_cave_spawns_wobj invisible
		setstate axis_cave_spawns invisible

		setautospawn "Axis Garage Spawn" 0

		setstate allied_cparea_spawns_wobj default
		setstate allied_cparea_spawns default

		setstate allied_cp_toi default

		setstate cp_multiple invisible
		
		setstate fw_190_toi default
		setstate bf_109_toi default

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

		wm_teamvoiceannounce 1 "allies_hq_compost_construct"
		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"
	
		//*--------------------------------------------------------
	}

	trigger woodenbar_explosion
	{
		wait 150
		alertentity woodenbar
	}

	trigger tank_remap_shader
	{
		//I used the snow churchhill because the oasis one is buggy, so we need to remap it.. mmh..
		//I want to have as little wait as possible, so players would not notice it
		//I also fixed the body model...

		remapshader models/mapobjects/tanks_sd/churchill_flat models/mapobjects/tanks_sd/churchill_flat_oasis_fix
		remapshader models/mapobjects/tanks_sd/mg42turret models/mapobjects/tanks_sd/mg42turret_oasis

		remapshaderflush
	}

	trigger documents_captured
	{

		accum 0 set 1

		trigger self plane_check
	}

	trigger plane_feeling_good
	{

		accum 1 set 0

		trigger self plane_check

	}

	trigger plane_feeling_bad
	{	

		accum 1 set 1

	}

	trigger plane_check
	{
	
		accum 0 abort_if_not_equal 1		//check that the documents are captured

		accum 1 abort_if_not_equal 0		//check that the plane is fine

		trigger plane_constructible remove
		trigger plane_propella rotate_fly_away	//plane will fly now ;)

	}

	trigger radio_counter
	{
		globalaccum 1 abort_if_not_equal 1		//check that the counter is enabled

		wait 1000

		globalaccum 1 abort_if_not_equal 1		//check that the counter is enabled

		globalaccum 2 inc 1				//add 1 second to the counter

		trigger radio_light pulse		//Pulse the trasmitting lights
		trigger radio_counter check_time
		trigger self radio_counter				//loop this trigger..
	}

	//-----------------------------------------------------------------------------
	//--------------------------------plane sounds --------------------------------
	//-----------------------------------------------------------------------------

	trigger plane_far_in
	{
		enablespeaker plane_far_in

		wait 10400
		
		trigger plane sound_near

		wait 8300

		trigger plane sound_end_slow
	}

	trigger plane_far_out
	{
		wait 8000

		enablespeaker plane_far_out

		wait 1600

		trigger plane stop_sound
	}
}


// *************************************************
// **************** CONSTRUCTIBLES *****************
// *************************************************
// Script for the Tank Barriers

barrier1
{
	spawn
	{
		wait 400
		trigger barrier1 setup

		constructible_class 3
		constructible_chargebarreq 1.25
		//inform the tank that the barrier is built
		globalaccum 0 bitset 0
	}

	trigger setup
	{
		setstate barrier1_materials invisible
		setstate barrier1_materials_clip invisible
		setstate barrier1_flag invisible

		setstate barrier1_woodslats default
	}

	buildstart final
	{
		setstate barrier1_materials default
		setstate barrier1_materials_clip default
		setstate barrier1_flag default

		setstate barrier1_woodslats underconstruction
	}

	built final
	{
		setstate barrier1_materials invisible
		setstate barrier1_materials_clip invisible
		setstate barrier1_flag invisible

		setstate barrier1_woodslats default

		//inform the tank that the barrier is built
		globalaccum 0 bitset 0


		wm_announce "Tank Barrier #1 has been constructed."

		//*----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "c_ax_tankbar_constructed"

		wm_removeteamvoiceannounce 0 "c_ax_tankbar_construct"

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


		wm_objective_status 1 1 2 
		wm_objective_status 1 0 1


	}

	decayed final
	{
		setstate barrier1_materials default
		setstate barrier1_materials_clip default
		setstate barrier1_flag default

		setstate barrier1_woodslats invisible
	}

	death
	{
		setstate barrier1_materials default
		setstate barrier1_materials_clip default
		setstate barrier1_flag default

		alertentity barrier1_woodslats_blow
		setstate barrier1_woodslats invisible

		//inform the tank that the barrier is not built
		globalaccum 0 bitreset 0

		wm_announce "Tank Barrier #1 has been destroyed."

		//*----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "c_ax_tankbar_construct"

		wm_teamvoiceannounce 0 "c_ax_tankbar_destroyed"

		wm_teamvoiceannounce 1 "c_al_tankbar_destroyed"
		//*---------------------------------------------------------------------------------*

		wm_objective_status 1 0 2 
		wm_objective_status 1 1 1
	
	}

	trigger remove
	{
		setstate barrier1_toi invisible
		setstate barrier1_materials invisible
		setstate barrier1_materials_clip invisible
		setstate barrier1_flag invisible

		setstate barrier1_woodslats invisible

		remove
	}

}

//*****************************************************
//*****************************************************


barrier2
{
	spawn
	{
		wait 100
		trigger barrier2 setup

		constructible_class 3
		constructible_chargebarreq 1.25

		//inform the tank that the barrier is not built
		globalaccum 0 bitreset 1
	}

	trigger setup
	{
		setstate barrier2_materials default
		setstate barrier2_materials_clip default
		setstate barrier2_flag default

	}

	buildstart final
	{
		setstate barrier2_materials default
		setstate barrier2_materials_clip default
		setstate barrier2_flag default

	}

	built final
	{
		setstate barrier2_materials invisible
		setstate barrier2_materials_clip invisible
		setstate barrier2_flag invisible

		//inform the tank that the barrier is built
		globalaccum 0 bitset 1

		wm_announce "Tank Barrier #2 has been constructed."

		//*----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "c_ax_tankbar_constructed"

		wm_removeteamvoiceannounce 0 "c_ax_tankbar_construct"

		//*----------------------------------- vo ------------------------------------------*
		wm_objective_status 2 1 2 
		wm_objective_status 2 0 1

	}

	decayed final
	{
		setstate barrier2_materials default
		setstate barrier2_materials_clip default
		setstate barrier2_flag default
	}

	death
	{
		setstate barrier2_materials default
		setstate barrier2_materials_clip default
		setstate barrier2_flag default

		//inform the tank that the barrier is not built
		globalaccum 0 bitreset 1


		wm_announce "Tank Barrier #2 has been destroyed."

		//*----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "c_ax_tankbar_construct"

		wm_teamvoiceannounce 0 "c_ax_tankbar_destroyed"

		wm_teamvoiceannounce 1 "c_al_tankbar_destroyed"
		//*---------------------------------------------------------------------------------*
		wm_objective_status 2 0 2 
		wm_objective_status 2 1 1

	}

	trigger remove
	{
		setstate barrier2_toi invisible
		setstate barrier2_materials invisible
		setstate barrier2_materials_clip invisible
		setstate barrier2_flag invisible

		remove
	}

}

// *********************************************
// **************** COMMAND POST ***************
// *********************************************

allied_cp_open
{
	spawn
	{
		wait 100
		accum 0 set 0			// 0=CP Closed, 1=CP Damaged
		constructible_class 2			// Dyno+Satchel

		trigger self disable_cp_features		// Default charge bar times
		setstate allied_cp_damaged invisible
		setstate allied_cp_damaged_model invisible

		setstate allied_cp_toi invisible

		setstate cp_multiple default


	}

	trigger disable_cp_features
	{
		setstate allied_cp_open_model invisible

		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1

		sethqstatus 1 0			// Landmines team warning message
		disablespeaker allies_compost_sound		// Disable morse code sound

		wm_objective_status 6 0 0
		wm_objective_status 6 1 0
		
		setstate allied_cp_spawns invisible
		setstate allied_cp_spawns_wobj invisible

		setstate allied_cave_spawns invisible
		setstate allied_cave_spawns_wobj invisible

		setstate axis_garage_spawns_wobj default
		setstate axis_hangar_spawns_wobj default

		setstate axis_garage_spawns default
		setstate axis_hangar_spawns default
	}

	trigger enable_cp_features
	{
		setstate allied_cp_open_model default

		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			// Landmines team warning message
		enablespeaker allies_compost_sound		// Enable morse code sound

		wm_objective_status 6 0 2
		wm_objective_status 6 1 1

		setstate allied_cp_spawns default
		setstate allied_cp_spawns_wobj default

		setstate allied_cave_spawns default
		setstate allied_cave_spawns_wobj default

		setstate axis_garage_spawns_wobj invisible
		setstate axis_hangar_spawns_wobj invisible

		setstate axis_garage_spawns invisible
		setstate axis_hangar_spawns invisible
	}

	buildstart final
	{
		setstate allied_cp_closed invisible
		setstate allied_cp_closed_model invisible
		setstate allied_cp_damaged invisible
		setstate allied_cp_damaged_model invisible
	}

	built final
	{
		accum 0 set 1			// Show only the damaged CP model
		trigger self enable_cp_features		// Increase charge bar times

		wm_announce "Allied Command Post constructed. Charge speed increased! Spawning changed!"
		wm_announce "Allied Cave spawn enabled!"
		// *----------------------------------- vo ------------------------------------------*
		wm_removeteamvoiceannounce 1 "allies_hq_compost_construct"
		wm_teamvoiceannounce 1 "allies_hq_compost_constructed"

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

	decayed final
	{
		setstate allied_cp_open_model invisible
		trigger self show_damaged_cabinet	// Show previous cabinet state
		trigger self show_closed_cabinet
	}

	death
	{
		trigger self show_damaged_cabinet	// Show damaged CP model
		trigger self disable_cp_features		// Default charge bar times

		wm_announce "Axis team has destroyed the Allied Command Post! Spawning changed!"
		
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "allies_hq_compost_damaged"
		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_removeteamvoiceannounce 0 "axis_hq_compost_constructed_allies"
		// *----------------------------------- vo ------------------------------------------*
	}

	trigger show_closed_cabinet
	{
		accum 0 abort_if_equal 1		// Closed cabinet active yet?
		setstate allied_cp_closed default
		setstate allied_cp_closed_model default
	}

	trigger show_damaged_cabinet
	{
		accum 0 abort_if_equal 0		// Damaged cabinet active yet?
		setstate allied_cp_damaged default
		setstate allied_cp_damaged_model default
	}
}

// *************************************************
// ********* GATE & Objective announces  ***********
// *************************************************
//Gate + I also borrow the scriptblock for announces
//because dummy scriptblock gives error
//and I don't want to recompile the map now

gate_right
{
	spawn
	{
	}
	trigger gate_flip
	{
		wait 650
		faceangles 0 -2 270 650
	}

	trigger signal_run
	{
		globalaccum 6 set 1
		wait 3000
		trigger self signal_counter
	}

	trigger signal_counter
	{
		globalaccum 6 abort_if_not_equal 1

		wm_announce "Allied team must send a landing signal for the pilot!"

		//trigger self every 3 minutes

		wait 180000

		trigger self signal_counter
	}
}

gate_left
{
	spawn
	{
	}
	trigger gate_flip
	{
		wait 500
		
		playsound sound/world/metalbreak.wav

		wait 100
		faceangles 0 1 270 600
	}
	
	trigger blueprint_run
	{
		globalaccum 6 set 0

		globalaccum 7 set 1
		wait 3000
		trigger self blueprint_counter
	}

	trigger blueprint_counter
	{
		globalaccum 7 abort_if_not_equal 1

		wm_announce "Allied team must steal the Blueprints and secure them into the Seafire!"

		//trigger self every 3 minutes

		wait 180000

		trigger self blueprint_counter
	}
}

// *************************************************
// ***************** TANK STUFF ********************
// *************************************************

tank
{
// accum 0, track state
// accum 1
//  - bit 0: barrier1 state		( 0 = not built,	1 = built		)
//  - bit 1: barrier2 state		( 0 = not built,	1 = built		)
//  - bit 2: spline status 		( 0 = not moving, 	1 = moving 		)
//  - bit 3: stuck check flag 	( 0 = not stuck, 	1 = stuck 		)
//  - bit 4: flag for message	( 0 = dont display, 1= display		)
//  - bit 5: blank
//  - bit 6: temp register 		(XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)
//  - bit 7: death status 		( 0 = alive, 		1 = dead		)
//  - bit 8: player check 		( 0 = players, 		1 = no players	)
//  - bit 9: visible state		( 0 = alive, 		1 = dead		)
// accum 2, blank
// accum 3, current movement loop position
// accum 4, stop counter
// accum 5, lockout ref counter
// accum 6, blank
// accum 7, blank
	spawn
	{
		wait 50
		followspline 0 tank_spln_0 50000 length 128 wait
		followspline 1 tank_spln_0 50000 length 128 wait
				
		accum 0 set 666
		accum 3 set 0

		trigger tank sound_idle
		trigger tank tracks_stop

//MAGICAL TEST COMMAND HOUSE TRIGGER:
//		wait 100
//		accum 3 set 153
	}

	death
	{
		accum 1 bitset 7
	}

	rebirth
	{
		accum 1 bitreset 9 // we're visibly alive
		accum 1 bitreset 7 // we're alive again

		trigger self script_lockout

		changemodel models/mapobjects/tanks_sd/churchhill_fixed.md3

		setstate tank_smoke invisible

		wm_teamvoiceannounce 0 "axis_hq_tank_repaired_allies"
		wm_teamvoiceannounce 1 "allies_hq_tank_repaired"

		trigger tank_sound rebirth
		wait 500

		trigger self script_lockout_stop
	}

	trigger deathcheck
	{
		accum 1 abort_if_not_bitset 7	// abort if tank not damaged
		accum 1 abort_if_bitset 9	// abort if tank already visibly dead
		accum 1 abort_if_bitset 2	// abort if we are following a spline
		accum 5 abort_if_not_equal 0	// abort if we are in a script lockout

		accum 1 bitset 9				// we're now visibly dead

		trigger self deathcheck_message
		accum 1 bitset 4

		changemodel models/mapobjects/tanks_sd/churchhill_broken_fixed.md3

		setstate tank_smoke default

		kill tank_construct

		trigger self sound_death
		trigger self tracks_stop

		trigger self script_lockout

		trigger self tracks_stop
		startanimation 45 10 15 nolerp norandom
		wait 666
		startanimation 0 1 15 nolerp norandom

		trigger self script_lockout_stop

		resetscript
	}

	trigger deathcheck_message
	{
		accum 1 abort_if_not_bitset 4

		wm_announce "The tank has been damaged!"

		wm_teamvoiceannounce 0 "axis_hq_tank_damaged"
		wm_teamvoiceannounce 1 "allies_hq_tank_damaged_axis"
	}

	// ========================
	// movement

	trigger dispatch
	{
		accum 3 trigger_if_equal 0 tank run_0
		accum 3 trigger_if_equal 1 tank run_1
		accum 3 trigger_if_equal 2 tank run_2
		accum 3 trigger_if_equal 3 tank run_3
		accum 3 trigger_if_equal 4 tank run_4
		accum 3 trigger_if_equal 5 tank run_5
		accum 3 trigger_if_equal 6 tank run_6
		accum 3 trigger_if_equal 7 tank run_7
		accum 3 trigger_if_equal 8 tank run_8
		accum 3 trigger_if_equal 9 tank run_9
		accum 3 trigger_if_equal 10 tank run_10
		accum 3 trigger_if_equal 11 tank run_11
		accum 3 trigger_if_equal 12 tank run_12
		accum 3 trigger_if_equal 13 tank run_13
		accum 3 trigger_if_equal 14 tank run_14
		accum 3 trigger_if_equal 15 tank run_15
		accum 3 trigger_if_equal 16 tank run_16
		accum 3 trigger_if_equal 17 tank run_17
		accum 3 trigger_if_equal 18 tank run_18
		accum 3 trigger_if_equal 19 tank run_19
		accum 3 trigger_if_equal 20 tank run_20
		accum 3 trigger_if_equal 21 tank run_21
		accum 3 trigger_if_equal 22 tank run_22
		accum 3 trigger_if_equal 23 tank run_23
		accum 3 trigger_if_equal 24 tank run_24
		accum 3 trigger_if_equal 25 tank run_25
		accum 3 trigger_if_equal 26 tank run_26
		accum 3 trigger_if_equal 27 tank run_27
		accum 3 trigger_if_equal 28 tank run_28
		accum 3 trigger_if_equal 29 tank run_29
		accum 3 trigger_if_equal 30 tank run_30
		accum 3 trigger_if_equal 31 tank run_31
		accum 3 trigger_if_equal 32 tank run_32
		accum 3 trigger_if_equal 33 tank run_33
		accum 3 trigger_if_equal 34 tank run_34
		accum 3 trigger_if_equal 35 tank run_35
		accum 3 trigger_if_equal 36 tank run_36
		accum 3 trigger_if_equal 37 tank run_37
		accum 3 trigger_if_equal 38 tank run_38
		accum 3 trigger_if_equal 39 tank run_39
		accum 3 trigger_if_equal 40 tank run_40
		accum 3 trigger_if_equal 41 tank run_41
		accum 3 trigger_if_equal 42 tank run_42
		accum 3 trigger_if_equal 43 tank run_43
		accum 3 trigger_if_equal 44 tank run_44
		accum 3 trigger_if_equal 45 tank run_45
		accum 3 trigger_if_equal 46 tank run_46
		accum 3 trigger_if_equal 47 tank run_47
		accum 3 trigger_if_equal 48 tank run_48
		accum 3 trigger_if_equal 49 tank run_49
		accum 3 trigger_if_equal 50 tank run_50
		accum 3 trigger_if_equal 51 tank run_51
		accum 3 trigger_if_equal 52 tank run_52
		accum 3 trigger_if_equal 53 tank run_53
		accum 3 trigger_if_equal 54 tank run_54
		accum 3 trigger_if_equal 55 tank run_55
		accum 3 trigger_if_equal 56 tank run_56
		accum 3 trigger_if_equal 57 tank run_57
		accum 3 trigger_if_equal 58 tank run_58
		accum 3 trigger_if_equal 59 tank run_59
		accum 3 trigger_if_equal 60 tank run_60
		accum 3 trigger_if_equal 61 tank run_61
		accum 3 trigger_if_equal 62 tank run_62
		accum 3 trigger_if_equal 63 tank run_63
		accum 3 trigger_if_equal 64 tank run_64
		accum 3 trigger_if_equal 65 tank run_65
		accum 3 trigger_if_equal 66 tank run_66	
		accum 3 trigger_if_equal 67 tank run_67
		accum 3 trigger_if_equal 68 tank run_68
		accum 3 trigger_if_equal 69 tank run_69
		accum 3 trigger_if_equal 70 tank run_70
		accum 3 trigger_if_equal 71 tank run_71
		accum 3 trigger_if_equal 72 tank run_72
		accum 3 trigger_if_equal 73 tank run_73
		accum 3 trigger_if_equal 74 tank run_74
		accum 3 trigger_if_equal 75 tank run_75
		accum 3 trigger_if_equal 76 tank run_76
		accum 3 trigger_if_equal 77 tank run_77
		accum 3 trigger_if_equal 78 tank run_78
		accum 3 trigger_if_equal 79 tank run_79
		accum 3 trigger_if_equal 80 tank run_80
		accum 3 trigger_if_equal 81 tank run_81
		accum 3 trigger_if_equal 82 tank run_82
		accum 3 trigger_if_equal 83 tank run_83
		accum 3 trigger_if_equal 84 tank run_84
		accum 3 trigger_if_equal 85 tank run_85
		accum 3 trigger_if_equal 86 tank run_86
		accum 3 trigger_if_equal 87 tank run_87
		accum 3 trigger_if_equal 88 tank run_88
		accum 3 trigger_if_equal 89 tank run_89
		accum 3 trigger_if_equal 90 tank run_90
		accum 3 trigger_if_equal 91 tank run_91
		accum 3 trigger_if_equal 92 tank run_92
		accum 3 trigger_if_equal 93 tank run_93
		accum 3 trigger_if_equal 94 tank run_94
		accum 3 trigger_if_equal 95 tank run_95
		accum 3 trigger_if_equal 96 tank run_96
		accum 3 trigger_if_equal 97 tank run_97
		accum 3 trigger_if_equal 98 tank run_98
		accum 3 trigger_if_equal 99 tank run_99
		accum 3 trigger_if_equal 100 tank run_100
		accum 3 trigger_if_equal 101 tank run_101
		accum 3 trigger_if_equal 102 tank run_102
		accum 3 trigger_if_equal 103 tank run_103
		accum 3 trigger_if_equal 104 tank run_104
		accum 3 trigger_if_equal 105 tank run_105
		accum 3 trigger_if_equal 106 tank run_106
		accum 3 trigger_if_equal 107 tank run_107
		accum 3 trigger_if_equal 108 tank run_108
		accum 3 trigger_if_equal 109 tank run_109
		accum 3 trigger_if_equal 110 tank run_110
		accum 3 trigger_if_equal 111 tank run_111
		accum 3 trigger_if_equal 112 tank run_112
		accum 3 trigger_if_equal 113 tank run_113
		accum 3 trigger_if_equal 114 tank run_114
		accum 3 trigger_if_equal 115 tank run_115
		accum 3 trigger_if_equal 116 tank run_116
		accum 3 trigger_if_equal 117 tank run_117
		accum 3 trigger_if_equal 118 tank run_118
		accum 3 trigger_if_equal 119 tank run_119
		accum 3 trigger_if_equal 120 tank run_120
		accum 3 trigger_if_equal 121 tank run_121
		accum 3 trigger_if_equal 122 tank run_122
		accum 3 trigger_if_equal 123 tank run_123
		accum 3 trigger_if_equal 124 tank run_124
		accum 3 trigger_if_equal 125 tank run_125
		accum 3 trigger_if_equal 126 tank run_126
		accum 3 trigger_if_equal 127 tank run_127
		accum 3 trigger_if_equal 128 tank run_128
		accum 3 trigger_if_equal 129 tank run_129
		accum 3 trigger_if_equal 130 tank run_130
		accum 3 trigger_if_equal 131 tank run_131
		accum 3 trigger_if_equal 132 tank run_132
		accum 3 trigger_if_equal 133 tank run_133
		accum 3 trigger_if_equal 134 tank run_134
		accum 3 trigger_if_equal 135 tank run_135
		accum 3 trigger_if_equal 136 tank run_136
		accum 3 trigger_if_equal 137 tank run_137
		accum 3 trigger_if_equal 138 tank run_138
		accum 3 trigger_if_equal 139 tank run_139
		accum 3 trigger_if_equal 140 tank run_140
		accum 3 trigger_if_equal 141 tank run_141
		accum 3 trigger_if_equal 142 tank run_142
		accum 3 trigger_if_equal 143 tank run_143
		accum 3 trigger_if_equal 144 tank run_144
		accum 3 trigger_if_equal 145 tank run_145
		accum 3 trigger_if_equal 146 tank run_146
		accum 3 trigger_if_equal 147 tank run_147
		accum 3 trigger_if_equal 148 tank run_148
		accum 3 trigger_if_equal 149 tank run_149
		accum 3 trigger_if_equal 150 tank run_150
		accum 3 trigger_if_equal 151 tank run_151
		accum 3 trigger_if_equal 152 tank run_152
		accum 3 trigger_if_equal 153 tank run_end

		
	}

	trigger move
	{
		trigger self move_check
		wait 500
		trigger self move
	}

	trigger move_check
	{
		trigger self stuck_check
		accum 1 abort_if_bitset 3

		trigger self dispatch
	}

	trigger run_continue
	{
		accum 3 inc 1

		trigger self deathcheck
		trigger self stopcheck
		trigger self move
	}

	trigger run_0
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_0

		followspline 0 tank_spln_0 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_1
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_1

		followspline 0 tank_spln_1 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_2
	{
		trigger self tracks_turn_left
		accum 1 bitset 2

		trigger tank_turret_clip run_2

		followspline 0 tank_spln_2 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_3
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_3

		followspline 0 tank_spln_3 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_4
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_4

		followspline 0 tank_spln_4 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_5
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_5

		followspline 0 tank_spln_5 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_6
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_6

		followspline 0 tank_spln_6 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_7
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_7

		followspline 0 tank_spln_7 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_8
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_8

		followspline 0 tank_spln_8 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_9
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_9

		followspline 0 tank_spln_9 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_10
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_10

		followspline 0 tank_spln_10 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_11
	{
		trigger self tracks_turn_right
		accum 1 bitset 2

		trigger tank_turret_clip run_11

		followspline 0 tank_spln_11 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_12
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_12

		followspline 0 tank_spln_12 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_13
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_13

		followspline 0 tank_spln_13 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_14
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_14

		followspline 0 tank_spln_14 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_15
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_15

		followspline 0 tank_spln_15 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// The boys are back in town (the boys are back in town) !
	//-----------------------------------------------------------------------

	trigger run_16
	{		

		trigger gate_left gate_flip
		trigger gate_right gate_flip

		wm_announce "Allied team has entered the City"
		
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_16

		followspline 0 tank_spln_16 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_17
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_17

		followspline 0 tank_spln_17 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_18
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_18

		followspline 0 tank_spln_18 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_19
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_19

		followspline 0 tank_spln_19 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_20
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_20

		followspline 0 tank_spln_20 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_21
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_21

		followspline 0 tank_spln_21 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_22
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_22

		followspline 0 tank_spln_22 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_23
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_23

		followspline 0 tank_spln_23 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_24
	{
		trigger self tracks_turn_left
		accum 1 bitset 2

		trigger tank_turret_clip run_24

		followspline 0 tank_spln_24 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_25
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_25

		followspline 0 tank_spln_25 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_26
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_26

		followspline 0 tank_spln_26 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_27
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_27

		followspline 0 tank_spln_27 140 wait length 128
		accum 1 bitreset 2

		trigger self stuck_check_barrier1_built_msg

		trigger self run_continue
	}

	trigger run_28
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_28

		followspline 0 tank_spln_28 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_29
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_29

		followspline 0 tank_spln_29 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_30
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_30

		followspline 0 tank_spln_30 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Allies have passed the barrier 1 !
	// Boohooo Axis Tapirs are losing
	//----------------------------------------------------------------------

	trigger run_31
	{
		trigger self tracks_forward
		
		// **********************************
		trigger barrier1 remove
		trigger game_manager passed_barrier_1
		// **********************************

		accum 1 bitset 2

		trigger tank_turret_clip run_31

		followspline 0 tank_spln_31 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_32
	{
		trigger self tracks_turn_right
		accum 1 bitset 2

		trigger tank_turret_clip run_32

		followspline 0 tank_spln_32 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_33
	{

		accum 1 bitset 2

		trigger tank_turret_clip run_33

		followspline 0 tank_spln_33 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_34
	{
		trigger self tracks_turn_left
		accum 1 bitset 2

		trigger tank_turret_clip run_34

		followspline 0 tank_spln_34 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_35
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_35

		followspline 0 tank_spln_35 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_36
	{
		trigger self tracks_turn_left
		accum 1 bitset 2

		trigger tank_turret_clip run_36

		followspline 0 tank_spln_36 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_37
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_37

		followspline 0 tank_spln_37 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_38
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_38

		followspline 0 tank_spln_38 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_39
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_39

		followspline 0 tank_spln_39 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_40
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_40

		followspline 0 tank_spln_40 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_41
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_41

		followspline 0 tank_spln_41 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_42
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_42

		followspline 0 tank_spln_42 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_43
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_43

		followspline 0 tank_spln_43 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_44
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_44

		followspline 0 tank_spln_44 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_45
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_45

		followspline 0 tank_spln_45 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_46
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_46

		followspline 0 tank_spln_46 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_47
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_47

		followspline 0 tank_spln_47 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_48
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_48

		followspline 0 tank_spln_48 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_49
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_49

		followspline 0 tank_spln_49 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_50
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_50

		followspline 0 tank_spln_50 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_51
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_51

		followspline 0 tank_spln_51 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_52
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_52

		followspline 0 tank_spln_52 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_53
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_53

		followspline 0 tank_spln_53 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_54
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_54

		followspline 0 tank_spln_54 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_55
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_55

		followspline 0 tank_spln_55 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_56
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_56

		followspline 0 tank_spln_56 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_57
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_57

		followspline 0 tank_spln_57 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_58
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_58

		followspline 0 tank_spln_58 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_59
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_59

		followspline 0 tank_spln_59 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_60
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_60

		followspline 0 tank_spln_60 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_61
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_61

		followspline 0 tank_spln_61 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_62
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_62

		followspline 0 tank_spln_62 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_63
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_63

		followspline 0 tank_spln_63 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Destroy the wooden barrier !
	//-----------------------------------------------------------------------

	trigger run_64
	{
		trigger game_manager woodenbar_explosion

		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_64

		followspline 0 tank_spln_64 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_65
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_65

		followspline 0 tank_spln_65 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_66
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_66

		followspline 0 tank_spln_66 140 wait length 128
		accum 1 bitreset 2

		trigger self stuck_check_barrier2_built_msg

		trigger self run_continue
	}

	trigger run_67
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_67

		followspline 0 tank_spln_67 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_68
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_68

		followspline 0 tank_spln_68 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_69
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_69

		followspline 0 tank_spln_69 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_70
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_70

		followspline 0 tank_spln_70 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_71
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_71

		followspline 0 tank_spln_71 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_72
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_72

		followspline 0 tank_spln_72 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_73
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_73

		followspline 0 tank_spln_73 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_74
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_74

		followspline 0 tank_spln_74 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Allies have passed the barrier 2 !
	//-----------------------------------------------------------------------

	trigger run_75
	{
		trigger self tracks_forward

		//**********************************
		trigger barrier2 remove
		trigger game_manager passed_barrier_2
		//**********************************

		accum 1 bitset 2

		trigger tank_turret_clip run_75

		followspline 0 tank_spln_75 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_76
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_76

		followspline 0 tank_spln_76 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_77
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_77

		followspline 0 tank_spln_77 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_78
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_78

		followspline 0 tank_spln_78 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_79
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_79

		followspline 0 tank_spln_79 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_80
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_80

		followspline 0 tank_spln_80 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_81
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_81

		followspline 0 tank_spln_81 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_82
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_82

		followspline 0 tank_spln_82 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_83
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_83

		followspline 0 tank_spln_83 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_84
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_84

		followspline 0 tank_spln_84 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_85
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_85

		followspline 0 tank_spln_85 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_86
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_86

		followspline 0 tank_spln_86 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_87
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_87

		followspline 0 tank_spln_87 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_88
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_88

		followspline 0 tank_spln_88 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_89
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_89

		followspline 0 tank_spln_89 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_90
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_90

		followspline 0 tank_spln_90 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_91
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_91

		followspline 0 tank_spln_91 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_92
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_92

		followspline 0 tank_spln_92 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_93
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_93

		followspline 0 tank_spln_93 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_94
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_94

		followspline 0 tank_spln_94 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_95
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_95

		followspline 0 tank_spln_95 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_96
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_96

		followspline 0 tank_spln_96 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_97
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_97

		followspline 0 tank_spln_97 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_98
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_98

		followspline 0 tank_spln_98 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_99
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_99

		followspline 0 tank_spln_99 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_100
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_100

		followspline 0 tank_spln_100 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_101
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_101

		followspline 0 tank_spln_101 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_102
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_102

		followspline 0 tank_spln_102 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_103
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_103

		followspline 0 tank_spln_103 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_104
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_104

		followspline 0 tank_spln_104 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_105
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_105

		followspline 0 tank_spln_105 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_106
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_106

		followspline 0 tank_spln_106 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_107
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_107

		followspline 0 tank_spln_107 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_108
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_108

		followspline 0 tank_spln_108 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_109
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_109

		followspline 0 tank_spln_109 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_110
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_110

		followspline 0 tank_spln_110 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_111
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_111

		followspline 0 tank_spln_111 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}


	trigger run_112
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_112

		followspline 0 tank_spln_112 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}


	trigger run_113
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_113

		followspline 0 tank_spln_113 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}


	trigger run_114
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_114

		followspline 0 tank_spln_114 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_115
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_115

		followspline 0 tank_spln_115 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Allies are at the cp area... take Axis cave spawns away
	//-----------------------------------------------------------------------

	trigger run_116
	{
		trigger game_manager close_to_airport

		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_116

		followspline 0 tank_spln_116 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_117
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_117

		followspline 0 tank_spln_117 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}


	trigger run_118
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_118

		followspline 0 tank_spln_118 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}


	trigger run_119
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_119

		followspline 0 tank_spln_119 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}


	trigger run_120
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_120

		followspline 0 tank_spln_120 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_121
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_121

		followspline 0 tank_spln_121 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_122
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_122

		followspline 0 tank_spln_122 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_123
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_123

		followspline 0 tank_spln_123 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_124
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_124

		followspline 0 tank_spln_124 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_125
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_125

		followspline 0 tank_spln_125 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}



	trigger run_126
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_126

		followspline 0 tank_spln_126 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_127
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_127

		followspline 0 tank_spln_127 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_128
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_128

		followspline 0 tank_spln_128 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_129
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_129

		followspline 0 tank_spln_129 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_130
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_130

		followspline 0 tank_spln_130 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_131
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_131

		followspline 0 tank_spln_131 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_132
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_132

		followspline 0 tank_spln_132 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_133
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_133

		followspline 0 tank_spln_133 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_134
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_134

		followspline 0 tank_spln_134 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_135
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_135

		followspline 0 tank_spln_135 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_136
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_136

		followspline 0 tank_spln_136 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_137
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_137

		followspline 0 tank_spln_137 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_138
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_138

		followspline 0 tank_spln_138 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_139
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_139

		followspline 0 tank_spln_139 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_140
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_140

		followspline 0 tank_spln_140 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_141
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_141

		followspline 0 tank_spln_141 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_142
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_142

		followspline 0 tank_spln_142 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_143
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_143

		followspline 0 tank_spln_143 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_144
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_144

		followspline 0 tank_spln_144 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_145
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_145

		followspline 0 tank_spln_145 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Destroy the hangar door and plane
	//-----------------------------------------------------------------------

	trigger run_146
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_146

		followspline 0 tank_spln_146 140 wait length 128
		accum 1 bitreset 2

		trigger self		script_lockout

		trigger self 		tracks_stop
		trigger tank_sound 	stop

		startanimation 45 	10 	15 nolerp norandom
		wait 666
		startanimation 0 	1 	15 nolerp norandom
		wait 900

		accum 3 inc 1

		trigger tank_turret turn2 // will break the lockout
	}


	trigger run_147
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_147

		followspline 0 tank_spln_147 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_148
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_148

		followspline 0 tank_spln_148 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_149
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_149

		followspline 0 tank_spln_149 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_150
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_150

		followspline 0 tank_spln_150 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_151
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_151

		followspline 0 tank_spln_151 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_152
	{
		trigger self tracks_forward
		accum 1 bitset 2

		trigger tank_turret_clip run_152

		followspline 0 tank_spln_152 140 wait length 128
		accum 1 bitreset 2

		trigger self run_continue
	
	}

	//-----------------------------------------------------------------------
	// Jiiheywww weeheeyy! The end of story.
	//-----------------------------------------------------------------------

	trigger run_end
	{
		trigger self tracks_forward

		accum 1 bitset 2

		trigger tank_turret_clip run_153

		followspline 0 tank_spln_153 140 wait length 128
		accum 1 bitreset 2

		trigger self script_lockout

		trigger self 		tracks_stop
		trigger tank_sound 	stop


		startanimation 45 10 15 nolerp norandom
		wait 666
		startanimation 0 1 15 nolerp norandom

		wait 900

		trigger tank_turret turn

		accum 3 inc 1
	}
	// =========================
	// script lockouts

	trigger script_lockout
	{
		accum 5 inc 1
	}

	trigger script_lockout_stop
	{
		accum 5 inc -1
	}

	trigger sound_idle
	{
		accum 1 abort_if_bitset 9	// abort if tank already visibly dead - Sage : Now this must be the fix :D
		stopsound
		playsound sound/vehicles/tank/tank_idle.wav looping volume 512
	}

	trigger sound_start
	{
		stopsound
		playsound sound/vehicles/tank/tank_revup.wav volume 196
	}

	trigger sound_move
	{
		accum 1 abort_if_bitset 9	// abort if tank already visibly dead - Sage : Now this must be the fix :D
		stopsound
		playsound sound/vehicles/tank/tank_move.wav looping volume 512
	}

	trigger sound_stop
	{
		stopsound
		playsound sound/vehicles/tank/tank_revdown.wav volume 196
	}

	trigger sound_death
	{
		stopsound
		playsound sound/vehicles/tank/tank_stop.wav volume 256
	}

	trigger sound_rebirth
	{
		stopsound
		playsound sound/vehicles/tank/tank_start.wav volume 196
	}

	// ================================
	// stop check
	trigger stopcheck
	{
		trigger self stopcheck_setup
		accum 1 abort_if_not_bitset 6

		trigger self script_lockout

		trigger tank_sound 	stop
		trigger self 		tracks_stop
		startanimation 45 	10 	15 nolerp norandom
		wait 666
		startanimation 0 	1 	15 nolerp norandom
		wait 900

		trigger self script_lockout_stop
		resetscript
	}

	trigger stopcheck_setup
	{
		accum 1 bitset 6				// stop if we're stuck/no-one's pushing :)

		accum 1 abort_if_bitset 8		// no one in the trigger, abort

		trigger self stuck_check		// call the stop check function
		accum 1 abort_if_bitset 3		// we're stuck so break out

		accum 1 bitreset 6			// we're free to move
	}

	// ======================================
	// stuck checking

	trigger stuck_check
	{
		accum 1 bitreset 3

		trigger self stuck_check_barrier1
		trigger self stuck_check_barrier2
		trigger self stuck_check_scriptlockout
		trigger self stuck_check_finished
	}

	trigger stuck_check_finished
	{
	//	The check should be the final tank_spln_ nbr + 1
		accum 3 abort_if_less_than 154
		accum 1 bitset 3
	}

	trigger stuck_check_scriptlockout
	{
		accum 5 abort_if_equal 0
		accum 1 bitset 3
	}

	trigger stuck_check_barrier1
	{
		accum 3 abort_if_not_equal 31
		globalaccum 0 abort_if_not_bitset 0	// abort if barrier not built
		accum 1 bitset 3
	}

	trigger stuck_check_barrier1_built_msg
	{
		globalaccum 0 abort_if_not_bitset 0	// abort if barrier not built

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "c_al_tankbar_destroy"
		// *---------------------------------------------------------------------------------*
	}

	trigger stuck_check_barrier2
	{
		accum 3 abort_if_not_equal 75
		globalaccum 0 abort_if_not_bitset 1	// abort if barrier not built
		accum 1 bitset 3
	}

	trigger stuck_check_barrier2_built_msg
	{
		globalaccum 0 abort_if_not_bitset 1	// abort if barrier not built

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "c_al_tankbar_destroy"
		// *---------------------------------------------------------------------------------*
	}

	trigger tank_disable
	{
		accum 4 inc 1				// up the stop counter
		accum 4 abort_if_less_than 2

		accum 1 bitset 8				// set stop check

		trigger self deathcheck
	}

	trigger tank_enable
	{
		trigger self stuck_check
		accum 1 abort_if_bitset 3 	// stuck check
		accum 1 abort_if_bitset 7 	// death check  - Fix?? Sage.

		accum 4 set 0			// reset stop counter
		accum 1 bitreset 8		// reset stop check

		accum 1 abort_if_bitset 2 	// already following spline
		accum 5 abort_if_not_equal 0	// are we not in a script lockout?

		//accum 1 abort_if_bitset 7 	// death check

		trigger self script_lockout

		trigger tank_sound start

		startanimation 55 10 15 nolerp norandom
		wait 666
		startanimation 5 40 15 nolerp norandom
		wait 500
		trigger self tracks_forward

		trigger self script_lockout_stop

		trigger self move
	}

	trigger tracks_forward
	{
		accum 0 abort_if_equal 1
		accum 0 set 1

		remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_forward_a
		remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_forward_a
		remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_forward_a
		remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_forward_a
		remapshaderflush
	}

	trigger tracks_stop
	{
		accum 0 abort_if_equal 0
		accum 0 set 0

		remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_r_a
		remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_r_a
		remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_l_a
		remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_l_a
		remapshaderflush
	}

	trigger tracks_turn_left
	{
		accum 0 abort_if_equal 2
		accum 0 set 2

		remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_forward_a
		remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_forward_a
		remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_backward_a
		remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_backward_a
		remapshaderflush
	}

	trigger tracks_turn_right
	{
		accum 0 abort_if_equal 3
		accum 0 set 3

		remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_backward_a
		remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_backward_a
		remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_forward_a
		remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_forward_a
		remapshaderflush
	}

	trigger startfire
	{
		startanimation 67 8 10 nolerp norandom noloop
	}

	trigger stopfire
	{
		startanimation 0 1 15 nolerp norandom
	}
}

tank_build
{
	spawn
	{
		wait 500
		attachtotag tank tag_turret
	}
}

tank_construct
{
	spawn
	{
		wait 100

		//We want the tank to start built...
		//kill tank

		constructible_class 2
		constructible_health 1200
		constructible_constructxpbonus 10
		constructible_destructxpbonus 10
	}

	built final
	{
		alertentity tank
		wm_announce "The tank has been repaired!"
	}
}

tank_disabler
{
	trigger run
	{
		trigger tank tank_disable
	}
}

tank_enabler
{
	trigger run
	{
		trigger tank tank_enable
	}
}

tank_fire_sound
{
	trigger run
	{
		setposition tank
		alertentity tank_fire_sound
	}
}

tank_flash
{
	spawn
	{
		wait 300
 		attachtotag tank_turret tag_flash
		setstate tank_flash invisible
	}

	trigger run
	{
		setstate tank_gunsmoke default
		setstate tank_flash default
		wait 100
		setstate tank_flash invisible
		setstate tank_gunsmoke invisible
	}
}

tank_gunsmoke
{
	spawn
	{
		wait 300
 		attachtotag tank_turret tag_flash
		setstate tank_gunsmoke invisible
	}
}

tank_shell
{
	spawn
	{
		wait 400
		attachtotag tank tag_tank
	}
}

tank_smoke
{
	spawn
	{
		wait 300
		attachtotag tank tag_smoke
		setstate tank_smoke invisible
	}
}

tank_sound
{
	trigger start
	{
		trigger tank sound_start
		wait 3400
		trigger tank sound_move
	}

	trigger stop
	{
		trigger tank sound_stop
		wait 1400
		trigger tank sound_idle
	}

	trigger rebirth
	{
		trigger tank sound_rebirth
		wait 1400
		trigger tank sound_idle
	}
}

tank_trigger
{
	spawn
	{
		wait 100
		attachtotag tank tag_turret
	}
	
	activate
	{
		//I spam your console yah
	}
}


tank_turret_clip
{
	spawn
	{
		wait 50
		// Reset the tank+turret into correct position
		followspline 0 tank_spln_0 10000 wait length 128
		followspline 1 tank_spln_0 10000 wait length 128
	}

	trigger run_0
	{
		followspline 0 tank_spln_0 140 wait length 128
	}

	trigger run_1
	{
		followspline 0 tank_spln_1 140 wait length 128
	}

	trigger run_2
	{
		followspline 0 tank_spln_2 140 wait length 128
	}

	trigger run_3
	{
		followspline 0 tank_spln_3 140 wait length 128
	}

	trigger run_4
	{
		followspline 0 tank_spln_4 140 wait length 128
	}

	trigger run_5
	{
		followspline 0 tank_spln_5 140 wait length 128
	}

	trigger run_6
	{
		followspline 0 tank_spln_6 140 wait length 128
	}

	trigger run_7
	{
		followspline 0 tank_spln_7 140 wait length 128
	}

	trigger run_8
	{
		followspline 0 tank_spln_8 140 wait length 128
	}

	trigger run_9
	{
		followspline 0 tank_spln_9 140 wait length 128
	}

	trigger run_10
	{
		followspline 0 tank_spln_10 140 wait length 128
	}

	trigger run_11
	{
		followspline 0 tank_spln_11 140 wait length 128
	}

	trigger run_12
	{
		followspline 0 tank_spln_12 140 wait length 128
	}

	trigger run_13
	{
		followspline 0 tank_spln_13 140 wait length 128
	}
	
	trigger run_14
	{
		followspline 0 tank_spln_14 140 wait length 128
	}

	trigger run_15
	{
		followspline 0 tank_spln_15 140 wait length 128
	}

	trigger run_16
	{
		followspline 0 tank_spln_16 140 wait length 128
	}

	trigger run_17
	{
		followspline 0 tank_spln_17 140 wait length 128
	}

	trigger run_18
	{
		followspline 0 tank_spln_18 140 wait length 128
	}

	trigger run_19
	{
		followspline 0 tank_spln_19 140 wait length 128
	}

	trigger run_20
	{
		followspline 0 tank_spln_20 140 wait length 128
	}

	trigger run_21
	{
		followspline 0 tank_spln_21 140 wait length 128
	}

	trigger run_22
	{
		followspline 0 tank_spln_22 140 wait length 128
	}

	trigger run_23
	{
		followspline 0 tank_spln_23 140 wait length 128
	}

	trigger run_24
	{
		followspline 0 tank_spln_24 140 wait length 128
	}

	trigger run_25
	{
		followspline 0 tank_spln_25 140 wait length 128
	}

	trigger run_26
	{
		followspline 0 tank_spln_26 140 wait length 128
	}

	trigger run_27
	{
		followspline 0 tank_spln_27 140 wait length 128
	}

	trigger run_28
	{
		followspline 0 tank_spln_28 140 wait length 128
	}

	trigger run_29
	{
		followspline 0 tank_spln_29 140 wait length 128
	}

	trigger run_30
	{
		followspline 0 tank_spln_30 140 wait length 128
	}

	trigger run_31
	{
		followspline 0 tank_spln_31 140 wait length 128
	}

	trigger run_32
	{
		followspline 0 tank_spln_32 140 wait length 128
	}

	trigger run_33
	{
		followspline 0 tank_spln_33 140 wait length 128
	}

	trigger run_34
	{
		followspline 0 tank_spln_34 140 wait length 128
	}

	trigger run_35
	{
		followspline 0 tank_spln_35 140 wait length 128
	}

	trigger run_36
	{
		followspline 0 tank_spln_36 140 wait length 128
	}

	trigger run_37
	{
		followspline 0 tank_spln_37 140 wait length 128
	}

	trigger run_38
	{
		followspline 0 tank_spln_38 140 wait length 128
	}
	
	trigger run_39
	{
		followspline 0 tank_spln_39 140 wait length 128
	}

	trigger run_40
	{
		followspline 0 tank_spln_40 140 wait length 128
	}

	trigger run_41
	{
		followspline 0 tank_spln_41 140 wait length 128
	}

	trigger run_42
	{
		followspline 0 tank_spln_42 140 wait length 128
	}

	trigger run_43
	{
		followspline 0 tank_spln_43 140 wait length 128
	}

	trigger run_44
	{
		followspline 0 tank_spln_44 140 wait length 128
	}

	trigger run_45
	{
		followspline 0 tank_spln_45 140 wait length 128
	}

	trigger run_46
	{
		followspline 0 tank_spln_46 140 wait length 128
	}

	trigger run_47
	{
		followspline 0 tank_spln_47 140 wait length 128
	}

	trigger run_48
	{
		followspline 0 tank_spln_48 140 wait length 128
	}

	trigger run_49
	{
		followspline 0 tank_spln_49 140 wait length 128
	}

	trigger run_50
	{
		followspline 0 tank_spln_50 140 wait length 128
	}
	
	trigger run_51
	{
		followspline 0 tank_spln_51 140 wait length 128
	}

	trigger run_52
	{
		followspline 0 tank_spln_52 140 wait length 128
	}

	trigger run_53
	{
		followspline 0 tank_spln_53 140 wait length 128
	}

	trigger run_54
	{
		followspline 0 tank_spln_54 140 wait length 128
	}

	trigger run_55
	{
		followspline 0 tank_spln_55 140 wait length 128
	}

	trigger run_56
	{
		followspline 0 tank_spln_56 140 wait length 128
	}

	trigger run_57
	{
		followspline 0 tank_spln_57 140 wait length 128
	}

	trigger run_58
	{
		followspline 0 tank_spln_58 140 wait length 128
	}

	trigger run_59
	{
		followspline 0 tank_spln_59 140 wait length 128
	}

	trigger run_60
	{
		followspline 0 tank_spln_60 140 wait length 128
	}
	
	trigger run_61
	{
		followspline 0 tank_spln_61 140 wait length 128
	}

	trigger run_62
	{
		followspline 0 tank_spln_62 140 wait length 128
	}

	trigger run_63
	{
		followspline 0 tank_spln_63 140 wait length 128
	}

	trigger run_64
	{
		followspline 0 tank_spln_64 140 wait length 128
	}

	trigger run_65
	{
		followspline 0 tank_spln_65 140 wait length 128
	}

	trigger run_66
	{
		followspline 0 tank_spln_66 140 wait length 128
	}

	trigger run_67
	{
		followspline 0 tank_spln_67 140 wait length 128
	}

	trigger run_68
	{
		followspline 0 tank_spln_68 140 wait length 128
	}

	trigger run_69
	{
		followspline 0 tank_spln_69 140 wait length 128
	}

	trigger run_70
	{
		followspline 0 tank_spln_70 140 wait length 128
	}

	trigger run_71
	{
		followspline 0 tank_spln_71 140 wait length 128
	}

	trigger run_72
	{
		followspline 0 tank_spln_72 140 wait length 128
	}

	trigger run_73
	{
		followspline 0 tank_spln_73 140 wait length 128
	}

	trigger run_74
	{
		followspline 0 tank_spln_74 140 wait length 128
	}

	trigger run_75
	{
		followspline 0 tank_spln_75 140 wait length 128
	}

	trigger run_76
	{
		followspline 0 tank_spln_76 140 wait length 128
	}
	
	trigger run_77
	{
		followspline 0 tank_spln_77 140 wait length 128
	}
	
	trigger run_78
	{
		followspline 0 tank_spln_78 140 wait length 128
	}
	
	trigger run_79
	{
		followspline 0 tank_spln_79 140 wait length 128
	}
	
	trigger run_80
	{
		followspline 0 tank_spln_80 140 wait length 128
	}
	
	trigger run_81
	{
		followspline 0 tank_spln_81 140 wait length 128
	}
	
	trigger run_82
	{
		followspline 0 tank_spln_82 140 wait length 128
	}
	
	trigger run_83
	{
		followspline 0 tank_spln_83 140 wait length 128
	}
	
	trigger run_84
	{
		followspline 0 tank_spln_84 140 wait length 128
	}
	
	trigger run_85
	{
		followspline 0 tank_spln_85 140 wait length 128
	}
	
	trigger run_86
	{
		followspline 0 tank_spln_86 140 wait length 128
	}
	
	trigger run_87
	{
		followspline 0 tank_spln_87 140 wait length 128
	}
	
	trigger run_88
	{
		followspline 0 tank_spln_88 140 wait length 128
	}
	
	trigger run_89
	{
		followspline 0 tank_spln_89 140 wait length 128
	}

	trigger run_90
	{
		followspline 0 tank_spln_90 140 wait length 128
	}
	
	trigger run_91
	{
		followspline 0 tank_spln_91 140 wait length 128
	}
	
	trigger run_92
	{
		followspline 0 tank_spln_92 140 wait length 128
	}
	
	trigger run_93
	{
		followspline 0 tank_spln_93 140 wait length 128
	}
	
	trigger run_94
	{
		followspline 0 tank_spln_94 140 wait length 128
	}
	
	trigger run_95
	{
		followspline 0 tank_spln_95 140 wait length 128
	}
	
	trigger run_96
	{
		followspline 0 tank_spln_96 140 wait length 128
	}
	
	trigger run_97
	{
		followspline 0 tank_spln_97 140 wait length 128
	}
	
	trigger run_98
	{
		followspline 0 tank_spln_98 140 wait length 128
	}
	
	trigger run_99
	{
		followspline 0 tank_spln_99 140 wait length 128
	}

	trigger run_100
	{
		followspline 0 tank_spln_100 140 wait length 128
	}
	
	trigger run_101
	{
		followspline 0 tank_spln_101 140 wait length 128
	}
	
	trigger run_102
	{
		followspline 0 tank_spln_102 140 wait length 128
	}
	
	trigger run_103
	{
		followspline 0 tank_spln_103 140 wait length 128
	}
	
	trigger run_104
	{
		followspline 0 tank_spln_104 140 wait length 128
	}
	
	trigger run_105
	{
		followspline 0 tank_spln_105 140 wait length 128
	}
	
	trigger run_106
	{
		followspline 0 tank_spln_106 140 wait length 128
	}
	
	trigger run_107
	{
		followspline 0 tank_spln_107 140 wait length 128
	}
	
	trigger run_108
	{
		followspline 0 tank_spln_108 140 wait length 128
	}
	
	trigger run_109
	{
		followspline 0 tank_spln_109 140 wait length 128
	}

	trigger run_110
	{
		followspline 0 tank_spln_110 140 wait length 128
	}
	
	trigger run_111
	{
		followspline 0 tank_spln_111 140 wait length 128
	}
	
	trigger run_112
	{
		followspline 0 tank_spln_112 140 wait length 128
	}
	
	trigger run_113
	{
		followspline 0 tank_spln_113 140 wait length 128
	}
	
	trigger run_114
	{
		followspline 0 tank_spln_114 140 wait length 128
	}
	
	trigger run_115
	{
		followspline 0 tank_spln_115 140 wait length 128
	}
	
	trigger run_116
	{
		followspline 0 tank_spln_116 140 wait length 128
	}
	
	trigger run_117
	{
		followspline 0 tank_spln_117 140 wait length 128
	}
	
	trigger run_118
	{
		followspline 0 tank_spln_118 140 wait length 128
	}
	
	trigger run_119
	{
		followspline 0 tank_spln_119 140 wait length 128
	}

	trigger run_120
	{
		followspline 0 tank_spln_120 140 wait length 128
	}
	
	trigger run_121
	{
		followspline 0 tank_spln_121 140 wait length 128
	}
	
	trigger run_122
	{
		followspline 0 tank_spln_122 140 wait length 128
	}
	
	trigger run_123
	{
		followspline 0 tank_spln_123 140 wait length 128
	}
	
	trigger run_124
	{
		followspline 0 tank_spln_124 140 wait length 128
	}
	
	trigger run_125
	{
		followspline 0 tank_spln_125 140 wait length 128
	}
	
	trigger run_126
	{
		followspline 0 tank_spln_126 140 wait length 128
	}
	
	trigger run_127
	{
		followspline 0 tank_spln_127 140 wait length 128
	}
	
	trigger run_128
	{
		followspline 0 tank_spln_128 140 wait length 128
	}
	
	trigger run_129
	{
		followspline 0 tank_spln_129 140 wait length 128
	}

	trigger run_130
	{
		followspline 0 tank_spln_130 140 wait length 128
	}
	
	trigger run_131
	{
		followspline 0 tank_spln_131 140 wait length 128
	}
	
	trigger run_132
	{
		followspline 0 tank_spln_132 140 wait length 128
	}
	
	trigger run_133
	{
		followspline 0 tank_spln_133 140 wait length 128
	}
	
	trigger run_134
	{
		followspline 0 tank_spln_134 140 wait length 128
	}
	
	trigger run_135
	{
		followspline 0 tank_spln_135 140 wait length 128
	}
	
	trigger run_136
	{
		followspline 0 tank_spln_136 140 wait length 128
	}
	
	trigger run_137
	{
		followspline 0 tank_spln_137 140 wait length 128
	}
	
	trigger run_138
	{
		followspline 0 tank_spln_138 140 wait length 128
	}
	
	trigger run_139
	{
		followspline 0 tank_spln_139 140 wait length 128
	}

	trigger run_140
	{
		followspline 0 tank_spln_140 140 wait length 128
	}
	
	trigger run_141
	{
		followspline 0 tank_spln_141 140 wait length 128
	}
	
	trigger run_142
	{
		followspline 0 tank_spln_142 140 wait length 128
	}
	
	trigger run_143
	{
		followspline 0 tank_spln_143 140 wait length 128
	}
	
	trigger run_144
	{
		followspline 0 tank_spln_144 140 wait length 128
	}
	
	trigger run_145
	{
		followspline 0 tank_spln_145 140 wait length 128
	}
	
	trigger run_146
	{
		followspline 0 tank_spln_146 140 wait length 128
	}
	
	trigger run_147
	{
		followspline 0 tank_spln_147 140 wait length 128
	}
	
	trigger run_148
	{
		followspline 0 tank_spln_148 140 wait length 128
	}
	
	trigger run_149
	{
		followspline 0 tank_spln_149 140 wait length 128
	}
	
	trigger run_150
	{
		followspline 0 tank_spln_150 140 wait length 128
	}

	trigger run_151
	{
		followspline 0 tank_spln_151 140 wait length 128
	}

	trigger run_152
	{
		followspline 0 tank_spln_152 140 wait length 128
	}
	
	trigger run_153
	{
		followspline 0 tank_spln_153 140 wait length 128
	}

	trigger turn_clip0
	{
		playsound sound/vehicles/tank/turret_spin.wav looping
		faceangles 0 180 0 3000
		stopsound
		playsound sound/vehicles/tank/turret_end.wav
	}

	trigger turn_clip_cmd_wall
	{
		playsound sound/vehicles/tank/turret_spin.wav looping
		faceangles 0 160 0 1500
		stopsound
		playsound sound/vehicles/tank/turret_end.wav
	}

	trigger turn_clip_bf_109
	{
		playsound sound/vehicles/tank/turret_spin.wav looping
		faceangles 0 200 0 3000
		stopsound
		playsound sound/vehicles/tank/turret_end.wav
	}


	trigger turn_clip_hangar_door
	{
		playsound sound/vehicles/tank/turret_spin.wav looping
		faceangles 0 295 0 3000
		stopsound
		playsound sound/vehicles/tank/turret_end.wav
	}


	trigger fire_sound
	{
		playsound sound/vehicles/tank/tank_fire.wav
	}
}

tank_turret
{
	spawn
	{
		wait 500
		attachtotag tank tag_turret

		setstate cmd_wall_hurt invisible
		setstate cmd_wall_toi default
		setstate hangar_door_hurt invisible
		setstate bf_109_hurt invisible
	}

	//-----------------------------------------------------------------------
	// Destroy the command house door and the Bf-109 !
	//-----------------------------------------------------------------------

	trigger turn
	{
		wait 1000

		//rotate the clip and play the sounds
		trigger tank_turret_clip turn_clip_cmd_wall

		faceangles 0 -20 0 1500

		wait 500

		trigger tank startfire
		trigger tank_turret_clip fire_sound
		trigger tank_flash run
		setstate cmd_wall_hurt default

		wait 150

		setstate cmd_wall_hurt invisible

		alertentity cmd_wall_effect

		wait 100

		trigger tank stopfire

		alertentity cmd_wall
		alertentity cmd_wall_damaged

		setstate cmd_wall_toi invisible

		wait 2000

		setstate radio_toi default
		setstate radio_marker default

		globalaccum 5 set 1 //Allow radio usage

		//Unlock the doors
		globalaccum 8 set 1	
		trigger cmd_door_back neutralize
		trigger cmd_door_frontl neutralize
		trigger cmd_door_frontr neutralize


wm_announce "Allied team has destroyed the Command house wall! The doors are unlocked!"

		wait 100

		wm_addteamvoiceannounce 0 "c_ax_no_req_sf"
		wm_teamvoiceannounce 0 "c_ax_no_req_sf"

		wm_addteamvoiceannounce 1 "c_al_req_sf"
		wm_teamvoiceannounce 1 "c_al_req_sf"

		wait 100

		trigger gate_right signal_run

		//Destroy Ze Bf-109 model		
		//=================================> Boom

		//rotate the clip and play the sounds
		trigger tank_turret_clip turn_clip_bf_109

		faceangles 0 17 0 3000

		wait 1000

		trigger tank startfire
		trigger tank_turret_clip fire_sound
		trigger tank_flash run
		setstate bf_109_hurt default

		wait 150

		setstate bf_109_hurt invisible

		trigger tank stopfire

		alertentity bf_109_effect

		wait 150

		setstate bf_109 invisible
		setstate bf_109_clips invisible

		setstate bf_109_damaged default
		setstate bf_109_clips_damaged default
		setstate bf_109_wheel default

		trigger bf_109_toi remove
		
		wait 50
		
		alertentity bf_wall
		alertentity bf_wall_damaged

		//turn the clip back to 0 angle and play the sounds
		trigger tank_turret_clip turn_clip0

		faceangles 0 0 0 3000

		trigger tank sound_death

		wm_announce "Allied team has destroyed the Bf-109!"

		trigger tank script_lockout_stop
	}

	//--------------------------------------------------------
	// Destroy the hangar door and the Fw-190 !
	//--------------------------------------------------------
	trigger turn2
	{
		wait 1000
		
		//rotate the clip and play the sounds
		trigger tank_turret_clip turn_clip_hangar_door

		faceangles 0 115 0 3000

		wait 500

		trigger tank startfire
		trigger tank_turret_clip fire_sound
		trigger tank_flash run
		setstate hangar_door_hurt default

		wait 150

		setstate hangar_door_hurt invisible

		wait 200

		trigger tank stopfire

		alertentity hangar_door_effect

		wait 100

		alertentity hangar_door
		alertentity hangar_door_damaged

		wait 100

		alertentity fw_190_effect

		setstate fw_190 invisible
		setstate fw_190_clips invisible

		setstate fw_190_damaged default
		setstate fw_190_damaged_clips default
		setstate fw_190_wheel default

		trigger fw_190_toi remove

		//turn the clip back to 0 angle and play the sounds
		trigger tank_turret_clip turn_clip0

		faceangles 0 0 0 3000

		wm_announce "Allied team has destroyed the Fw-190!"

		trigger tank script_lockout_stop
	}

}

// *************************************************
// ************* Documents and radio  **************
// *************************************************

secret_documents
{

	spawn
	{
		wait 250
		setstate plane_flagonly invisible
		setstate secret_documents_toi invisible
		setstate secret_documents_marker invisible

		alertentity secret_documents
		setstate secret_documents invisible
		setstate secret_documents_dummy default

		setstate documents_multiple default

	}

	trigger stolen
	{
	}

	trigger returned
	{
	}	

	trigger captured
	{
		wm_announce "Allied team secured the Secret Blueprints into the Seafire!"

		wm_objective_status 4 0 2
		wm_objective_status 4 1 1

		wm_teamvoiceannounce 0 "c_ax_obj_lost"
		wm_teamvoiceannounce 1 "c_al_obj_sec"

		trigger game_manager documents_captured

		setstate secret_documents_toi invisible
		setstate secret_documents_marker invisible
	
		setstate plane_flagonly invisible
	
 	}

	trigger dropped
	{
		wm_announce "Allies have dropped the Secret Blueprints! Pick 'em up!"
	}
}

radio_switch
{
	spawn
	{
	}
	activate axis
	{
		trigger radio_counter axis_pressed
	}

	activate allies
	{
		trigger radio_counter allies_pressed
	}

	trigger remove
	{
		remove
	}
}

radio_counter
{
	spawn
	{
		wait 200

		accum 0 set 1	//axis have "pressed" the button
		accum 1 set 0	//allies have not pressed the button
		
		globalaccum 2 set 0	//0 seconds sent
		globalaccum 1 set 0	//the counter is disabled

		disablespeaker radio_morse


		setstate radio_toi invisible
		setstate radio_marker invisible
	}

	trigger axis_pressed
	{
		globalaccum 5 abort_if_not_equal 1

		accum 0 abort_if_not_equal 0	//check if axis have pressed the button
		accum 0 set 1			//axis have pressed the button now :)

		accum 1 set 0	//reset the button so allies can press it again
		
		globalaccum 2 set 0	//reset the counter
		globalaccum 1 set 0	//disable counter

		wm_announce "Axis have prevented Allies from sending the message!"
		
		wm_teamvoiceannounce 0 "c_ax_req_fail"
		wm_teamvoiceannounce 1 "c_al_req_fail"

		disablespeaker radio_morse
	}

	trigger allies_pressed
	{
		globalaccum 5 abort_if_not_equal 1

		accum 1 abort_if_not_equal 0
		accum 1 set 1

		accum 0 set 0	//reset the button so axis can press it again
				
		globalaccum 1 set 1	//enable counter

		wm_announce "Allies have started sending the message... 45 seconds remaining!"
		
		wm_teamvoiceannounce 0 "c_ax_they_are_req_sf"
		wm_teamvoiceannounce 1 "c_al_requesting"

		enablespeaker radio_morse

		trigger game_manager radio_counter
	}

	trigger check_time
	{
		globalaccum 2 trigger_if_equal 5 radio_counter 40_sec_left
		globalaccum 2 trigger_if_equal 10 radio_counter 35_sec_left
		globalaccum 2 trigger_if_equal 15 radio_counter 30_sec_left
		globalaccum 2 trigger_if_equal 20 radio_counter 25_sec_left
		globalaccum 2 trigger_if_equal 25 radio_counter 20_sec_left
		globalaccum 2 trigger_if_equal 30 radio_counter 15_sec_left
		globalaccum 2 trigger_if_equal 35 radio_counter 10_sec_left
		globalaccum 2 trigger_if_equal 40 radio_counter 5_sec_left		
		globalaccum 2 trigger_if_equal 41 radio_counter 4_sec_left
		globalaccum 2 trigger_if_equal 42 radio_counter 3_sec_left
		globalaccum 2 trigger_if_equal 43 radio_counter 2_sec_left
		globalaccum 2 trigger_if_equal 44 radio_counter 1_sec_left
		globalaccum 2 trigger_if_equal 45 radio_counter message_send
	}
	
	trigger 40_sec_left
	{
		wm_announce "40 seconds remaining..."
	}
	
	trigger 35_sec_left
	{
		wm_announce "35 seconds remaining..."
	}

	trigger 30_sec_left
	{
		wm_announce "30 seconds remaining..."
	}
	
	trigger 25_sec_left
	{
		wm_announce "25 seconds remaining..."
	}

	trigger 20_sec_left
	{
		wm_announce "20 seconds remaining..."
	}

	trigger 15_sec_left
	{
		wm_announce "15 seconds remaining..."
	}

	trigger 10_sec_left
	{
		wm_announce "10 seconds remaining..."
	}

	trigger 5_sec_left
	{
		wm_announce "5 seconds remaining..."
	}

	trigger 4_sec_left
	{
		wm_announce "4 seconds remaining..."
	}

	trigger 3_sec_left
	{
		wm_announce "3 seconds remaining..."
	}

	trigger 2_sec_left
	{
		wm_announce "2 seconds remaining..."
	}

	trigger 1_sec_left
	{
		wm_announce "1 second remaining..."
	}

	trigger message_send
	{
		wm_announce "Pilot is preparing for landing!"
		trigger plane fly	//make the plane come

		wm_removeteamvoiceannounce 1 "c_al_req_sf"
		wm_removeteamvoiceannounce 0 "c_ax_no_req_sf"

		wm_teamvoiceannounce 0 "c_ax_they_reqd_sf"
		wm_teamvoiceannounce 1 "c_al_sf_reqd"
		
		wm_addteamvoiceannounce 0 "c_ax_dont_give_obj"
		wm_teamvoiceannounce 0 "c_ax_dont_give_obj"

		wm_addteamvoiceannounce 1 "c_al_steal_obj"
		wm_teamvoiceannounce 1 "c_al_steal_obj"

		wm_objective_status 3 0 2
		wm_objective_status 3 1 1

		setstate secret_documents default
		setstate secret_documents_toi default
		setstate secret_documents_marker default

		setstate secret_documents_dummy invisible
		setstate documents_multiple invisible

		globalaccum 1 set 0	//disable counter so it won't be left running

		disablespeaker radio_morse

		setstate radio_toi invisible
		setstate radio_marker invisible

		trigger gate_left blueprint_run

		globalaccum 5 set 999

		trigger radio_switch remove
		
		remove
	}
}

radio_light
{
	spawn
	{
		wait 250
		setstate radio_corona1 invisible
		setstate radio_corona2 invisible
		
		remapshader textures/capuzzo/light_off textures/capuzzo/light_off
		remapshaderflush
	}

	trigger pulse
	{
		setstate radio_corona1 default
		setstate radio_corona2 default
		remapshader textures/capuzzo/light_off textures/capuzzo/light_on
		remapshaderflush
		wait 250
		setstate radio_corona1 invisible
		setstate radio_corona2 invisible
		remapshader textures/capuzzo/light_off textures/capuzzo/light_off
		remapshaderflush
	}
}



// *************************************************
// ***************** PLANE STUFF *******************
// *************************************************

plane
{

	spawn
	{
		wait 200
		// Reset the plane into correct position
		followspline 0 plane_spln_0 10000 wait length 128
		followspline 1 plane_spln_0 10000 wait length 128

		setstate plane invisible
		setstate plane_smoke invisible

		remapshader models/mapobjects/c_planes/seafire models/mapobjects/c_planes/seafire
		remapshaderflush

		accum 0 set 0		//plane is not destroyed
		accum 1 set 0		//plane is not at the position
		accum 2 set 0		//plane has not been damaged at all
		
		//the magical stuff for plane testing
		//trigger radio_counter message_send
		//wait 1000
		//trigger plane fly

	}

	trigger fly
	{

		wait 25000
		//What a nice day... and the warbird is singing
		trigger game_manager plane_far_in

		setstate plane default
		setstate plane_propella default

		setstate propella_hurt default
		setstate plane_hurt default

		trigger propella_hurt fly
		trigger plane_hurt fly
		trigger plane_toi fly


		trigger plane_propella rotate_1
		followspline 0 plane_spln_0 1400 wait length 128
		followspline 0 plane_spln_1 1300 wait length 128

		trigger plane_propella rotate_2
		followspline 0 plane_spln_2 1200 wait length 128
		followspline 0 plane_spln_3 1140 wait length 128

		trigger plane_propella rotate_3
		followspline 0 plane_spln_4 1000 wait length 128
		followspline 0 plane_spln_5 1000 wait length 128
	

		trigger plane_propella rotate_4
		followspline 0 plane_spln_6 900 wait length 128
		followspline 0 plane_spln_7 700 wait length 128

		trigger plane_propella rotate_5
		followspline 0 plane_spln_8 600 wait length 128
		//trigger self sound_end_slow
		trigger plane_propella rotate_6
		followspline 0 plane_spln_9 450 wait length 128

		trigger plane_propella rotate_7
		followspline 0 plane_spln_10 300 wait length 128

		trigger plane_propella rotate_backwards

	}
	
	trigger backwards
	{
		trigger propella_hurt backwards
		trigger plane_hurt backwards
		trigger plane_toi backwards

		followspline 1 plane_spln_b3 150 wait length 128
		followspline 1 plane_spln_b2 200 wait length 128

		wm_addteamvoiceannounce 0 "c_ax_sf_destroy"
		wm_teamvoiceannounce 0 "c_ax_sf_destroy"

		followspline 1 plane_spln_b1 200 wait length 128
		followspline 1 plane_spln_b0 150 wait length 128

		trigger plane_propella rotate_backwards_stop
		
	}

	trigger fly_away
	{
		wm_objective_status 5 0 2
		wm_objective_status 5 1 1
	
		trigger game_manager plane_far_out

		trigger propella_hurt fly_away
		trigger plane_hurt fly_away
		trigger plane_toi fly_away

		followspline 0 plane_spln2_0 150 wait length 128
		followspline 0 plane_spln2_1 200 wait length 128
		followspline 0 plane_spln2_2 350 wait length 128
		followspline 0 plane_spln2_3 450 wait length 128
		followspline 0 plane_spln2_4 700 wait length 128

		trigger plane_propella rotate2_1
		followspline 0 plane_spln2_5 950 wait length 128
		followspline 0 plane_spln2_6 1050 wait length 128

		trigger plane_propella rotate2_2
		followspline 0 plane_spln2_7 1250 wait length 128
		
		alertentity kill_sky_clip //Removes sky clip so player can fly too :)

		followspline 0 plane_spln2_8 1450 wait length 128
		followspline 0 plane_spln2_9 1550 wait length 128
		followspline 0 plane_spln2_10 1700 wait length 128
		followspline 0 plane_spln2_11 1800 wait length 128
		followspline 0 plane_spln2_12 1900 wait length 128

		wm_announce "Allied team escaped with the Secret Blueprints!"

		followspline 0 plane_spln2_13 1900 wait length 128

		followspline 0 tank_spln_135 99999 wait		//Move it elsewhere, because grr 
	
		wm_setwinner 1

		wm_endround
	}

	trigger plane_at_position
	{

		accum 1 set 1

		trigger self plane_died

		//check if the plane is alive, and if it is, allow securing the blueprints

		accum 0 abort_if_not_equal 0

		setstate plane_flagonly default
	}

	trigger plane_leaves
	{
		accum 1 set 0	//Don't let the plane be destroyed anymore
	}

	death
	{
		//we don't reset this anywhere, because it's not needed anymore after plane has landed

		accum 0 set 1

		trigger self plane_died
	}

	trigger plane_died
	{
		accum 0 abort_if_not_equal 1		//check if the plane has died
		accum 1 abort_if_not_equal 1		//check if the plane is at the position

		wm_announce "The Seafire has been damaged! Repair it before securing the Blueprints!"

		wm_teamvoiceannounce 0 "c_ax_sf_dmgd"
		wm_teamvoiceannounce 1 "c_al_sf_dmged"

		setstate plane_flagonly invisible

		trigger game_manager plane_feeling_bad

		setstate plane_smoke default

		kill plane_constructible

		remapshader models/mapobjects/c_planes/seafire models/mapobjects/c_planes/seafire_damaged
		remapshaderflush
	}

	rebirth
	{

	}

	pain
	{
		//changes the skin after very first 2 hits of explosives

		accum 2 abort_if_equal 2  		//abort if plane has been dmged twice

		accum 2 inc 1				//add 1 "pain"

		accum 2 abort_if_not_equal 2		//check if plane has been dmged twice

		remapshader models/mapobjects/c_planes/seafire models/mapobjects/c_planes/seafire_middle
		remapshaderflush	
	}

	trigger sound_stop
	{
		stopsound
	}

	trigger sound_near
	{
		playsound sound/capuzzo/near.wav looping volume 800
	}

	trigger sound_end
	{
		stopsound

		//divide the looping sound value with 2.16 (800/2.16=370).. 
		playsound sound/capuzzo/end.wav volume 370   
	}

	trigger sound_end_slow
	{
		stopsound
		playsound sound/capuzzo/end_slow.wav volume 370   
	}

	trigger sound_start
	{
		playsound sound/capuzzo/start.wav volume 370
	}
}

plane_propella
{
	spawn
	{
		wait 300
		attachtotag plane tag_propella
		setstate plane_propella invisible
	}

	trigger rotate_1
	{
		setrotation 0 0 2000
	}

	trigger rotate_2
	{
		setrotation 0 0 1700
	}

	trigger rotate_3
	{
		setrotation 0 0 1500
	}

	trigger rotate_4
	{
		setrotation 0 0 1300
	}

	trigger rotate_5
	{
		setrotation 0 0 1150
	}

	trigger rotate_6
	{
		setrotation 0 0 1000
	}

	trigger rotate_7
	{
		setrotation 0 0 850
	}

	trigger rotate_backwards

	{
		wait 200
		setrotation 0 0 650

		wait 200
		setrotation 0 0 350

		setstate propella_hurt invisible

		wait 300
		setrotation 0 0 150
		wait 1000

		trigger plane sound_stop
		stoprotation

		wait 2500
		trigger plane sound_start
		wait 300

		setrotation 0 0 -200
		wait 400

		setstate propella_hurt default

		setrotation 0 0 -300
		wait 500
		setrotation 0 0 -500
		wait 500
		setrotation 0 0 -700
		wait 500
		setrotation 0 0 -900
		wait 500
		setrotation 0 0 -1000	
		wait 500
		setrotation 0 0 -1200	

		wait 400

		trigger plane sound_near

		wait 300

		trigger plane backwards
		
	}

	trigger rotate_backwards_stop
	{
		
		trigger plane sound_end
		
		wait 700

		setrotation 0 0 -900
		wait 300
		setrotation 0 0 -700

		wait 350
		setrotation 0 0 -500
		wait 400
		setrotation 0 0 -300

		setstate propella_hurt invisible

		wait 300
		setrotation 0 0 -150
		wait 300
		stoprotation

		wait 1000

		wm_announce "The Seafire has succesfully landed and is ready to take the Secret blueprints!"
				
		trigger plane plane_at_position

	}

	trigger rotate_fly_away
	{
		trigger plane plane_leaves	//Disable dying
		globalaccum 7 set 0		//Disable announce

		wait 1500

		trigger plane sound_start

		wait 300
		setrotation 0 0 200
		wait 300

		setstate propella_hurt default

		setrotation 0 0 300
		wait 400
		setrotation 0 0 600
		wait 500
		setrotation 0 0 900
		wait 500
		setrotation 0 0 1100
		wait 500
		setrotation 0 0 1300
		
		wait 600

		setrotation 0 0 1500

		wait 600

		trigger plane sound_near

		wait 500

		trigger plane fly_away
	}

	trigger rotate2_1
	{
		setrotation 0 0 1700
	}

	trigger rotate2_2
	{
		setrotation 0 0 2000
	}
}



plane_constructible
{
	spawn
	{
		wait 400

		constructible_class 2
		constructible_health 800
		constructible_constructxpbonus 10
		constructible_destructxpbonus 10

		//do not setstate the toi or the constructible 
		//or otherwise the icon will not work properly
		//it can't be seen as it is outside the cmd map borders
		
	}

	built final
	{
		wm_announce "The Seafire has been repaired."
		
		wm_teamvoiceannounce 0 "c_ax_sf_repd"
		wm_teamvoiceannounce 1 "c_al_sf_repd"

		alertentity plane		//Heal the plane

		setstate plane_flagonly default

		setstate plane_smoke invisible

		trigger game_manager plane_feeling_good

		remapshader models/mapobjects/c_planes/seafire models/mapobjects/c_planes/seafire_middle
		remapshaderflush

	}

	trigger remove
	{
		setstate plane_toi invisible
		remove
	}

}

//Because of weird bugs, I was not able to use attachtotag on the toi and the hurts
//so they are all moved separately... grr...

plane_toi
{
	spawn
	{
		wait 300

		followspline 0 plane_spln_0 10000 wait length 128
		followspline 1 plane_spln_0 10000 wait length 128
	}

	trigger fly
	{
		followspline 0 plane_spln_0 1400 wait length 128
		followspline 0 plane_spln_1 1300 wait length 128
		followspline 0 plane_spln_2 1200 wait length 128
		followspline 0 plane_spln_3 1140 wait length 128
		followspline 0 plane_spln_4 1000 wait length 128
		followspline 0 plane_spln_5 1000 wait length 128
		followspline 0 plane_spln_6 900 wait length 128
		followspline 0 plane_spln_7 700 wait length 128
		followspline 0 plane_spln_8 600 wait length 128
		followspline 0 plane_spln_9 450 wait length 128
		followspline 0 plane_spln_10 300 wait length 128
		
	}

	trigger backwards
	{

		followspline 1 plane_spln_b3 150 wait length 128
		followspline 1 plane_spln_b2 200 wait length 128
		followspline 1 plane_spln_b1 200 wait length 128
		followspline 1 plane_spln_b0 150 wait length 128
	
	}

	trigger fly_away
	{
		followspline 0 plane_spln2_0 150 wait length 128
		followspline 0 plane_spln2_1 200 wait length 128
		followspline 0 plane_spln2_2 350 wait length 128
		followspline 0 plane_spln2_3 450 wait length 128
		followspline 0 plane_spln2_4 700 wait length 128
		followspline 0 plane_spln2_5 950 wait length 128
		followspline 0 plane_spln2_6 1050 wait length 128
		followspline 0 plane_spln2_7 1250 wait length 128
		followspline 0 plane_spln2_8 1450 wait length 128
		followspline 0 plane_spln2_9 1550 wait length 128
		followspline 0 plane_spln2_10 1700 wait length 128
		followspline 0 plane_spln2_11 1800 wait length 128
		followspline 0 plane_spln2_12 1900 wait length 128
		followspline 0 plane_spln2_13 1900 wait length 128
	}

}


propella_hurt
{
	spawn
	{
		wait 300

		followspline 0 plane_spln_0 10000 wait length 128
		followspline 1 plane_spln_0 10000 wait length 128

		setstate propella_hurt invisible
	}

	trigger fly
	{
		followspline 0 plane_spln_0 1400 wait length 128
		followspline 0 plane_spln_1 1300 wait length 128
		followspline 0 plane_spln_2 1200 wait length 128
		followspline 0 plane_spln_3 1140 wait length 128
		followspline 0 plane_spln_4 1000 wait length 128
		followspline 0 plane_spln_5 1000 wait length 128
		followspline 0 plane_spln_6 900 wait length 128
		followspline 0 plane_spln_7 700 wait length 128
		followspline 0 plane_spln_8 600 wait length 128
		followspline 0 plane_spln_9 450 wait length 128
		followspline 0 plane_spln_10 300 wait length 128
		
	}

	trigger backwards
	{

		followspline 1 plane_spln_b3 150 wait length 128
		followspline 1 plane_spln_b2 200 wait length 128
		followspline 1 plane_spln_b1 200 wait length 128
		followspline 1 plane_spln_b0 150 wait length 128
	
	}

	trigger fly_away
	{
		followspline 0 plane_spln2_0 150 wait length 128
		followspline 0 plane_spln2_1 200 wait length 128
		followspline 0 plane_spln2_2 350 wait length 128
		followspline 0 plane_spln2_3 450 wait length 128
		followspline 0 plane_spln2_4 700 wait length 128
		followspline 0 plane_spln2_5 950 wait length 128
		followspline 0 plane_spln2_6 1050 wait length 128
		followspline 0 plane_spln2_7 1250 wait length 128
		followspline 0 plane_spln2_8 1450 wait length 128
		followspline 0 plane_spln2_9 1550 wait length 128
		followspline 0 plane_spln2_10 1700 wait length 128
		followspline 0 plane_spln2_11 1800 wait length 128
		followspline 0 plane_spln2_12 1900 wait length 128
		followspline 0 plane_spln2_13 1900 wait length 128
	}

}

plane_hurt
{
	spawn
	{
		wait 300

		followspline 0 plane_spln_0 10000 wait length 128
		followspline 1 plane_spln_0 10000 wait length 128

		setstate plane_hurt invisible
	}

	trigger fly
	{
		followspline 0 plane_spln_0 1400 wait length 128
		followspline 0 plane_spln_1 1300 wait length 128
		followspline 0 plane_spln_2 1200 wait length 128
		followspline 0 plane_spln_3 1140 wait length 128
		followspline 0 plane_spln_4 1000 wait length 128
		followspline 0 plane_spln_5 1000 wait length 128
		followspline 0 plane_spln_6 900 wait length 128
		followspline 0 plane_spln_7 700 wait length 128
		followspline 0 plane_spln_8 600 wait length 128

		setstate plane_hurt invisible

		followspline 0 plane_spln_9 450 wait length 128
		followspline 0 plane_spln_10 300 wait length 128
		
	}

	trigger backwards
	{

		followspline 1 plane_spln_b3 150 wait length 128
		followspline 1 plane_spln_b2 200 wait length 128
		followspline 1 plane_spln_b1 200 wait length 128
		followspline 1 plane_spln_b0 150 wait length 128
	
	}

	trigger fly_away
	{
		followspline 0 plane_spln2_0 150 wait length 128
		followspline 0 plane_spln2_1 200 wait length 128
		followspline 0 plane_spln2_2 350 wait length 128

		setstate plane_hurt default

		followspline 0 plane_spln2_3 450 wait length 128
		followspline 0 plane_spln2_4 700 wait length 128
		followspline 0 plane_spln2_5 950 wait length 128
		followspline 0 plane_spln2_6 1050 wait length 128
		followspline 0 plane_spln2_7 1250 wait length 128
		followspline 0 plane_spln2_8 1450 wait length 128
		followspline 0 plane_spln2_9 1550 wait length 128
		followspline 0 plane_spln2_10 1700 wait length 128
		followspline 0 plane_spln2_11 1800 wait length 128
		followspline 0 plane_spln2_12 1900 wait length 128
		followspline 0 plane_spln2_13 1900 wait length 128
	}

}


bf_109_toi
{
	spawn
	{
		wait 500
		setstate bf_109_marker default

		setstate bf_109 default
		setstate bf_109_clips default

		setstate bf_109_damaged invisible
		setstate bf_109_clips_damaged invisible
		setstate bf_109_wheel invisible

	}

	trigger remove
	{
		wait 500
		setstate bf_109_marker invisible
		remove
	}
}

fw_190_toi
{
	spawn
	{
		wait 500
		setstate fw_190_marker default

		setstate fw_190 default
		setstate fw_190_clips default

		setstate fw_190_damaged invisible
		setstate fw_190_damaged_clips invisible
		setstate fw_190_wheel invisible
	}

	trigger remove
	{
		wait 500
		setstate fw_190_marker invisible
		remove
	}
}

// *************************************************
// ***************** SCRIPTED DOORS ****************
// *************************************************
//The doors at the command house.. locked for allies
//till they have breached the wall
//0=unlocked 1=locked	  (globalaccum 8)

//back door ----------------------------------------
cmd_door_back_script
{
	spawn
	{
		wait 200
	}

	trigger door_opened
	{
		trigger cmd_door_back open
		wait 7000
		trigger cmd_door_back closed
	}
}

cmd_door_back
{
	spawn
	{
		wait 50	
		accum 0 set 0

		setstate cmd_door_back default
		setstate cmd_door_back_ul invisible
	}

	trigger open
	{
		accum 0 set 1
	}

	trigger closed
	{
		accum 0 set 0
		globalaccum 8 abort_if_not_equal 1
		trigger self neutralize
	}

	trigger neutralize
	{
		accum 0 abort_if_not_equal 0

		setstate cmd_door_back invisible
		setstate cmd_door_back_ul default
		accum 0 set 69
	}
}

//front left door ----------------------------------------
cmd_door_frontl_script
{
	spawn
	{
		wait 200
	}

	trigger door_opened
	{
		trigger cmd_door_frontl open
		wait 7000
		trigger cmd_door_frontl closed
	}
}

cmd_door_frontl
{
	spawn
	{
		wait 50	
		accum 0 set 0

		setstate cmd_door_frontl default
		setstate cmd_door_frontl_ul invisible
	}

	trigger open
	{
		accum 0 set 1
	}

	trigger closed
	{
		accum 0 set 0
		globalaccum 8 abort_if_not_equal 1
		trigger self neutralize
	}

	trigger neutralize
	{
		accum 0 abort_if_not_equal 0

		setstate cmd_door_frontl invisible
		setstate cmd_door_frontl_ul default
		accum 0 set 69
	}
}

//front right door ----------------------------------------

cmd_door_frontr_script
{
	spawn
	{
		wait 200
	}

	trigger door_opened
	{
		trigger cmd_door_frontr open
		wait 7000
		trigger cmd_door_frontr closed
	}
}

cmd_door_frontr
{
	spawn
	{
		wait 50	
		accum 0 set 0

		setstate cmd_door_frontr default
		setstate cmd_door_frontr_ul invisible
	}

	trigger open
	{
		accum 0 set 1
	}

	trigger closed
	{
		accum 0 set 0
		globalaccum 8 abort_if_not_equal 1
		trigger self neutralize
	}

	trigger neutralize
	{
		accum 0 abort_if_not_equal 0

		setstate cmd_door_frontr invisible
		setstate cmd_door_frontr_ul default
		accum 0 set 69
	}
}
