game_manager
{
	spawn
	{
		remapshaderflush
		wm_axis_respawntime 30
		wm_allied_respawntime	20
		wm_number_of_objectives 7
		wm_set_round_timelimit	20

		// 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
		
		// Current main objectives for each team (0=Axis, 1=Allies)
		wm_set_main_objective		1	0
		wm_set_main_objective		1	1
		
		// Objectives
		// 1: Destroy/Protect the North Tower
		// 2: Destroy/Protect the North Tower
		// 3: Open the Door / Prevent this
		// 5: Destroy/Protect small Door / Prevent this
		// 6: Secure the Gold on the Truck / Prevent this
	        // 7: Escape with the Truck / Prevent this

		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

		wm_objective_status 6 0 0
		wm_objective_status 6 1 0
	
		wm_objective_status 7 0 0
		wm_objective_status 7 1 0

		wait 500

		// start triggered loops on/off as required (eg: command post radio sounds)
		disablespeaker allies_compost_sound
		disablespeaker axis_compost_sound
		disablespeaker allies_compost_sound_lms
		disablespeaker axis_compost_sound_lms
		
		wm_teamvoiceannounce 0 "fueldump_axis_wall_stop"
		
		wm_teamvoiceannounce 1 "radar_allies_entrance2_destroy"
		
		
		
		wait 2000
		
	}
	

	trigger allies_win
	{
		wm_setwinner	1
		wm_announce "^3Allied team escap^1ed with t^^^^^2he Gol^^33d Crates!^6 SEX ^9PARTY ^4DRUUGSS !!!!!"
			
					
		wm_objective_status 7 0 2
		wm_objective_status 7 1 1
		
		wait 1500
		wm_endround
	}

}







// **********************************************
// ****************** THE  GATE   ***************
// **********************************************
		
the_gate
{
 spawn
 {
	wait 50
	
 }

 trigger open_door
 	{
	trigger gate_body open
	}
}

gate_body
{
 spawn
 {
	wait 50
	trigger truck disable_stage1

 }

 trigger open
 	{
		wait 333
	 	gotomarker door1_pos1 8
		alertentity door1_sound
		alertentity door2_sound
		alertentity button_sound
		alertentity kurbel_an
		setstate buttonbox1 invisible		
		
		trigger truck enable_stage1 ////taken from barrier barrier 3 - the door is open truck gets movin

		wait 1000
		gotomarker door1_pos2 8
		
		wm_objective_status 3 0 0		
		wm_objective_status 3 1 1

		wm_announce "^3Castle Gate is now open!"

		wait 1000
	 	gotomarker door1_pos3 8
		wait 14500
		alertentity door1_sound
		alertentity door2_sound
		setstate kurbel_an invisible
		alertentity kurbel_aus
		alertentity doorclose_sound		
		
		
	}
}


// **********************************************
// ****************** TRUCK STUFF ***************
// **********************************************

truck_smoke
{
	spawn
	{
		wait 300
		attachtotag truck tag_wfront
		setstate truck_smoke invisible
	}
}

// sound "thread"
truck_engine
{
	spawn
	{
		wait 200
		attachtotag truck tag_wfront

		trigger truck_engine sound_idle
	}

	trigger start
	{
		trigger truck_engine sound_start
		wait 950
		trigger truck_engine sound_move
	}

	trigger stop
	{
		trigger truck_engine sound_stop
		wait 950
		trigger truck_engine sound_idle
	}

	// ========================================
	// sound events
	trigger sound_idle
	{
		playsound sound/vehicles/truck/truck_idle.wav looping
	}

	trigger sound_start
	{
		stopsound
		playsound sound/vehicles/truck/truck_revup.wav volume 96
	}

	trigger sound_move
	{
		playsound sound/vehicles/truck/truck_move.wav looping
	}

	trigger sound_stop
	{
		stopsound
		playsound sound/vehicles/truck/truck_revdown.wav volume 96
	}

	trigger sound_death
	{
		stopsound
		playsound sound/vehicles/truck/truck_stop.wav volume 96
	}

	// ========================================
	// ========================================
}

truck_build
{
	spawn
	{
		wait 500

		attachtotag truck tag_wback
	}
}

truck_construct
{
	spawn
	{
		constructible_class 2
		constructible_health 1050
		constructible_constructxpbonus 10
		constructible_destructxpbonus 10
	}

	built final
	{
		alertentity truck

		wm_announce "^3The Truck has been repaired!"
	}
}

// digibob: ok, for once i'm gonna PLAN this one, so NOTHING WILL BREAK EVAR
// ============================================================================
// accum 0, gold bars collected
// accum 1
//  - bit 0: barrier 1 status 	( 0 = destroyed, 	1 = built 		)
//  - bit 1: barrier 2 status 	( 0 = destroyed, 	1 = built 		)
//  - bit 2: spline status 		( 0 = not moving, 	1 = moving 		)
//  - bit 3: stuck check flag 	( 0 = not stuck, 	1 = stuck 		)
//  - bit 4: script lockout 	( 0 = no lockout, 	1 = lockout		)
//  - 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, blank
// accum 6, blank
// accum 7, blank
// ============================================================================
// spline points are tspln_X with X = 1 to 23
// ============================================================================
// wheel events:
//  - wheels_forward
//  - wheels_backward
//  - wheels_stop

truck
{
	spawn
	{
		
	}

	// ========================================
	// wheeeeeeeeeeeeeeels. eeels. ls.
	trigger wheels_forward
	{
		trigger truck_bwheel2 forward
		trigger truck_fwheel forward
	}

	trigger wheels_backward
	{
		trigger truck_bwheel2 backward
		trigger truck_fwheel backward
	}

	trigger wheels_stop
	{
		trigger truck_bwheel2 stop
		trigger truck_fwheel stop
	}

	// ========================================
	// ========================================


	trigger add_goldbar
	{
		accum 0 inc 1
		accum 0 inc 1
		trigger gold_full_0 show
		trigger gold_trans_0 hide
		trigger gold_crate secured

		accum 0 abort_if_less_than 2

		trigger gold_full_1 show
		trigger gold_trans_1 hide

		trigger self truck_escape_msg

		wm_announce "^3Allied team is escaping with the Radar Prototype!"

		wm_addteamvoiceannounce 1 "allies_obj_cap"
		
		wm_objective_status 6 0 0
		wm_objective_status 6 1 1

		setstate goldbars_toi invisible
		setstate goldbars_cm_marker invisible
	}

	trigger truck_escape_msg
	{
		// *----------------------------------- vo ------------------------------------------*
		
		wm_addteamvoiceannounce 1 "allies_hq_truck_escort"

		wm_teamvoiceannounce 0 "goldrush_axis_truck_stolen"

		wm_teamvoiceannounce 1 "goldrush_allies_truck_stolen"

		wm_teamvoiceannounce 0 "goldrush_axis_truck_stop"
		
	}

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

	trigger move_check
	{
		trigger truck stuck_check
		accum 1 abort_if_bitset 3

		trigger truck dispatch
	}

	trigger move
	{
		trigger truck move_check

		wait 500

		trigger truck move
	}

	// ========================================
	// ========================================


	trigger run_continue
	{
		trigger truck deathcheck
		trigger truck stopcheck
		trigger truck move
	}

	trigger run_1
	{
		accum 1 bitset 2
		followspline 0 tspln_1 125 wait length 304
		accum 1 bitreset 2
		
		
		accum 3 set 1

		trigger truck run_continue
	}

	trigger run_2
	{
		accum 1 bitset 2
		followspline 0 tspln_2 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 2
		trigger truck run_continue
	}

	trigger run_3
	{
		accum 1 bitset 2
		followspline 0 tspln_3 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 3
			
		trigger truck stuck_check_barrier3_built_msg

		trigger truck run_continue
	}

	trigger run_4
	{
		accum 1 bitset 2
		followspline 0 tspln_4 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 4
		trigger truck run_continue
	}

	trigger run_5
	{
		
		accum 1 bitset 2
		followspline 0 tspln_5 125 wait length 304
		accum 1 bitreset 2

		
		accum 3 set 5
		trigger truck run_continue
	}

	trigger run_6
	{
		

		accum 1 bitset 2
		followspline 0 tspln_6 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 6
		trigger truck run_continue
	}

	trigger run_7
	{
		accum 1 bitset 2
		followspline 0 tspln_7 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 7
		trigger truck run_continue
	}

	trigger run_8
	{
		accum 1 bitset 2
		followspline 0 tspln_8 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 8
		trigger truck run_continue
	}

	trigger run_9
	{
		accum 1 bitset 2
		followspline 0 tspln_9 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 9
		trigger truck run_continue
	}

	trigger run_10
	{
		accum 1 bitset 2
		followspline 0 tspln_10 125 wait length 304 
		accum 1 bitreset 2

		accum 3 set 10
		trigger truck run_continue
	}

	trigger run_11
	{
		accum 1 bitset 2
		followspline 0 tspln_11 125 wait length 304 
		accum 1 bitreset 2
		
		accum 3 set 11
		trigger truck run_continue
	}

	trigger run_12
	{
		accum 1 bitset 2
		followspline 0 tspln_12 125 wait length 304 
		accum 1 bitreset 2

		accum 3 set 12
		trigger truck run_continue
	}

	trigger run_13
	{
		accum 1 bitset 2
		followspline 0 tspln_13 125 wait length 304 
		accum 1 bitreset 2

		accum 3 set 13
		trigger truck run_continue
	}

	trigger run_14
	{
		accum 1 bitset 2
		followspline 0 tspln_14 125 wait length 304 
		accum 1 bitreset 2

		accum 3 set 14
		trigger truck run_continue
	}

	trigger run_15
	{
		accum 1 bitset 2
		followspline 0 tspln_15 125 wait length 304
		accum 1 bitreset 2
		
		
		accum 3 set 15
		trigger truck run_continue
	}

	trigger run_16
	{
		accum 1 bitset 2
		followspline 0 tspln_16 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 16
		trigger truck run_continue
	}

	trigger run_17
	{
		accum 1 bitset 2
		followspline 0 tspln_17 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 17

		
		trigger truck run_continue
	}

	trigger run_18
	{
		accum 1 bitset 2
		followspline 0 tspln_18 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 18
		trigger truck run_continue
	}

	trigger run_19
	{
		

		accum 1 bitset 2
		followspline 0 tspln_19 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 19
		trigger truck run_continue
	}

	trigger run_20
	{
		accum 1 bitset 2
		followspline 0 tspln_20 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 20
		trigger truck run_continue
	}

	trigger run_21
	{
		

		accum 1 bitset 2
		followspline 0 tspln_21 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 21
		trigger truck run_continue
	}

	trigger run_22
	{
		accum 1 bitset 2
		followspline 0 tspln_22 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 22
		trigger truck run_continue
	}

	trigger run_23
	{
		accum 1 bitset 2
		followspline 0 tspln_23 125 wait length 304
		accum 1 bitreset 2
		
		accum 3 set 23
		trigger truck run_continue
	}

	trigger run_24
	{
		accum 1 bitset 2
		followspline 0 tspln_24 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 24

		trigger truck run_continue
	}


	trigger run_25
	{
		accum 1 bitset 2
		followspline 0 tspln_25 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 25

		trigger truck run_continue	
	}


	trigger run_26
	{
		accum 1 bitset 2
		followspline 0 tspln_26 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 26

		trigger truck run_continue
	}

	trigger run_27
	{
		accum 1 bitset 2
		followspline 0 tspln_27 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 27

		trigger truck run_continue
	}

	trigger run_28
	{
		accum 1 bitset 2
		followspline 0 tspln_28 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 28

		trigger truck run_continue
	}

	trigger run_29
	{
		accum 1 bitset 2
		followspline 0 tspln_29 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 29

		trigger truck run_continue
	}

	trigger run_30
	{
		accum 1 bitset 2
		followspline 0 tspln_30 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 30

		trigger truck run_continue
	}

	trigger run_31
	{
		accum 1 bitset 2
		followspline 0 tspln_31 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 31

		trigger truck run_continue
	}
	

	trigger run_32
	{
		accum 1 bitset 2
		followspline 0 tspln_32 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 32
		trigger truck run_continue
		
	}

	trigger run_33
	{
		accum 1 bitset 2
		followspline 0 tspln_33 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 33
		trigger truck run_continue
		
	}
	
	trigger run_34
	{
		accum 1 bitset 2
		followspline 0 tspln_34 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 34
		trigger truck run_continue
	
	}

	trigger run_35
	{
		accum 1 bitset 2
		followspline 0 tspln_35 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 35
		trigger truck run_continue
	}

	trigger run_36
	{
		accum 1 bitset 2
		followspline 0 tspln_36 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 36

		trigger truck run_continue
	}


	trigger run_37
	{
		accum 1 bitset 2
		followspline 0 tspln_37 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 37
		trigger truck run_continue
		
	}

	trigger run_38
	{
		accum 1 bitset 2
		followspline 0 tspln_38 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 38
		trigger truck run_continue
	
	}

	trigger run_39
	{
		accum 1 bitset 2
		followspline 0 tspln_39 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 39

		trigger truck run_continue
	}

	trigger run_40
	{
		accum 1 bitset 2
		followspline 0 tspln_40 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 40

		trigger truck run_continue
	}

	trigger run_41
	{
		accum 1 bitset 2
		followspline 0 tspln_41 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 41

		trigger truck run_continue
	}

	trigger run_42
	{
		accum 1 bitset 2
		followspline 0 tspln_42 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 42

		trigger truck run_continue
	}
		

	trigger run_43
	{
		accum 1 bitset 2
		followspline 0 tspln_43 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 43

		trigger truck run_continue
	}

	
	trigger run_44
	{
		accum 1 bitset 2
		followspline 0 tspln_44 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 44

		trigger truck run_continue
	}

	trigger run_45
	{
		accum 1 bitset 2
		followspline 0 tspln_45 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 45

		trigger truck run_continue
	}

	trigger run_46
	{
		accum 1 bitset 2
		followspline 0 tspln_46 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 46

		trigger truck run_continue
	}

	trigger run_47
	{
		accum 1 bitset 2
		followspline 0 tspln_47 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 47

		trigger truck run_continue
	}

	trigger run_48
	{
		accum 1 bitset 2
		followspline 0 tspln_48 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 48
		
		trigger game_manager allies_win
				
		trigger truck run_continue
		
		trigger truck wheels_stop

		trigger game_manager allies_win
	}

	trigger run_49
	{
		accum 1 bitset 2
		followspline 0 tspln_49 125 wait length 304
		accum 1 bitreset 2

		accum 3 set 49

		trigger truck run_continue

		

		
	}

	trigger dispatch
	{
		accum 3 trigger_if_equal 0 	truck run_1
		accum 3 trigger_if_equal 1 	truck run_2
		accum 3 trigger_if_equal 2	truck run_3
		accum 3 trigger_if_equal 3 	truck run_4
		accum 3 trigger_if_equal 4 	truck run_5
		accum 3 trigger_if_equal 5 	truck run_6
		accum 3 trigger_if_equal 6 	truck run_7
		accum 3 trigger_if_equal 7 	truck run_8
		accum 3 trigger_if_equal 8 	truck run_9
		accum 3 trigger_if_equal 9 	truck run_10
		accum 3 trigger_if_equal 10	truck run_11
		accum 3 trigger_if_equal 11	truck run_12
		accum 3 trigger_if_equal 12	truck run_13
		accum 3 trigger_if_equal 13	truck run_14
		accum 3 trigger_if_equal 14	truck run_15
		accum 3 trigger_if_equal 15	truck run_16
		accum 3 trigger_if_equal 16	truck run_17
		accum 3 trigger_if_equal 17	truck run_18
		accum 3 trigger_if_equal 18	truck run_19
		accum 3 trigger_if_equal 19	truck run_20
		accum 3 trigger_if_equal 20	truck run_21
		accum 3 trigger_if_equal 21	truck run_22
		accum 3 trigger_if_equal 22	truck run_23
		accum 3 trigger_if_equal 23	truck run_24
		accum 3 trigger_if_equal 24	truck run_25
	accum 3 trigger_if_equal 25	truck run_26
	accum 3 trigger_if_equal 26	truck run_27
	accum 3 trigger_if_equal 27	truck run_28
	accum 3 trigger_if_equal 28	truck run_29
	accum 3 trigger_if_equal 29	truck run_30
	accum 3 trigger_if_equal 30	truck run_31
	accum 3 trigger_if_equal 31	truck run_32
	accum 3 trigger_if_equal 32	truck run_33
	accum 3 trigger_if_equal 33	truck run_34
	accum 3 trigger_if_equal 34	truck run_35
	accum 3 trigger_if_equal 35	truck run_36
	accum 3 trigger_if_equal 36	truck run_37
	accum 3 trigger_if_equal 37	truck run_38
	accum 3 trigger_if_equal 38	truck run_39
	accum 3 trigger_if_equal 39	truck run_40
	accum 3 trigger_if_equal 40	truck run_41
	accum 3 trigger_if_equal 41	truck run_42
	accum 3 trigger_if_equal 42	truck run_43
	accum 3 trigger_if_equal 43	truck run_44
	accum 3 trigger_if_equal 44	truck run_45
	accum 3 trigger_if_equal 45	truck run_46
	accum 3 trigger_if_equal 46	truck run_47
	accum 3 trigger_if_equal 47	truck run_48
	accum 3 trigger_if_equal 48	truck run_49
	}

	// ========================================
	// barrier checking
	// digibob: since we cant return variables, just use bit 3 of accum 1 as a register... mmmm assembly......

	trigger stuck_check
	{
		accum 1 bitreset 3

		trigger truck stuck_check_gold
		trigger truck stuck_check_barrier3
		trigger truck stuck_check_barrier4
		trigger truck stuck_check_scriptlockout
		trigger truck stuck_check_finished
	}

	trigger stuck_check_finished
	{
		accum 3 abort_if_not_equal 48

		accum 1 bitset 3
	}

	trigger stuck_check_scriptlockout
	{
		accum 1 abort_if_not_bitset 4

		accum 1 bitset 3
	}

	trigger stuck_check_gold
	{
		accum 3 abort_if_not_equal 0

		accum 0 abort_if_greater_than 1

		accum 1 bitset 3
	}

	trigger stuck_check_barrier3
	{
		accum 3 abort_if_not_equal 4

		accum 1 abort_if_not_bitset 0

		accum 1 bitset 3
	}

	trigger stuck_check_barrier3_built_msg
	{
		accum 1 abort_if_not_bitset 0

		
	}

	trigger stuck_check_barrier4
	{
		accum 3 abort_if_not_equal 18

		accum 1 abort_if_not_bitset 1

		accum 1 bitset 3
	}

	trigger stuck_check_barrier4_built_msg
	{
		accum 1 abort_if_not_bitset 1

		
	}

	// ========================================
	// ========================================




	// ========================================
	// stop check

	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 truck 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 keep going
	}

	trigger stopcheck
	{
		trigger truck stopcheck_setup
		accum 1 abort_if_not_bitset 6

		trigger truck script_lockout

		// Any just stopped moving stuff goes here
		trigger truck_engine stop
		trigger truck 		wheels_stop
		// <<<<< stop animation goes here

		trigger truck script_lockout_stop
		resetscript
	}

	// ========================================
	// ========================================




	// ========================================
	// script lockouts

	trigger script_lockout
	{
		accum 1 bitset 4
	}

	trigger script_lockout_stop
	{
		accum 1 bitreset 4
	}

	// ========================================
	// ========================================


	// ========================================
	// enable/disable

	trigger truck_enable
	{
		trigger truck stuck_check
		accum 1 abort_if_bitset 3 	// stuck check

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

		accum 1 abort_if_bitset 2 	// already following spline
		accum 1 abort_if_bitset 4 	// script lockout

		accum 1 abort_if_bitset 7 	// death check

		// Any just started moving stuff goes here
		trigger truck_engine start
		trigger truck wheels_forward
		// <<<<< start animation goes here
		trigger truck move
	}

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

		accum 1 bitset 8			// set stop check

		trigger truck deathcheck
	}

	// ========================================
	// ========================================

	// ========================================
	// death / rebirth

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

		changemodel models/mapobjects/blitz_sd/blitzbody.md3

		setstate truck_smoke invisible

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_truck_repaired_allies"

		wm_teamvoiceannounce 1 "allies_hq_truck_repaired"
		// *---------------------------------------------------------------------------------*

		trigger truck move
	}

	death
	{
		accum 1 bitset 7
	}

	trigger deathcheck
	{
		accum 1 abort_if_not_bitset 7	// are we dead?
		accum 1 abort_if_bitset 9		// are we not already visibly dead?
		accum 1 abort_if_bitset 2		// are we not following a spline?
		accum 1 abort_if_bitset 4		// are we not in a script lockout?

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

		wm_announce "^3The Truck has been damaged!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_truck_damaged"

		wm_teamvoiceannounce 1 "allies_hq_truck_damaged_axis"
		// *---------------------------------------------------------------------------------*

		setstate truck_smoke default
		kill truck_construct

		trigger truck_engine sound_death
		//trigger truck tracks_stop		// truck with tracks? i don't think so
		trigger truck wheels_stop
		// <<<< stop anim goes here

		changemodel models/mapobjects/blitz_sd/blitzbody_damaged.md3

		resetscript
	}

	// ========================================
	// ========================================




	// ========================================
	// barriers

	trigger enable_stage1
	{
		accum 1 bitreset 0
	}

	trigger disable_stage1
	{
		accum 1 bitset 0
	}

	

	// ========================================
	// ========================================
}

truck_bwheel2
{
	spawn
	{
		wait 500

		attachtotag truck tag_wback
	}

	trigger forward
	{
		setrotation 130 0 0
	}

	trigger backward
	{
		setrotation -130 0 0
	}

	trigger stop
	{
		stoprotation
	}
}

truck_fwheel
{
	spawn
	{
		wait 500

		attachtotag truck tag_wfront
	}

	trigger forward
	{
		setrotation 130 0 0
	}

	trigger backward
	{
		setrotation -130 0 0
	}

	trigger stop
	{
		stoprotation
	}
}

truck_trigger
{
	spawn
	{
		wait 500

		attachtotag truck tag_wback
	}
}

truck_disabler
{
	trigger run
	{
		trigger truck truck_disable
	}
}

truck_enabler
{
	trigger run
	{
		trigger truck truck_enable
	}
}


/////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////

// *********************************************
// ****************** FLAG STUFF ***************
// *********************************************

goldbar_holder
{
	death
	{
		trigger truck add_goldbar
	}
}

// *********************************************
// ****************** GOLD STUFF ***************
// *********************************************

gold_crate
{
	spawn
	{
		accum 0 set 0 // gold counter
	}

	trigger stolen
	{
		accum 0 inc 1
		accum 0 trigger_if_equal 1 gold_crate stolen1
		accum 0 trigger_if_equal 2 gold_crate stolen2
	}

	trigger secured
	{
		accum 0 trigger_if_equal 1 gold_crate secured1
		accum 0 trigger_if_equal 2 gold_crate secured2
	}

	trigger returned
	{
		accum 0 inc -1
		accum 0 trigger_if_equal 0 gold_crate returned1
		accum 0 trigger_if_equal 1 gold_crate returned2
	}

	trigger stolen1
	{

	}



	trigger secured1
	{
		wm_announce "^3Allied team has secured the Radar Prototype!"
		wm_teamvoiceannounce 1 "allies_obj_cap"
		wm_teamvoiceannounce 0 "axis_obj_lost"
	}

	

	trigger returned1
	{
		
	}

	
}

gold_full_0
{
	spawn
	{
		wait 500
		attachtotag truck tag_obj1
		faceangles 0 90 0 50

		setstate gold_full_0 invisible
	}

	trigger show
	{
		setstate gold_full_0 default
	}
}



gold_trans_0
{
	spawn
	{
		wait 500
		attachtotag truck tag_obj1
		faceangles 0 90 0 50
	}

	trigger hide
	{
		setstate gold_trans_0 invisible
	}
}



// ================================================
// ============ NEUTRAL COMMAND POST ==============
// ================================================

allied_compost_built
{
	spawn
	{
		wait 400
		trigger allied_compost_built setup

		constructible_class 2
	}

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

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

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

		trigger allied_compost_built_model enable_allied_features

		trigger alliedcpspawns_obj on

		setautospawn	"Allied CP Spawn"	1

		enablespeaker allies_compost_sound
	}

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

	death
	{
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger allied_compost_built_model disable_allied_features

		trigger alliedcpspawns_obj off

		disablespeaker allies_compost_sound
	}
}

allied_compost_built_model
{
	spawn
	{
		wait 400
		setstate allied_compost_built_model invisible
	}

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

		wm_announce	"Allied Command Post constructed. Charge speed increased!"
		wm_announce "^3Allies Spawn at the Library!"
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed_allies"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed"

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

		wm_objective_status 4 0 2
		wm_objective_status 4 1 1
	}

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

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

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

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_construct"

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

		wm_objective_status 4 0 1
		wm_objective_status 4 1 0
	}
}

axis_compost_built
{
	spawn
	{
		wait 400
		trigger axis_compost_built setup

		constructible_class 2
	}

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

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

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

		trigger axis_compost_built_model enable_axis_features

		trigger axiscpspawns_obj on

		setautospawn	"Axis CP Spawn"	0

		enablespeaker axis_compost_sound
	}

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

	death
	{
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger axis_compost_built_model disable_axis_features

		trigger axiscpspawns_obj off

		disablespeaker axis_compost_sound
	}
}

axis_compost_built_model
{
	spawn
	{
		wait 400
		setstate axis_compost_built_model invisible
	}

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

		wm_announce	"Axis Command Post constructed. Charge speed increased!"
		wm_announce "^3Axis Spawn at the Library!"
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"

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

		wm_objective_status 4 0 1
		wm_objective_status 4 1 2
	}

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

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

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

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_damaged"

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

		wm_objective_status 4 0 0
		wm_objective_status 4 1 1
	}
}


//////////////////////////********************************************************
//////////////////////////******EXPLOSIVE STUUUUUUUFF*****************************
//////////////////////////********************************************************

north_tower
{
 spawn // this is called when the game starts and the entity is spawned
{
wait 200

constructible_class 3 // this indicated that the oasis_wall entity is a dynamitable-only entity... 
}

death // this is called when the entity is destroyed... 
{

wm_announce "^3Allies have destroyed the North Tower Wall!"

wm_teamvoiceannounce 1 "allies_obj_dest"

wm_teamvoiceannounce 0 "fueldump_axis_wall_destroyed"

wm_objective_status 1 0 2
wm_objective_status 1 1 1

}
}


south_tower
{
 spawn // this is called when the game starts and the entity is spawned
{
wait 200

constructible_class 3 // this indicated that the oasis_wall entity is a dynamitable-only entity... 
}

death // this is called when the entity is destroyed... 
{

wm_announce "^3Allies have destroyed the South Tower Wall!"

wm_teamvoiceannounce 1 "allies_obj_dest"

wm_teamvoiceannounce 0 "fueldump_axis_wall_destroyed"

wm_objective_status 2 0 2
wm_objective_status 2 1 1


}
}




////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////Trigger for the Spawnpoints
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////



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

	trigger on
	{
		setstate alliedcpspawns_obj default
		setstate alliedcpspawns default
	}

	trigger off
	{
		setstate alliedcpspawns_obj invisible
		setstate alliedcpspawns invisible
	}
}

alliedcpspawns
{
	spawn
	{
		wait 50
		setstate alliedcpspawns invisible
	}
}



/////////////////// Axis cp spawn

axiscpspawns_obj
{
	spawn
	{
		wait 50
		setstate axiscpspawns_obj invisible
		setstate axiscpspawns invisible
	}

	trigger on
	{
		setstate axiscpspawns_obj default
		setstate axiscpspawns default
	}

	trigger off
	{
		setstate axiscpspawns_obj invisible
		setstate axiscpspawns invisible
	}
}

axiscpspawns
{
	spawn
	{
		wait 50
		setstate axiscpspawns invisible
	}
}