Page 1 of 1

TOW>TDM---Flughafen

Posted: Sat Mar 26, 2005 4:15 am
by LiquorKraZy
ok...ive tried messing with this...i wanna take the TOW map FLughafen and make all the TOW stuff available for TDM...like (the runway lights, and the hangar doors) i wanna make it so ppl can open them and close them using the switches but i cant get it to work....all the other stuff i dont want to worry about...stock script is below...maybe some ideas to get me started...i have it all working, except the switches....remember this is the stock script....thanks ahead of time! :D
// MP_Flughafen_TOW
// Note: For objective function calls TakeOver and SetCurrent the
// teams are as such:
// 0 = Axis
// 1 = Allies
// 2 = Neutral

//----------------------------------------------------------
// Main
//----------------------------------------------------------
main:
exec global/ai.scr
exec global/friendly.scr

level.script="maps/obj/MP_Flughafen_TOW.scr"
level.music="MP_Flughafen_TOW"

setcvar "g_scoreboardpic" "mp_flughafen_tow"

exec global/tow_dm.scr
exec global/ambient.scr
exec global/door_locked.scr

level.gametype = int( getcvar( g_gametype ) )

//gametype 5 = Tug of War
if( level.gametype == 5 )
{
setcvar "g_obj_alliedtext1" "Protect Allied Transport"
setcvar "g_obj_alliedtext2" "Open 1st Hangar Doors"
setcvar "g_obj_alliedtext3" "Turn On the Runway Lights"
setcvar "g_obj_alliedtext4" "Open the 2nd Hangar Doors"
setcvar "g_obj_alliedtext5" "Detonate Axis Motorpool"

setcvar "g_obj_axistext1" "Protect Axis Motorpool"
setcvar "g_obj_axistext2" "Close the 2nd Hangar Doors"
setcvar "g_obj_axistext3" "Turn Off the Runway Lights"
setcvar "g_obj_axistext4" "Close the 1st Hangar Doors"
setcvar "g_obj_axistext5" "Destroy Allied Transport"
}
else
{
$gmc_bomb remove
$opel_bomb remove

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Flughafen"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" "Welcome To Petey's"
setcvar "g_obj_axistext1" "101st Screamin' Eagles"
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" "www.101stairborneclan.com"
}

//set our farplane and culling parameters
$world farplane 3000
$world farplane_color ".03 .05 .09" //this matches eben's new sky
$world farplane_cull 2

//Open the hangar 1 doors
$hangar_doors_1 open $hangar_doors_1_entity

// open these doors at the start...
$cine_hangar_doors open $cine_hangar_doors_entity

//Turn off the lights!
thread init_runway_lights

//////////////////////////
level waittill prespawn
//////////////////////////

//////////////////////////
level waittill spawn

thread tank

end
//------------------------------------------------------------------
tank:
//Flughafen Map Fix-Underground
local.fix1 = spawn script_model
local.fix1 model "vehicles/shermantank_damaged.tik"
local.fix1.origin = ( -1191.53 4215.02 -23.92 )
local.fix1.angles = ( 0 0 0 )
local.fix1 solid


//init aagun params
$aagun.collisionent = $aagun_collision
$aagun_turret0.collisionent = $aagun_turret_collision
$aagun thread global/stationaryweapons.scr::MountedStationaryWeaponWithCollision "models/statweapons/p_aagun_d.tik" $aagun_destroyed_collision

//init granatwefer 1 params

$granat_1.collisionent = $granatwerfer_collision
$granat_1_turret0.collisionent = $granatwerfer_turret_collision
$granat_1 thread global/stationaryweapons.scr::MountedStationaryWeaponWithCollision "models/statweapons/p_granatwerfer_d.tik" $granatwerfer_destroyed_collision
$granat_1_turret0 maxyawoffset "40"


//init granatwefer 2 params
$granat_2.collisionent = $granatwerfer_collision
$granat_2_turret0.collisionent = $granatwerfer_turret_collision
$granat_2 thread global/stationaryweapons.scr::MountedStationaryWeaponWithCollision "models/statweapons/p_granatwerfer_d.tik" $granatwerfer_destroyed_collision
$granat_2_turret0 maxyawoffset "40"



// set the parameters for this round based match
level.bRoundStarted = 0
level.dmrespawning = 1 // 1 or 0
level.clockside = axis // set to axis, allies, kills, or draw
level.dmroundlimit = 15 // round time limit in minutes
level.numObjectives = 5 // Number of objectives needed to win

level.hangar1_switch_up = 1
level.hangar2_switch_up = 1
level.runway_switch_up = 1

//////////////////////////
//level waittill roundstart
//////////////////////////

//If we are in TOW mode setup the TOW stuff...
if( level.gametype == 5 )
{
thread init_switches
thread init_spawner_bombs

//Flip the hangar switch
thread toggle_hangar_1_doors_switch

//Setup the starting team objectives
thread set_objectives

level.bRoundStarted = 1
}

end


//----------------------------------------------------------
//Destroy the Allied spawner here
//----------------------------------------------------------
destroy_allied_spawner:

iprintln "The Allied transport has been destroyed!"

//Take over the objective
$obj_allied_spawner TakeOver 0

iprintln "The Allied Team can no longer respawn!"

thread Check_End_Match

end

//----------------------------------------------------------
//Destroy the Axis spawner here
//----------------------------------------------------------
destroy_axis_spawner:

iprintln "The Axis Motorpool has been destroyed!"

//Take over the objective
$obj_axis_spawner TakeOver 1

iprintln "The Axis Team can no longer respawn!"

thread Check_End_Match

end

//----------------------------------------------------------
//Open/close the 1st Hangar Doors here
//----------------------------------------------------------
toggle_hangar_doors_1:

if( level.bRoundStarted == 1 )
{
if( parm.other.dmteam == axis )
{
if( $obj_hangar_doors_1.ControlledBy != 0 )
{
//flip the switch
thread toggle_hangar_1_doors_switch

//Close the hangar doors
$hangar_doors_1 close $hangar_doors_1_entity
$hangar_doors_1 playsound hanger_closed

$obj_hangar_doors_1 TakeOver 0

iprintln "The Axis have closed the 1st Hangar Doors!"
}
}
else if( parm.other.dmteam == allies )
{
if( $obj_hangar_doors_1.ControlledBy != 1 )
{
//flip the switch
thread toggle_hangar_1_doors_switch

//Open the pen doors
$hangar_doors_1 open $hangar_doors_1_entity
$hangar_doors_1 playsound hanger_open

$obj_hangar_doors_1 TakeOver 1

iprintln "The Allies have opened the 1st Hangar Doors!"
}
}


//Did anyone win?
thread Check_End_Match

//Update team current objectives
thread set_objectives
}

end

//----------------------------------------------------------
//Open/close the 2st Hangar Doors here
//----------------------------------------------------------
toggle_hangar_doors_2:

if( level.bRoundStarted == 1 )
{
if( parm.other.dmteam == axis )
{
if( $obj_hangar_doors_2.ControlledBy != 0 )
{
//flip the switch
thread toggle_hangar_2_doors_switch

//Close the hangar doors
$hangar_doors_2 close $hangar_doors_2_entity
$hangar_doors_2 playsound hanger_closed

$obj_hangar_doors_2 TakeOver 0

iprintln "The Axis have closed the 2nd Hangar Doors!"
}
}
else if( parm.other.dmteam == allies )
{
if( $obj_hangar_doors_2.ControlledBy != 1 )
{
//flip the switch
thread toggle_hangar_2_doors_switch

//Open the hangar doors
$hangar_doors_2 open $hangar_doors_2_entity
$hangar_doors_2 playsound hanger_open

$obj_hangar_doors_2 TakeOver 1

iprintln "The Allies have opened the 2nd Hangar Doors!"
}
}

//Did anyone win?
thread Check_End_Match

//Update team current objectives
thread set_objectives
}

end

//----------------------------------------------------------
//Turn on/Shut down the runway lights
//----------------------------------------------------------
toggle_runway_lights:

if( level.bRoundStarted == 1 )
{
if( parm.other.dmteam == allies )
{
if( $obj_runway_lights.ControlledBy != 1 )
{
//flip the switch
thread toggle_runway_switch

waitthread turn_on_runway_lights

//Take the objective
$obj_runway_lights TakeOver 1

iprintln "The Allies have turned on the Runway Lights!"
}
}
else if( parm.other.dmteam == axis )
{
if( $obj_runway_lights.ControlledBy != 0 )
{
//flip the switch
thread toggle_runway_switch

waitthread turn_off_runway_lights

//Take the objective
$obj_runway_lights TakeOver 0

iprintln "The Axis have turned off the Runway Lights!"
}
}

//Did anyone win?
thread Check_End_Match

//Update team current objectives
thread set_objectives
}

end

//----------------------------------------------------------
//Initialize the runway lights
//----------------------------------------------------------
init_runway_lights:

$run_lights_01 hide
$run_lights_02 hide
$run_lights_03 hide
$run_lights_04 hide
$run_lights_05 hide
$run_lights_06 hide
$run_lights_07 hide
$run_lights_08 hide
$run_lights_09 hide
$run_lights_10 hide
$run_lights_11 hide
$run_lights_12 hide

end

//----------------------------------------------------------
//Set the teams current objectives
//----------------------------------------------------------
set_objectives:

//First lets do the allies
if( $obj_hangar_doors_1.ControlledBy == 0 )
{
$obj_hangar_doors_1 SetCurrent 1
}
else if( $obj_runway_lights.ControlledBy == 0 )
{
$obj_runway_lights SetCurrent 1
}
else if( $obj_hangar_doors_2.ControlledBy == 0 )
{
$obj_hangar_doors_2 SetCurrent 1
}
else if( $obj_axis_spawner.ControlledBy == 0 )
{
$obj_axis_spawner SetCurrent 1
}

//Now the Axis
if( $obj_hangar_doors_2.ControlledBy == 1 )
{
$obj_hangar_doors_2 SetCurrent 0
}
else if( $obj_runway_lights.ControlledBy == 1 )
{
$obj_runway_lights SetCurrent 0
}
else if( $obj_hangar_doors_1.ControlledBy == 1 )
{
$obj_hangar_doors_1 SetCurrent 0
}
else if( $obj_allied_spawner.ControlledBy == 1 )
{
$obj_allied_spawner SetCurrent 0
}

end

//----------------------------------------------------------
//init the spawner bombs
//----------------------------------------------------------
init_spawner_bombs:

//Allied spawner bomb
$gmc_bomb thread global/tow_dm.scr::bomb_thinker "axis" maps/obj/MP_Flughafen_TOW.scr::destroy_allied_spawner
$opel_bomb thread global/tow_dm.scr::bomb_thinker "allies" maps/obj/MP_Flughafen_TOW.scr::destroy_axis_spawner

end


//----------------------------------------------------------
//init the trigger switches
//----------------------------------------------------------
init_switches:

$hangar_doors_1_switch bind $hangar_doors_1_switch_origin
$hangar_doors_2_switch bind $hangar_doors_2_switch_origin
$runway_switch bind $runway_switch_origin

//make all the switches non solid so as not to injure the player when triggered.
$hangar_doors_1_switch notsolid
$hangar_doors_1_switch_origin notsolid

$hangar_doors_2_switch notsolid
$hangar_doors_2_switch_origin notsolid

$runway_switch notsolid
$runway_switch_origin notsolid

end

//--------------------------------------------------------------
//Open hangar 1 doors
//--------------------------------------------------------------
toggle_hangar_1_doors_switch:

if( level.hangar1_switch_up == 1 )
{
$hangar_doors_1_switch_origin speed 1.0
$hangar_doors_1_switch_origin rotatezdownto 180
$hangar_doors_1_switch_origin waitmove
$hangar_doors_1_switch_origin playsound switchbox
level.hangar1_switch_up = 0
}
else
{
$hangar_doors_1_switch_origin speed 1.0
$hangar_doors_1_switch_origin rotatezupto 0
$hangar_doors_1_switch_origin waitmove
$hangar_doors_1_switch_origin playsound switchbox
level.hangar1_swith_up = 1
}

end

//--------------------------------------------------------------
//Open hangar 2 doors
//--------------------------------------------------------------
toggle_hangar_2_doors_switch:

if( level.hangar2_switch_up == 1 )
{
$hangar_doors_2_switch_origin speed 1.0
$hangar_doors_2_switch_origin rotatezdownto 180
$hangar_doors_2_switch_origin waitmove
$hangar_doors_2_switch_origin playsound switchbox
level.hangar2_switch_up = 0
}
else
{
$hangar_doors_2_switch_origin speed 1.0
$hangar_doors_2_switch_origin rotatezupto 0
$hangar_doors_2_switch_origin waitmove
$hangar_doors_2_switch_origin playsound switchbox
level.hangar2_switch_up = 1
}

end

//--------------------------------------------------------------
//Turn on Runway Lights
//--------------------------------------------------------------
toggle_runway_switch:

if( level.runway_switch_up == 1 )
{
$runway_switch_origin speed 1.0
$runway_switch_origin rotatezdownto 180
$runway_switch_origin waitmove
$runway_switch_origin playsound switchbox
level.runway_switch_up = 0
}
else
{
$runway_switch_origin speed 1.0
$runway_switch_origin rotatezupto 0
$runway_switch_origin waitmove
$runway_switch_origin playsound switchbox
level.runway_switch_up = 1
}

end

//-----------------------------------------------
// Turn off the runway lights
//-----------------------------------------------
turn_on_runway_lights:

//Turn on the lights
$run_lights_01 show
$run_lights_01 playsound runway_lights_on
wait .2
$run_lights_02 show
$run_lights_02 playsound runway_lights_on
wait .2
$run_lights_03 show
$run_lights_03 playsound runway_lights_on
wait .2
$run_lights_04 show
$run_lights_04 playsound runway_lights_on
wait .2
$run_lights_05 show
$run_lights_05 playsound runway_lights_on
wait .2
$run_lights_06 show
$run_lights_06 playsound runway_lights_on
wait .2
$run_lights_07 show
$run_lights_07 playsound runway_lights_on
wait .2
$run_lights_08 show
$run_lights_08 playsound runway_lights_on
wait .2
$run_lights_09 show
$run_lights_09 playsound runway_lights_on
wait .2
$run_lights_10 show
$run_lights_10 playsound runway_lights_on
wait .2
$run_lights_11 show
$run_lights_11 playsound runway_lights_on
wait .2
$run_lights_12 show
$run_lights_12 playsound runway_lights_on

end

//-----------------------------------------------
// Turn off the runway lights
//-----------------------------------------------
turn_off_runway_lights:

//Turn off the lights
$run_lights_01 hide
$run_lights_01 playsound runway_lights_off
wait .2
$run_lights_02 hide
$run_lights_02 playsound runway_lights_off
wait .2
$run_lights_03 hide
$run_lights_03 playsound runway_lights_off
wait .2
$run_lights_04 hide
$run_lights_04 playsound runway_lights_off
wait .2
$run_lights_05 hide
$run_lights_05 playsound runway_lights_off
wait .2
$run_lights_06 hide
$run_lights_06 playsound runway_lights_off
wait .2
$run_lights_07 hide
$run_lights_07 playsound runway_lights_off
wait .2
$run_lights_08 hide
$run_lights_08 playsound runway_lights_off
wait .2
$run_lights_09 hide
$run_lights_09 playsound runway_lights_off
wait .2
$run_lights_10 hide
$run_lights_10 playsound runway_lights_off
wait .2
$run_lights_11 hide
$run_lights_11 playsound runway_lights_off
wait .2
$run_lights_12 hide
$run_lights_12 playsound runway_lights_off

end

//-----------------------------------------------
// Check for end match condition
//-----------------------------------------------
Check_End_Match:

local.nAxis = 0

//Allied Spawner
if( $obj_allied_spawner.ControlledBy == 0 )
{
local.nAxis++
}

//Axis Spawner
if( $obj_axis_spawner.ControlledBy == 0 )
{
local.nAxis++
}

//Hangar Doors 1
if( $obj_hangar_doors_1.ControlledBy == 0 )
{
local.nAxis++
}

//Hangar Doors 2
if( $obj_hangar_doors_2.ControlledBy == 0 )
{
local.nAxis++
}

//Runway lights
if( $obj_runway_lights.ControlledBy == 0 )
{
local.nAxis++
}

//Allies first
if( $obj_runway_lights.ControlledBy == 1 && $obj_hangar_doors_1.ControlledBy == 1 && $obj_hangar_doors_2.ControlledBy == 1 )
{
//ignore the clock
level ignoreclock 1

//if there is a bomb ticking stop it.
waitthread global/tow_dm.scr::StopBomb

//Allies win do the movie then end the map
thread AlliesWon
}
else if( local.nAxis == level.numObjectives )
{
//ignore the clock
level ignoreclock 1

//if there is a bomb ticking stop it.
waitthread global/tow_dm.scr::StopBomb

//Axis win do their movie and end the map
thread AxisWon
}

end

//-------------------------------------------------------------
// Do the Allied camera stuff
//-------------------------------------------------------------
DoAlliedCamera local.ent:

local.camera = spawn func_camera origin $cam01.origin angles $cam01.angles

local.camera fov 100
local.camera watch local.ent
local.camera cut
cuecamera local.camera

end

//-------------------------------------------------------------
// when allies win, we watch the two planes take off and do a
// fly-by passed each other....
//-------------------------------------------------------------
AlliesWon:

$player nodamage
$player hide
freezeplayer

level ignoreclock 1

forcemusic aux2 aux2

local.plane = spawn script_model model vehicles/ho-ix.tik origin $p00.origin angles $p00.angles
local.plane notsolid
local.plane thread TakeOff $p00

thread DoAlliedCamera local.plane

local.plane2 = spawn script_model model vehicles/ho-ix.tik origin $p_00.origin angles $p_00.angles
local.plane2 waitthread TakeOff $p_00

forcemusic aux3 aux3

teamwin allies

wait 5

end

//-------------------------------------------------------------
// have the plane take off
//-------------------------------------------------------------
TakeOff local.path:

self notsolid
self playsound plane // todo: more appropriate sound maybe?
thread RaiseLandingGear
self followpath local.path
self waitmove
self delete

end

//--------------------------------------------------------------
// Raise the landing gear
//--------------------------------------------------------------
RaiseLandingGear:
wait 2

self anim takeoff


end


//-------------------------------------------------------------
// Watch the allies run by while the germans shoot at them...
// much like berlin's ending....
// open hanger door?
//-------------------------------------------------------------
AxisWon:

$player nodamage
$player hide
freezeplayer

forcemusic aux4 aux4

local.camera = spawn func_camera origin $axiswincam.origin angles $axiswincam.angles

local.camera cut
cuecamera local.camera

waitthread global/ai.scr::spawnset 30 set30
waitthread global/ai.scr::spawnset 40 set40

for (local.i=1;local.i<=$set30.size;local.i++)
{
$set30[local.i] thread RunAway
}

wait 0.75
for (local.i=1;local.i<=$set40.size;local.i++)
{
$set40[local.i] thread Chase
}

wait 7

$cine_hangar_doors close $cine_hangar_doors_entity

wait 8

forcemusic aux5 aux5

teamwin axis

wait 5

end

//-------------------------------------------------------------
//RunAway dudes running away
//-------------------------------------------------------------
RunAway:

self exec global/disable_ai.scr
self nodamage
self runto self.target

end

//-------------------------------------------------------------
// Chase dudes chasing the dudes running away..
//-------------------------------------------------------------
Chase local.target:

self exec global/disable_ai.scr
self nodamage
self runto self.target

self thread FireShots $set30[1]

end

//-------------------------------------------------------------
// Fire!
//-------------------------------------------------------------
FireShots local.target:

self aimat local.target

while ( isAlive self )
{
local.rand = randomfloat 0.75
local.rand += 0.2

wait local.rand
self fire
}

end

Posted: Sat Mar 26, 2005 4:54 am
by bdbodger
$hangar_doors_2 open $hangar_doors_2_entity
$hangar_doors_2 playsound hanger_open
the hanger doors are marked as targeted that means they can only be opened or close by a trigger or by script in this case they are opened by script so to change it so a trigger targets the door/doors ( see below )
//----------------------------------------------------------
//init the trigger switches
//----------------------------------------------------------
init_switches:

$hangar_doors_1_switch bind $hangar_doors_1_switch_origin
$hangar_doors_2_switch bind $hangar_doors_2_switch_origin
$runway_switch bind $runway_switch_origin

//make all the switches non solid so as not to injure the player when triggered.
$hangar_doors_1_switch notsolid
$hangar_doors_1_switch_origin notsolid

$hangar_doors_2_switch notsolid
$hangar_doors_2_switch_origin notsolid

$runway_switch notsolid
$runway_switch_origin notsolid

end
binds the switches to the doors leave this in
//--------------------------------------------------------------
//Open hangar 1 doors
//--------------------------------------------------------------
toggle_hangar_1_doors_switch:

if( level.hangar1_switch_up == 1 )
{
$hangar_doors_1_switch_origin speed 1.0
$hangar_doors_1_switch_origin rotatezdownto 180
$hangar_doors_1_switch_origin waitmove
$hangar_doors_1_switch_origin playsound switchbox
level.hangar1_switch_up = 0
}
else
{
$hangar_doors_1_switch_origin speed 1.0
$hangar_doors_1_switch_origin rotatezupto 0
$hangar_doors_1_switch_origin waitmove
$hangar_doors_1_switch_origin playsound switchbox
level.hangar1_swith_up = 1
}

end
toggles the switch done with a trigger_use useing setthread ,if the trigger targets the door it will open it or close it as the case maybe
toggle_runway_lights:

if( level.bRoundStarted == 1 )
{
if( parm.other.dmteam == allies )
{
if( $obj_runway_lights.ControlledBy != 1 )
{
//flip the switch
thread toggle_runway_switch

waitthread turn_on_runway_lights
Usually the light turn on and off depending on the dmteam of the player and who controls them but can be change to toggle no matter what team the player is on both ways run the thread at the bottom toggle_runway_switch and waitthread turn_on_runway_lights all the lines above that can be taken out.

Posted: Sat Mar 26, 2005 5:19 am
by LiquorKraZy
so to make it so aynone can flip the switch what do i change
if( parm.other.dmteam == allies )
too?

and don't i move these parts up and below LEVEL WAITILL SPAWN to?

Posted: Sat Mar 26, 2005 12:25 pm
by bdbodger
both ways run the thread at the bottom toggle_runway_switch and waitthread turn_on_runway_lights all the lines above that can be taken out.
You are going to have to edit it and take out the lines not needed for TDM

Posted: Wed Jul 06, 2005 8:14 am
by ViPER
Been wanting to do this myself too - any luck Petey? I had trouble getting around the takeover/control flags so I just spawned my own triggers to run all the stuff.

Also, I conditioned the tdm mode stuff so the script should still work in TOW mode too.

Code: Select all

// MP_Flughafen_TOW
// Note: For objective function calls TakeOver and SetCurrent the
// teams are as such:
// 0 = Axis
// 1 = Allies
// 2 = Neutral

//----------------------------------------------------------
// Main
//----------------------------------------------------------
main:	
	exec global/ai.scr
	exec global/friendly.scr

	level.script="maps/obj/MP_Flughafen_TOW.scr"	
	level.music="MP_Flughafen_TOW"	

	setcvar "g_scoreboardpic" "mp_flughafen_tow" 

	exec global/tow_dm.scr
	exec global/ambient.scr
	exec global/door_locked.scr

	level.gametype = int( getcvar( g_gametype ) )

	//gametype 5 = Tug of War
	if( level.gametype == 5 )
	{
		setcvar "g_obj_alliedtext1" "Protect Allied Transport"
		setcvar "g_obj_alliedtext2" "Open 1st Hangar Doors"
		setcvar "g_obj_alliedtext3" "Turn On the Runway Lights"
		setcvar "g_obj_alliedtext4" "Open the 2nd Hangar Doors"
		setcvar "g_obj_alliedtext5" "Detonate Axis Motorpool"

		setcvar "g_obj_axistext1" "Protect Axis Motorpool"
		setcvar "g_obj_axistext2" "Close the 2nd Hangar Doors"
		setcvar "g_obj_axistext3" "Turn Off the Runway Lights"
		setcvar "g_obj_axistext4" "Close the 1st Hangar Doors"
		setcvar "g_obj_axistext5" "Destroy Allied Transport"
	}
	else
	{
		$gmc_bomb remove
		$opel_bomb remove

		// set scoreboard messages
		setcvar "g_obj_alliedtext1" "Flughafen" 
		setcvar "g_obj_alliedtext2" "TDM"
		setcvar "g_obj_alliedtext3" "MOD"
		setcvar "g_obj_axistext1" "by"
		setcvar "g_obj_axistext2" "ViPER"
		setcvar "g_obj_axistext3" ""

	}

	//add in our clip brushes
	local.clipbrush = spawn script_object
	local.clipbrush.origin = ( -1125 4470 -10 )
	local.clipbrush setsize ( -340 -220 -100 ) ( 340 150 120 )
	local.clipbrush.angles = ( 0 347 0 )
	local.clipbrush solid

	//set our farplane and culling parameters
	$world farplane 3000
	$world farplane_color ".03 .05 .09"  //this matches eben's new sky
	$world farplane_cull 2

	//Viper says leave these closed if not TOW mode...  
	if( level.gametype == 5 )
	{
	//Open the hangar 1 doors
	$hangar_doors_1 open $hangar_doors_1_entity
	}
	
	// open these doors at the start...
	$cine_hangar_doors open $cine_hangar_doors_entity
	
	//Turn off the lights!
	thread init_runway_lights
	
	//////////////////////////
	level waittill prespawn
	//////////////////////////
	
	//gametype not Tug of War
	if( level.gametype <= 4 )
		{
		thread viperstuff
		}

	//////////////////////////
	level waittill spawn
	//////////////////////////

	//init aagun params
	$aagun.collisionent = $aagun_collision
	$aagun_turret0.collisionent = $aagun_turret_collision
	$aagun thread global/stationaryweapons.scr::MountedStationaryWeaponWithCollision "models/statweapons/p_aagun_d.tik" $aagun_destroyed_collision

   //init granatwefer 1 params

    $granat_1.collisionent = $granatwerfer_collision
    $granat_1_turret0.collisionent = $granatwerfer_turret_collision
    $granat_1 thread global/stationaryweapons.scr::MountedStationaryWeaponWithCollision "models/statweapons/p_granatwerfer_d.tik" $granatwerfer_destroyed_collision
	$granat_1_turret0 maxyawoffset "40"


    //init granatwefer 2 params
    $granat_2.collisionent = $granatwerfer_collision
    $granat_2_turret0.collisionent = $granatwerfer_turret_collision
    $granat_2 thread global/stationaryweapons.scr::MountedStationaryWeaponWithCollision "models/statweapons/p_granatwerfer_d.tik" $granatwerfer_destroyed_collision
	$granat_2_turret0 maxyawoffset "40"

	
	
	// set the parameters for this round based match	
	level.bRoundStarted			= 0
//	level.dmrespawning			= 1			// 1 or 0	
	level.clockside				= axis		// set to axis, allies, kills, or draw
	level.dmroundlimit			= 15		// round time limit in minutes
	level.numObjectives			= 5			// Number of objectives needed to win

	level.hangar1_switch_up		= 1
	level.hangar2_switch_up		= 1
	level.runway_switch_up		= 1	

	//////////////////////////
	level waittill roundstart
	//////////////////////////
	
	//If we are in TOW mode setup the TOW stuff...
	if( level.gametype == 5 )
	{
		thread init_switches
		thread init_spawner_bombs		

		//Flip the hangar switch		
		thread toggle_hangar_1_doors_switch

		//Setup the starting team objectives	
		thread set_objectives
		
		level.bRoundStarted = 1
	}						 
		
end


//----------------------------------------------------------
//Destroy the Allied spawner here
//----------------------------------------------------------
destroy_allied_spawner local.planter:	
	
	iprintln "The Allied transport has been destroyed!"

	//Take over the objective
	$obj_allied_spawner TakeOver 0

	iprintln "The Allied Team can no longer respawn!"

	//Give the planter some points
	if( local.planter != NULL && local.planter != NIL )
	{
		local.planter AddKills 5
	}

	thread Check_End_Match
	
end

//----------------------------------------------------------
//Destroy the Axis spawner here
//----------------------------------------------------------
destroy_axis_spawner local.planter:
	
	iprintln "The Axis Motorpool has been destroyed!"
		
	//Take over the objective
	$obj_axis_spawner TakeOver 1

	iprintln "The Axis Team can no longer respawn!"

	//Give the planter some points
	if( local.planter != NULL && local.planter != NIL )
	{
		local.planter AddKills 5
	}

	thread Check_End_Match

end

//----------------------------------------------------------
//Open/close the 1st Hangar Doors here
//----------------------------------------------------------
toggle_hangar_doors_1:	
	
	if( level.bRoundStarted == 1 )
	{
		if( parm.other.dmteam == axis )
		{
			if( $obj_hangar_doors_1.ControlledBy != 0 )
			{			
				//flip the switch
				thread toggle_hangar_1_doors_switch

				//Close the hangar doors
				$hangar_doors_1 close $hangar_doors_1_entity
				$hangar_doors_1 playsound hanger_closed

				$obj_hangar_doors_1 TakeOver 0				

				//Give 2 points for taking objective
				parm.other AddKills 2

				iprintln "The Axis have closed the 1st Hangar Doors!"
			}
		}
		else if( parm.other.dmteam == allies )
		{
			if( $obj_hangar_doors_1.ControlledBy != 1 )
			{		
				//flip the switch
				thread toggle_hangar_1_doors_switch
				
				//Open the pen doors
				$hangar_doors_1 open $hangar_doors_1_entity
				$hangar_doors_1 playsound hanger_open

				$obj_hangar_doors_1 TakeOver 1

				//Give 2 points for taking objective
				parm.other AddKills 2

				iprintln "The Allies have opened the 1st Hangar Doors!"
			}
		}

		
		//Did anyone win?
		thread Check_End_Match

		//Update team current objectives
		thread set_objectives
	}

end

//----------------------------------------------------------
//Open/close the 2st Hangar Doors here
//----------------------------------------------------------
toggle_hangar_doors_2:	
	
	if( level.bRoundStarted == 1 )
	{
		if( parm.other.dmteam == axis )
		{
			if( $obj_hangar_doors_2.ControlledBy != 0 )
			{			
				//flip the switch
				thread toggle_hangar_2_doors_switch
				
				//Close the hangar doors
				$hangar_doors_2 close $hangar_doors_2_entity
				$hangar_doors_2 playsound hanger_closed

				$obj_hangar_doors_2 TakeOver 0

				//Give 2 points for taking objective
				parm.other AddKills 2

				iprintln "The Axis have closed the 2nd Hangar Doors!"
			}
		}
		else if( parm.other.dmteam == allies )
		{
			if( $obj_hangar_doors_2.ControlledBy != 1 )
			{		
				//flip the switch
				thread toggle_hangar_2_doors_switch
				
				//Open the hangar doors
				$hangar_doors_2 open $hangar_doors_2_entity
				$hangar_doors_2 playsound hanger_open

				$obj_hangar_doors_2 TakeOver 1

				//Give 2 points for taking objective
				parm.other AddKills 2

				iprintln "The Allies have opened the 2nd Hangar Doors!"				
			}
		}

		//Did anyone win?
		thread Check_End_Match

		//Update team current objectives
		thread set_objectives
	}

end

//----------------------------------------------------------
//Turn on/Shut down the runway lights
//----------------------------------------------------------
toggle_runway_lights:
	
	if( level.bRoundStarted == 1 )
	{
		if( parm.other.dmteam == allies )
		{
			if( $obj_runway_lights.ControlledBy != 1 )
			{
				//Take the objective
				$obj_runway_lights TakeOver 1

				//Give 2 points for taking objective
				parm.other AddKills 2

				iprintln "The Allies have turned on the Runway Lights!"

				//flip the switch
				thread toggle_runway_switch				

				waitthread turn_on_runway_lights

			}
		}
		else if( parm.other.dmteam == axis )
		{		
			if( $obj_runway_lights.ControlledBy != 0 )
			{			
				//Take the objective
				$obj_runway_lights TakeOver 0

				//Give 2 points for taking objective
				parm.other AddKills 2

				iprintln "The Axis have turned off the Runway Lights!"	

				//flip the switch
				thread toggle_runway_switch
				waitthread turn_off_runway_lights

			}
		}

		//Did anyone win?
		thread Check_End_Match

		//Update team current objectives
		thread set_objectives
	}

end

//----------------------------------------------------------
//Initialize the runway lights
//----------------------------------------------------------
init_runway_lights:

	$run_lights_01 hide	
	$run_lights_02 hide	
	$run_lights_03 hide	
	$run_lights_04 hide	
	$run_lights_05 hide	
	$run_lights_06 hide	
	$run_lights_07 hide	
	$run_lights_08 hide	
	$run_lights_09 hide	
	$run_lights_10 hide	
	$run_lights_11 hide	
	$run_lights_12 hide	

end

//----------------------------------------------------------
//Set the teams current objectives
//----------------------------------------------------------
set_objectives:
	
	//First lets do the allies
	if( $obj_hangar_doors_1.ControlledBy == 0 )
	{			
		$obj_hangar_doors_1 SetCurrent 1
	}	
	else if( $obj_runway_lights.ControlledBy == 0 )
	{	
		$obj_runway_lights SetCurrent 1
	}
	else if( $obj_hangar_doors_2.ControlledBy == 0 )
	{
		$obj_hangar_doors_2 SetCurrent 1
	}
	else if( $obj_axis_spawner.ControlledBy == 0 )
	{
		$obj_axis_spawner SetCurrent 1
	}

	//Now the Axis	
	if( $obj_hangar_doors_2.ControlledBy == 1 )
	{
		$obj_hangar_doors_2 SetCurrent 0
	}
	else if( $obj_runway_lights.ControlledBy == 1 )
	{			
		$obj_runway_lights SetCurrent 0
	}
	else if( $obj_hangar_doors_1.ControlledBy == 1 )
	{	
		$obj_hangar_doors_1 SetCurrent 0
	}
	else if( $obj_allied_spawner.ControlledBy == 1 )
	{
		$obj_allied_spawner SetCurrent 0			
	}	

end

//----------------------------------------------------------
//init the spawner bombs
//----------------------------------------------------------
init_spawner_bombs:

	//Allied spawner bomb
	$gmc_bomb thread global/tow_dm.scr::bomb_thinker "axis" maps/obj/MP_Flughafen_TOW.scr::destroy_allied_spawner
	$opel_bomb thread global/tow_dm.scr::bomb_thinker "allies" maps/obj/MP_Flughafen_TOW.scr::destroy_axis_spawner

end


//----------------------------------------------------------
//init the trigger switches
//----------------------------------------------------------
init_switches:

	$hangar_doors_1_switch bind $hangar_doors_1_switch_origin
	$hangar_doors_2_switch bind $hangar_doors_2_switch_origin
	$runway_switch bind $runway_switch_origin

	//make all the switches non solid so as not to injure the player when triggered.
	$hangar_doors_1_switch notsolid
	$hangar_doors_1_switch_origin notsolid
	
	$hangar_doors_2_switch notsolid
	$hangar_doors_2_switch_origin notsolid
	
	$runway_switch notsolid
	$runway_switch_origin notsolid

end

//--------------------------------------------------------------
//Open hangar 1 doors
//--------------------------------------------------------------
toggle_hangar_1_doors_switch:
	
	if( level.hangar1_switch_up == 1 )
	{
		level.hangar1_switch_up = 0
		$hangar_doors_1_switch_origin speed 1.0
		$hangar_doors_1_switch_origin rotatezdownto 180
		$hangar_doors_1_switch_origin waitmove
		$hangar_doors_1_switch_origin playsound switchbox
	}
	else
	{
		level.hangar1_switch_up = 1
		$hangar_doors_1_switch_origin speed 1.0
		$hangar_doors_1_switch_origin rotatezupto 0
		$hangar_doors_1_switch_origin waitmove
		$hangar_doors_1_switch_origin playsound switchbox
	}

end

//--------------------------------------------------------------
//Open hangar 2 doors
//--------------------------------------------------------------
toggle_hangar_2_doors_switch:
	
	if( level.hangar2_switch_up == 1 )
	{
		level.hangar2_switch_up = 0
		$hangar_doors_2_switch_origin speed 1.0
		$hangar_doors_2_switch_origin rotatezdownto 180
		$hangar_doors_2_switch_origin waitmove
		$hangar_doors_2_switch_origin playsound switchbox
	}
	else
	{
		level.hangar2_switch_up = 1
		$hangar_doors_2_switch_origin speed 1.0
		$hangar_doors_2_switch_origin rotatezupto 0
		$hangar_doors_2_switch_origin waitmove
		$hangar_doors_2_switch_origin playsound switchbox
	}

end

//--------------------------------------------------------------
//Turn on Runway Lights
//--------------------------------------------------------------
toggle_runway_switch:
	
	if( level.runway_switch_up == 1 )
	{
		level.runway_switch_up = 0
		$runway_switch_origin speed 1.0
		$runway_switch_origin rotatezdownto 180
		$runway_switch_origin waitmove
		$runway_switch_origin playsound switchbox
	}
	else
	{
		level.runway_switch_up = 1
		$runway_switch_origin speed 1.0
		$runway_switch_origin rotatezupto 0
		$runway_switch_origin waitmove
		$runway_switch_origin playsound switchbox
	}

end

//-----------------------------------------------
// Turn on the runway lights
//-----------------------------------------------
turn_on_runway_lights:

	//Turn on the lights
	$run_lights_01 show
	$run_lights_01 playsound runway_lights_on
	wait .2
	$run_lights_02 show
	$run_lights_02 playsound runway_lights_on
	wait .2
	$run_lights_03 show
	$run_lights_03 playsound runway_lights_on
	wait .2
	$run_lights_04 show
	$run_lights_04 playsound runway_lights_on
	wait .2
	$run_lights_05 show
	$run_lights_05 playsound runway_lights_on
	wait .2
	$run_lights_06 show
	$run_lights_06 playsound runway_lights_on
	wait .2
	$run_lights_07 show
	$run_lights_07 playsound runway_lights_on
	wait .2
	$run_lights_08 show
	$run_lights_08 playsound runway_lights_on
	wait .2
	$run_lights_09 show
	$run_lights_09 playsound runway_lights_on
	wait .2
	$run_lights_10 show
	$run_lights_10 playsound runway_lights_on
	wait .2
	$run_lights_11 show
	$run_lights_11 playsound runway_lights_on
	wait .2
	$run_lights_12 show
	$run_lights_12 playsound runway_lights_on

end

//-----------------------------------------------
// Turn off the runway lights
//-----------------------------------------------
turn_off_runway_lights:

	//Turn off the lights
	$run_lights_01 hide
	$run_lights_01 playsound runway_lights_off
	wait .2
	$run_lights_02 hide
	$run_lights_02 playsound runway_lights_off
	wait .2
	$run_lights_03 hide
	$run_lights_03 playsound runway_lights_off
	wait .2
	$run_lights_04 hide
	$run_lights_04 playsound runway_lights_off
	wait .2
	$run_lights_05 hide
	$run_lights_05 playsound runway_lights_off
	wait .2
	$run_lights_06 hide
	$run_lights_06 playsound runway_lights_off
	wait .2
	$run_lights_07 hide
	$run_lights_07 playsound runway_lights_off
	wait .2
	$run_lights_08 hide
	$run_lights_08 playsound runway_lights_off
	wait .2
	$run_lights_09 hide
	$run_lights_09 playsound runway_lights_off
	wait .2
	$run_lights_10 hide
	$run_lights_10 playsound runway_lights_off
	wait .2
	$run_lights_11 hide
	$run_lights_11 playsound runway_lights_off
	wait .2
	$run_lights_12 hide
	$run_lights_12 playsound runway_lights_off

end

//-----------------------------------------------
// Check for end match condition
//-----------------------------------------------
Check_End_Match:

	local.nAxis		= 0

	//Allied Spawner
	if( $obj_allied_spawner.ControlledBy == 0 )
	{
		local.nAxis++
	}

	//Axis Spawner
	if( $obj_axis_spawner.ControlledBy == 0 )
	{
		local.nAxis++
	}

	//Hangar Doors 1
	if( $obj_hangar_doors_1.ControlledBy == 0 )
	{
		local.nAxis++
	}

	//Hangar Doors 2
	if( $obj_hangar_doors_2.ControlledBy == 0 )
	{
		local.nAxis++
	}
	
	//Runway lights
	if( $obj_runway_lights.ControlledBy == 0 )
	{
		local.nAxis++
	}	

	//Allies first
	if( $obj_runway_lights.ControlledBy == 1 && $obj_hangar_doors_1.ControlledBy == 1 && $obj_hangar_doors_2.ControlledBy == 1 )
	{
		//Only show the movie if the wingame cvar has not been set yet.
		local.winstate = int( getcvar( g_TOW_winstate ) )
		if( local.winstate == 0 )
		{
			setcvar "g_TOW_winstate" "1"

			//ignore the clock
			level ignoreclock 1

			//if there is a bomb ticking stop it.
			waitthread global/tow_dm.scr::StopBomb

			//Allies win do the movie then end the map
			thread AlliesWon
		}
	}
	else if( local.nAxis == level.numObjectives )
	{
		//Only show the movie if the wingame cvar has not been set yet.
		local.winstate = int( getcvar( g_TOW_winstate ) )
		if( local.winstate == 0 )
		{
			setcvar "g_TOW_winstate" "1"
		
			//ignore the clock
			level ignoreclock 1

			//if there is a bomb ticking stop it.
			waitthread global/tow_dm.scr::StopBomb

			//Axis win do their movie and end the map		
			thread AxisWon
		}
	}

end

//-------------------------------------------------------------
// Do the Allied camera stuff
//-------------------------------------------------------------
DoAlliedCamera local.ent:

	local.camera = spawn func_camera origin $cam01.origin angles $cam01.angles

	local.camera fov 100
	local.camera watch local.ent
	local.camera cut
	cuecamera local.camera

end

//-------------------------------------------------------------
//  when allies win, we watch the two planes take off and do a 
//	fly-by passed each other....
//-------------------------------------------------------------
AlliesWon:

	$player nodamage
	$player hide
	freezeplayer

	drawhud 0

	level ignoreclock 1
	
	forcemusic aux2 aux2
	
	local.plane = spawn script_model model vehicles/ho-ix.tik origin $p00.origin angles $p00.angles
	local.plane notsolid
	local.plane thread TakeOff $p00

	thread DoAlliedCamera local.plane
	
	local.plane2 = spawn script_model model vehicles/ho-ix.tik origin $p_00.origin angles $p_00.angles
	local.plane2 waitthread TakeOff $p_00
	
	forcemusic aux3 aux3
	
	teamwin allies

	wait 5

end

//-------------------------------------------------------------
// have the plane take off
//-------------------------------------------------------------
TakeOff local.path:

	self notsolid
	self playsound plane	// todo: more appropriate sound maybe?
	thread RaiseLandingGear
	self followpath local.path
	self waitmove
	self delete

end

//--------------------------------------------------------------
// Raise the landing gear
//--------------------------------------------------------------
RaiseLandingGear:
	
	wait 2

	self anim takeoff

end


//-------------------------------------------------------------
//	Watch the allies run by while the germans shoot at them...
//	much like berlin's ending....
//	open hanger door?
//-------------------------------------------------------------
AxisWon:

	$player nodamage
	$player hide
	freezeplayer

	drawhud 0
	
	forcemusic aux4 aux4

	local.camera = spawn func_camera origin $axiswincam.origin angles $axiswincam.angles

	local.camera cut
	cuecamera local.camera

	waitthread global/ai.scr::spawnset 30 set30
	waitthread global/ai.scr::spawnset 40 set40

	for (local.i=1;local.i<=$set30.size;local.i++)
	{
		$set30[local.i] thread RunAway
	}

	wait 0.75	
	for (local.i=1;local.i<=$set40.size;local.i++)
	{
		$set40[local.i] thread Chase
	}
	
	wait 7

	$cine_hangar_doors close $cine_hangar_doors_entity

	wait 8

	forcemusic aux5 aux5

	teamwin axis

	wait 5

end

//-------------------------------------------------------------
//RunAway dudes running away
//-------------------------------------------------------------
RunAway:
	
	self exec global/disable_ai.scr
	self nodamage
	self runto self.target

end

//-------------------------------------------------------------
// Chase dudes chasing the dudes running away..
//-------------------------------------------------------------
Chase local.target:	
	
	self exec global/disable_ai.scr
	self nodamage	
	self runto self.target

	self thread FireShots $set30[1]

end

//-------------------------------------------------------------
// Fire!
//-------------------------------------------------------------
FireShots local.target:

	self aimat local.target
	
	while ( isAlive self )
	{
		local.rand = randomfloat 0.75
		local.rand += 0.2

		wait local.rand
		self fire
	}

end

//////////////////////////////////////////////////////////////////////
///////////////////////////ViPER STUFF////////////////////////////////
//////////////////////////////////////////////////////////////////////

viperstuff:

$hangar_doors_1_switch bind $hangar_doors_1_switch_origin 
$hangar_doors_2_switch bind $hangar_doors_2_switch_origin 
$runway_switch bind $runway_switch_origin 

//make all the switches non solid so as not to injure the player when triggered. 
$hangar_doors_1_switch notsolid 
$hangar_doors_1_switch_origin notsolid 

$hangar_doors_2_switch notsolid 
$hangar_doors_2_switch_origin notsolid 

$runway_switch notsolid 
$runway_switch_origin notsolid 

local.runwaytrg = spawn trigger_use
local.runwaytrg.origin = ( -259 -1335 522 )
local.runwaytrg setsize ( -20 -20 -20 ) ( 20 20 100 )
local.runwaytrg targetname runwaylighttrg

local.hanger1trg = spawn trigger_use
local.hanger1trg.origin = ( 987 3240 57 )
local.hanger1trg setsize ( -20 -20 -20 ) ( 20 20 100 )
local.hanger1trg targetname hangerdoors1

local.hanger2trg = spawn trigger_use
local.hanger2trg.origin = ( -3615 1087 57 )
local.hanger2trg setsize ( -20 -20 -20 ) ( 20 20 100 )
local.hanger2trg targetname hangerdoors2

thread togglelights
thread openhanger1drs
thread openhanger2drs

end

//////////////////////////////////////////////////////////
//////////////////////RUNWAY LIGHTS///////////////////////
//////////////////////////////////////////////////////////

togglelights:
while(1) 
{ 
// wait for trigger event 
while(1) 
{ 
$runwaylighttrg waittill trigger 
if(parm.other.dmteam == allies || parm.other.dmteam == axis) 
break 
}
	if( level.runway_switch_up == 1 )
	{
	//flip the switch
	thread toggle_runway_switch				
	waitthread turn_on_runway_lights
	iprintln "Runway lights on!"
	}
	else
	{
	//flip the switch
	thread toggle_runway_switch				
	waitthread turn_off_runway_lights
	iprintln "Runway lights off!"
	}
}
end

//////////////////////////////////////////////////////////
////////////////////////Hanger ONE////////////////////////
//////////////////////////////////////////////////////////

openhanger1drs:
while(1) 
{ 
// wait for trigger event 
while(1) 
{ 
$hangerdoors1 waittill trigger 
if(parm.other.dmteam == allies || parm.other.dmteam == axis) 
break 
} 
	if( level.hangar1_switch_up == 1 )
	{
	//flip the switch
	thread toggle_hangar_1_doors_switch				
	$hangar_doors_1 open $hangar_doors_1_entity 
	$hangar_doors_1 playsound hanger_open
	iprintln "Hangar 1 - doors openning!"
	}
	else
	{
	//flip the switch
	thread toggle_hangar_1_doors_switch				
	$hangar_doors_1 close $hangar_doors_1_entity 
	$hangar_doors_1 playsound hanger_close
	iprintln "Hangar 1 - doors closing!"
	}
}
end

//////////////////////////////////////////////////////////
////////////////////////Hanger TWO////////////////////////
//////////////////////////////////////////////////////////

openhanger2drs:
while(1) 
{ 
// wait for trigger event 
while(1) 
{ 
$hangerdoors2 waittill trigger 
if(parm.other.dmteam == allies || parm.other.dmteam == axis)
break 
} 
	if( level.hangar2_switch_up == 1 )
	{
	//flip the switch
	thread toggle_hangar_2_doors_switch				
	$hangar_doors_2 open $hangar_doors_2_entity 
	$hangar_doors_2 playsound hanger_open
	iprintln "Hangar 2 - doors openning!"
	}
	else
	{
	//flip the switch
	thread toggle_hangar_2_doors_switch				
	$hangar_doors_2 close $hangar_doors_2_entity 
	$hangar_doors_2 playsound hanger_close
	iprintln "Hangar 2 - doors closing!"
	}
}
end

Posted: Wed Jul 06, 2005 1:46 pm
by LiquorKraZy
no actually i didn't even try anymore...mind if i try yours out? im assuming thats why you posted it... :wink:

Posted: Wed Jul 06, 2005 6:22 pm
by ViPER
np.

Might want to add a switch to inside the hangars, you can close peeps including yourself in there.

LOL

Posted: Tue Jul 12, 2005 2:32 am
by ViPER
Though what i added here works - The existing TOW does not. I ran the stock script and it didnt work either. I think i grabbed an early version out of the wrong pak.
I will fix.

Posted: Thu Jul 14, 2005 12:56 am
by ViPER
Here it is.. im not sure if previous one works in tow or not, I had renamed my script and i think thats why the tow wasn't working. Any ways this pne works in TOW and TDM and i added some TDM spawns a cool little flashing runway light runner.

edit - there was a change in the new tow script that effected the tdm hangardoor1 thread.. it is fixed.

Code: Select all

// MP_Flughafen_TOW
// Note: For objective function calls TakeOver and SetCurrent the
// teams are as such:
// 0 = Axis
// 1 = Allies
// 2 = Neutral

level.gametype = int( getcvar( g_gametype ) )

if( level.gametype == 2 )
{
///////////////////////////////////////////
///		Allied spawns		///
///////////////////////////////////////////
 local.allied1 = spawn info_player_allied 
 local.allied1.origin = ( 643 3531 32 ) 
 local.allied1.angle = -120
 local.allied2 = spawn info_player_allied 
 local.allied2.origin = ( 1478 1265 88 ) 
 local.allied2.angle = 50
 local.allied3 = spawn info_player_allied 
 local.allied3.origin = ( -1163 2885 -70 ) 
 local.allied3.angle = 0
 local.allied4 = spawn info_player_allied 
 local.allied4.origin = ( -1668 3366 58 ) 
 local.allied4.angle = 180
///////////////////////////////////////////
///		Axis spawns		///
///////////////////////////////////////////
 local.axis1 = spawn info_player_axis 
 local.axis1.origin = ( -2772 876 32 )  
 local.axis1.angle = 120
 local.axis2 = spawn info_player_axis 
 local.axis2.origin = ( -1732 1036 -70 )  
 local.axis2.angle = 90
 local.axis3 = spawn info_player_axis 
 local.axis3.origin = ( -118 -1565 24 )  
 local.axis3.angle = -145
 local.axis4 = spawn info_player_axis 
 local.axis4.origin = ( -1959 847 24 )  
 local.axis4.angle = -70
}

//----------------------------------------------------------
// Main
//----------------------------------------------------------
main:	

	exec global/ai.scr
	exec global/friendly.scr

	level.script="maps/obj/MP_Flughafen_TOW.scr"	
	level.music="MP_Flughafen_TOW"	

	setcvar "g_scoreboardpic" "mp_flughafen_tow" 

	exec global/tow_dm.scr
	exec global/ambient.scr
	exec global/door_locked.scr

	level.gametype = int( getcvar( g_gametype ) )

	//gametype 5 = Tug of War
	if( level.gametype == 5 )
	{
		setcvar "g_obj_alliedtext1" "Protect Allied Transport"
		setcvar "g_obj_alliedtext2" "Open 1st Hangar Doors"
		setcvar "g_obj_alliedtext3" "Turn On the Runway Lights"
		setcvar "g_obj_alliedtext4" "Open the 2nd Hangar Doors"
		setcvar "g_obj_alliedtext5" "Detonate Axis Motorpool"

		setcvar "g_obj_axistext1" "Protect Axis Motorpool"
		setcvar "g_obj_axistext2" "Close the 2nd Hangar Doors"
		setcvar "g_obj_axistext3" "Turn Off the Runway Lights"
		setcvar "g_obj_axistext4" "Close the 1st Hangar Doors"
		setcvar "g_obj_axistext5" "Destroy Allied Transport"
	}
	else
	{
		$gmc_bomb remove
		$opel_bomb remove

		// set scoreboard messages
		setcvar "g_obj_alliedtext1" "Flughafen" 
		setcvar "g_obj_alliedtext2" "TDM"
		setcvar "g_obj_alliedtext3" "MOD"
		setcvar "g_obj_axistext1" "by"
		setcvar "g_obj_axistext2" "ViPER"
		setcvar "g_obj_axistext3" " "
	}

	//set our farplane and culling parameters
	$world farplane 3000
	$world farplane_color ".03 .05 .09"  //this matches eben's new sky
	$world farplane_cull 2
	
	//Viper says leave these closed if not TOW mode...  
	if( level.gametype == 5 )
	{
	//Open the hangar 1 doors
	$hangar_doors_1 open $hangar_doors_1_entity
	}

	// open these doors at the start...
	$cine_hangar_doors open $cine_hangar_doors_entity
	
	//Turn off the lights!
	thread init_runway_lights
	
	//////////////////////////
	level waittill prespawn
	//////////////////////////
	
	//gametype not Tug of War
	if( level.gametype <= 4 )
		{
		thread viperstuff
		}

	//////////////////////////
	level waittill spawn
	//////////////////////////

	//init aagun params
	$aagun.collisionent = $aagun_collision
	$aagun_turret0.collisionent = $aagun_turret_collision
	$aagun thread global/stationaryweapons.scr::MountedStationaryWeaponWithCollision "models/statweapons/p_aagun_d.tik" $aagun_destroyed_collision

   //init granatwefer 1 params

    $granat_1.collisionent = $granatwerfer_collision
    $granat_1_turret0.collisionent = $granatwerfer_turret_collision
    $granat_1 thread global/stationaryweapons.scr::MountedStationaryWeaponWithCollision "models/statweapons/p_granatwerfer_d.tik" $granatwerfer_destroyed_collision
	$granat_1_turret0 maxyawoffset "40"


    //init granatwefer 2 params
    $granat_2.collisionent = $granatwerfer_collision
    $granat_2_turret0.collisionent = $granatwerfer_turret_collision
    $granat_2 thread global/stationaryweapons.scr::MountedStationaryWeaponWithCollision "models/statweapons/p_granatwerfer_d.tik" $granatwerfer_destroyed_collision
	$granat_2_turret0 maxyawoffset "40"

	
	
	// set the parameters for this round based match	
	level.bRoundStarted			= 0
	level.dmrespawning			= 1			// 1 or 0	
	level.clockside				= axis		// set to axis, allies, kills, or draw
	level.dmroundlimit			= 15		// round time limit in minutes
	level.numObjectives			= 5			// Number of objectives needed to win

	level.hangar1_switch_up		= 1
	level.hangar2_switch_up		= 1
	level.runway_switch_up		= 1	

	//////////////////////////
	//level waittill roundstart
	//////////////////////////
	
	//If we are in TOW mode setup the TOW stuff...
	if( level.gametype == 5 )
	{
		thread init_switches
		thread init_spawner_bombs		

		//Flip the hangar switch		
		thread toggle_hangar_1_doors_switch

		//Setup the starting team objectives	
		thread set_objectives
		
		level.bRoundStarted = 1
	}						 
      	if(int(getcvar "nightmod") >= 1)  
		thread nightcheck	
end


//----------------------------------------------------------
//Destroy the Allied spawner here
//----------------------------------------------------------
destroy_allied_spawner:	
	
	iprintln "The Allied transport has been destroyed!"

	//Take over the objective
	$obj_allied_spawner TakeOver 0

	iprintln "The Allied Team can no longer respawn!"

	thread Check_End_Match
	
end

//----------------------------------------------------------
//Destroy the Axis spawner here
//----------------------------------------------------------
destroy_axis_spawner:
	
	iprintln "The Axis Motorpool has been destroyed!"
		
	//Take over the objective
	$obj_axis_spawner TakeOver 1

	iprintln "The Axis Team can no longer respawn!"

	thread Check_End_Match

end

//----------------------------------------------------------
//Open/close the 1st Hangar Doors here
//----------------------------------------------------------
toggle_hangar_doors_1:	
	
	if( level.bRoundStarted == 1 )
	{
		if( parm.other.dmteam == axis )
		{
			if( $obj_hangar_doors_1.ControlledBy != 0 )
			{			
				//flip the switch
				thread toggle_hangar_1_doors_switch

				//Close the hangar doors
				$hangar_doors_1 close $hangar_doors_1_entity
				$hangar_doors_1 playsound hanger_closed

				$obj_hangar_doors_1 TakeOver 0				

				iprintln "The Axis have closed the 1st Hangar Doors!"
			}
		}
		else if( parm.other.dmteam == allies )
		{
			if( $obj_hangar_doors_1.ControlledBy != 1 )
			{		
				//flip the switch
				thread toggle_hangar_1_doors_switch
				
				//Open the pen doors
				$hangar_doors_1 open $hangar_doors_1_entity
				$hangar_doors_1 playsound hanger_open

				$obj_hangar_doors_1 TakeOver 1

				iprintln "The Allies have opened the 1st Hangar Doors!"
			}
		}

		
		//Did anyone win?
		thread Check_End_Match

		//Update team current objectives
		thread set_objectives
	}

end

//----------------------------------------------------------
//Open/close the 2st Hangar Doors here
//----------------------------------------------------------
toggle_hangar_doors_2:	
	
	if( level.bRoundStarted == 1 )
	{
		if( parm.other.dmteam == axis )
		{
			if( $obj_hangar_doors_2.ControlledBy != 0 )
			{			
				//flip the switch
				thread toggle_hangar_2_doors_switch
				
				//Close the hangar doors
				$hangar_doors_2 close $hangar_doors_2_entity
				$hangar_doors_2 playsound hanger_closed

				$obj_hangar_doors_2 TakeOver 0

				iprintln "The Axis have closed the 2nd Hangar Doors!"
			}
		}
		else if( parm.other.dmteam == allies )
		{
			if( $obj_hangar_doors_2.ControlledBy != 1 )
			{		
				//flip the switch
				thread toggle_hangar_2_doors_switch
				
				//Open the hangar doors
				$hangar_doors_2 open $hangar_doors_2_entity
				$hangar_doors_2 playsound hanger_open

				$obj_hangar_doors_2 TakeOver 1

				iprintln "The Allies have opened the 2nd Hangar Doors!"				
			}
		}

		//Did anyone win?
		thread Check_End_Match

		//Update team current objectives
		thread set_objectives
	}

end

//----------------------------------------------------------
//Turn on/Shut down the runway lights
//----------------------------------------------------------
toggle_runway_lights:
	
	if( level.bRoundStarted == 1 )
	{
		if( parm.other.dmteam == allies )
		{
			if( $obj_runway_lights.ControlledBy != 1 )
			{
				//flip the switch
				thread toggle_runway_switch				

				waitthread turn_on_runway_lights

				//Take the objective
				$obj_runway_lights TakeOver 1

				iprintln "The Allies have turned on the Runway Lights!"
			}
		}
		else if( parm.other.dmteam == axis )
		{		
			if( $obj_runway_lights.ControlledBy != 0 )
			{			
				//flip the switch
				thread toggle_runway_switch

				waitthread turn_off_runway_lights

				//Take the objective
				$obj_runway_lights TakeOver 0

				iprintln "The Axis have turned off the Runway Lights!"	
			}
		}

		//Did anyone win?
		thread Check_End_Match

		//Update team current objectives
		thread set_objectives
	}

end

//----------------------------------------------------------
//Initialize the runway lights
//----------------------------------------------------------
init_runway_lights:

	$run_lights_01 hide	
	$run_lights_02 hide	
	$run_lights_03 hide	
	$run_lights_04 hide	
	$run_lights_05 hide	
	$run_lights_06 hide	
	$run_lights_07 hide	
	$run_lights_08 hide	
	$run_lights_09 hide	
	$run_lights_10 hide	
	$run_lights_11 hide	
	$run_lights_12 hide	

end

//----------------------------------------------------------
//Set the teams current objectives
//----------------------------------------------------------
set_objectives:
	
	//First lets do the allies
	if( $obj_hangar_doors_1.ControlledBy == 0 )
	{			
		$obj_hangar_doors_1 SetCurrent 1
	}	
	else if( $obj_runway_lights.ControlledBy == 0 )
	{	
		$obj_runway_lights SetCurrent 1
	}
	else if( $obj_hangar_doors_2.ControlledBy == 0 )
	{
		$obj_hangar_doors_2 SetCurrent 1
	}
	else if( $obj_axis_spawner.ControlledBy == 0 )
	{
		$obj_axis_spawner SetCurrent 1
	}

	//Now the Axis	
	if( $obj_hangar_doors_2.ControlledBy == 1 )
	{
		$obj_hangar_doors_2 SetCurrent 0
	}
	else if( $obj_runway_lights.ControlledBy == 1 )
	{			
		$obj_runway_lights SetCurrent 0
	}
	else if( $obj_hangar_doors_1.ControlledBy == 1 )
	{	
		$obj_hangar_doors_1 SetCurrent 0
	}
	else if( $obj_allied_spawner.ControlledBy == 1 )
	{
		$obj_allied_spawner SetCurrent 0			
	}	

end

//----------------------------------------------------------
//init the spawner bombs
//----------------------------------------------------------
init_spawner_bombs:

	//Allied spawner bomb
	$gmc_bomb thread global/tow_dm.scr::bomb_thinker "axis" maps/obj/MP_Flughafen_TOW.scr::destroy_allied_spawner
	$opel_bomb thread global/tow_dm.scr::bomb_thinker "allies" maps/obj/MP_Flughafen_TOW.scr::destroy_axis_spawner

end


//----------------------------------------------------------
//init the trigger switches
//----------------------------------------------------------
init_switches:

	$hangar_doors_1_switch bind $hangar_doors_1_switch_origin
	$hangar_doors_2_switch bind $hangar_doors_2_switch_origin
	$runway_switch bind $runway_switch_origin

	//make all the switches non solid so as not to injure the player when triggered.
	$hangar_doors_1_switch notsolid
	$hangar_doors_1_switch_origin notsolid
	
	$hangar_doors_2_switch notsolid
	$hangar_doors_2_switch_origin notsolid
	
	$runway_switch notsolid
	$runway_switch_origin notsolid

end

//--------------------------------------------------------------
//Open hangar 1 doors
//--------------------------------------------------------------
toggle_hangar_1_doors_switch:
	
	if( level.hangar1_switch_up == 1 )
	{
		$hangar_doors_1_switch_origin speed 1.0
		$hangar_doors_1_switch_origin rotatezdownto 180
		$hangar_doors_1_switch_origin waitmove
		$hangar_doors_1_switch_origin playsound switchbox
		level.hangar1_switch_up = 0
	}
	else
	{
		$hangar_doors_1_switch_origin speed 1.0
		$hangar_doors_1_switch_origin rotatezupto 0
		$hangar_doors_1_switch_origin waitmove
		$hangar_doors_1_switch_origin playsound switchbox
		level.hangar1_swith_up = 1
	}

end

//--------------------------------------------------------------
//Open hangar 2 doors
//--------------------------------------------------------------
toggle_hangar_2_doors_switch:
	
	if( level.hangar2_switch_up == 1 )
	{
		$hangar_doors_2_switch_origin speed 1.0
		$hangar_doors_2_switch_origin rotatezdownto 180
		$hangar_doors_2_switch_origin waitmove
		$hangar_doors_2_switch_origin playsound switchbox
		level.hangar2_switch_up = 0
	}
	else
	{
		$hangar_doors_2_switch_origin speed 1.0
		$hangar_doors_2_switch_origin rotatezupto 0
		$hangar_doors_2_switch_origin waitmove
		$hangar_doors_2_switch_origin playsound switchbox
		level.hangar2_switch_up = 1
	}

end

//--------------------------------------------------------------
//Turn on Runway Lights
//--------------------------------------------------------------
toggle_runway_switch:
	
	if( level.runway_switch_up == 1 )
	{
		$runway_switch_origin speed 1.0
		$runway_switch_origin rotatezdownto 180
		$runway_switch_origin waitmove
		$runway_switch_origin playsound switchbox
		level.runway_switch_up = 0
	}
	else
	{
		$runway_switch_origin speed 1.0
		$runway_switch_origin rotatezupto 0
		$runway_switch_origin waitmove
		$runway_switch_origin playsound switchbox
		level.runway_switch_up = 1
	}

end

//-----------------------------------------------
// Turn off the runway lights
//-----------------------------------------------
turn_on_runway_lights:

	//Turn on the lights
	$run_lights_01 show
	$run_lights_01 playsound runway_lights_on
	wait .2
	$run_lights_02 show
	$run_lights_02 playsound runway_lights_on
	wait .2
	$run_lights_03 show
	$run_lights_03 playsound runway_lights_on
	wait .2
	$run_lights_04 show
	$run_lights_04 playsound runway_lights_on
	wait .2
	$run_lights_05 show
	$run_lights_05 playsound runway_lights_on
	wait .2
	$run_lights_06 show
	$run_lights_06 playsound runway_lights_on
	wait .2
	$run_lights_07 show
	$run_lights_07 playsound runway_lights_on
	wait .2
	$run_lights_08 show
	$run_lights_08 playsound runway_lights_on
	wait .2
	$run_lights_09 show
	$run_lights_09 playsound runway_lights_on
	wait .2
	$run_lights_10 show
	$run_lights_10 playsound runway_lights_on
	wait .2
	$run_lights_11 show
	$run_lights_11 playsound runway_lights_on
	wait .2
	$run_lights_12 show
	$run_lights_12 playsound runway_lights_on

end

//-----------------------------------------------
// Turn off the runway lights
//-----------------------------------------------
turn_off_runway_lights:

	//Turn off the lights
	$run_lights_01 hide
	$run_lights_01 playsound runway_lights_off
	wait .2
	$run_lights_02 hide
	$run_lights_02 playsound runway_lights_off
	wait .2
	$run_lights_03 hide
	$run_lights_03 playsound runway_lights_off
	wait .2
	$run_lights_04 hide
	$run_lights_04 playsound runway_lights_off
	wait .2
	$run_lights_05 hide
	$run_lights_05 playsound runway_lights_off
	wait .2
	$run_lights_06 hide
	$run_lights_06 playsound runway_lights_off
	wait .2
	$run_lights_07 hide
	$run_lights_07 playsound runway_lights_off
	wait .2
	$run_lights_08 hide
	$run_lights_08 playsound runway_lights_off
	wait .2
	$run_lights_09 hide
	$run_lights_09 playsound runway_lights_off
	wait .2
	$run_lights_10 hide
	$run_lights_10 playsound runway_lights_off
	wait .2
	$run_lights_11 hide
	$run_lights_11 playsound runway_lights_off
	wait .2
	$run_lights_12 hide
	$run_lights_12 playsound runway_lights_off

end

//-----------------------------------------------
// Check for end match condition
//-----------------------------------------------
Check_End_Match:

	local.nAxis		= 0

	//Allied Spawner
	if( $obj_allied_spawner.ControlledBy == 0 )
	{
		local.nAxis++
	}

	//Axis Spawner
	if( $obj_axis_spawner.ControlledBy == 0 )
	{
		local.nAxis++
	}

	//Hangar Doors 1
	if( $obj_hangar_doors_1.ControlledBy == 0 )
	{
		local.nAxis++
	}

	//Hangar Doors 2
	if( $obj_hangar_doors_2.ControlledBy == 0 )
	{
		local.nAxis++
	}
	
	//Runway lights
	if( $obj_runway_lights.ControlledBy == 0 )
	{
		local.nAxis++
	}	

	//Allies first
	if( $obj_runway_lights.ControlledBy == 1 && $obj_hangar_doors_1.ControlledBy == 1 && $obj_hangar_doors_2.ControlledBy == 1 )
	{
		//ignore the clock
		level ignoreclock 1

		//if there is a bomb ticking stop it.
		waitthread global/tow_dm.scr::StopBomb

		//Allies win do the movie then end the map
		thread AlliesWon
	}
	else if( local.nAxis == level.numObjectives )
	{
		//ignore the clock
		level ignoreclock 1

		//if there is a bomb ticking stop it.
		waitthread global/tow_dm.scr::StopBomb

		//Axis win do their movie and end the map		
		thread AxisWon
	}

end

//-------------------------------------------------------------
// Do the Allied camera stuff
//-------------------------------------------------------------
DoAlliedCamera local.ent:

	local.camera = spawn func_camera origin $cam01.origin angles $cam01.angles

	local.camera fov 100
	local.camera watch local.ent
	local.camera cut
	cuecamera local.camera

end

//-------------------------------------------------------------
//  when allies win, we watch the two planes take off and do a 
//	fly-by passed each other....
//-------------------------------------------------------------
AlliesWon:

	$player nodamage
	$player hide
	freezeplayer

	level ignoreclock 1
	
	forcemusic aux2 aux2
	
	local.plane = spawn script_model model vehicles/ho-ix.tik origin $p00.origin angles $p00.angles
	local.plane notsolid
	local.plane thread TakeOff $p00

	thread DoAlliedCamera local.plane
	
	local.plane2 = spawn script_model model vehicles/ho-ix.tik origin $p_00.origin angles $p_00.angles
	local.plane2 waitthread TakeOff $p_00
	
	forcemusic aux3 aux3
	
	teamwin allies

	wait 5

end

//-------------------------------------------------------------
// have the plane take off
//-------------------------------------------------------------
TakeOff local.path:

	self notsolid
	self playsound plane	// todo: more appropriate sound maybe?
	thread RaiseLandingGear
	self followpath local.path
	self waitmove
	self delete

end

//--------------------------------------------------------------
// Raise the landing gear
//--------------------------------------------------------------
RaiseLandingGear:
	wait 2

	self anim takeoff
	

end


//-------------------------------------------------------------
//	Watch the allies run by while the germans shoot at them...
//	much like berlin's ending....
//	open hanger door?
//-------------------------------------------------------------
AxisWon:

	$player nodamage
	$player hide
	freezeplayer
	
	forcemusic aux4 aux4

	local.camera = spawn func_camera origin $axiswincam.origin angles $axiswincam.angles

	local.camera cut
	cuecamera local.camera

	waitthread global/ai.scr::spawnset 30 set30
	waitthread global/ai.scr::spawnset 40 set40

	for (local.i=1;local.i<=$set30.size;local.i++)
	{
		$set30[local.i] thread RunAway
	}

	wait 0.75	
	for (local.i=1;local.i<=$set40.size;local.i++)
	{
		$set40[local.i] thread Chase
	}
	
	wait 7

	$cine_hangar_doors close $cine_hangar_doors_entity

	wait 8

	forcemusic aux5 aux5

	teamwin axis

	wait 5

end

//-------------------------------------------------------------
//RunAway dudes running away
//-------------------------------------------------------------
RunAway:
	
	self exec global/disable_ai.scr
	self nodamage
	self runto self.target

end

//-------------------------------------------------------------
// Chase dudes chasing the dudes running away..
//-------------------------------------------------------------
Chase local.target:	
	
	self exec global/disable_ai.scr
	self nodamage	
	self runto self.target

	self thread FireShots $set30[1]

end

//-------------------------------------------------------------
// Fire!
//-------------------------------------------------------------
FireShots local.target:

	self aimat local.target
	
	while ( isAlive self )
	{
		local.rand = randomfloat 0.75
		local.rand += 0.2

		wait local.rand
		self fire
	}

end

//////////////////////////////////////////////////////////////////////
///////////////////////////ViPER STUFF////////////////////////////////
//////////////////////////////////////////////////////////////////////

viperstuff:

$hangar_doors_1_switch bind $hangar_doors_1_switch_origin 
$hangar_doors_2_switch bind $hangar_doors_2_switch_origin 
$runway_switch bind $runway_switch_origin 

//make all the switches non solid so as not to injure the player when triggered. 
$hangar_doors_1_switch notsolid 
$hangar_doors_1_switch_origin notsolid 

$hangar_doors_2_switch notsolid 
$hangar_doors_2_switch_origin notsolid 

$runway_switch notsolid 
$runway_switch_origin notsolid 

local.runwaytrg = spawn trigger_use
local.runwaytrg.origin = ( -259 -1335 522 )
local.runwaytrg setsize ( -20 -20 -20 ) ( 20 20 100 )
local.runwaytrg targetname runwaylighttrg

local.hanger1trg = spawn trigger_use
local.hanger1trg.origin = ( 987 3240 57 )
local.hanger1trg setsize ( -250 -20 -20 ) ( 20 20 100 )
local.hanger1trg targetname hangerdoors1

local.hanger2trg = spawn trigger_use
local.hanger2trg.origin = ( -3615 1087 57 )
local.hanger2trg setsize ( -20 -20 -20 ) ( 250 20 100 )
local.hanger2trg targetname hangerdoors2

thread togglelights
thread openhanger1drs
thread openhanger2drs
thread otherstuff

end

otherstuff:
	local.static = spawn script_model
	local.static model "static/switch1.tik"
	local.static.origin = ( 755 3242 66 ) 
	local.static.angles = ( 20 180 0 )

	local.static = spawn script_model
	local.static model "static/switch1.tik"
	local.static.origin = ( -3379 1108 66 ) 
	local.static.angles = ( 20 0 0 )
end

//////////////////////////////////////////////////////////
//////////////////////RUNWAY LIGHTS///////////////////////
//////////////////////////////////////////////////////////

togglelights:
while(1) 
{ 
// wait for trigger event 
while(1) 
{ 
$runwaylighttrg waittill trigger 
if(parm.other.dmteam == allies || parm.other.dmteam == axis) 
break 
}
	if( level.runway_switch_up == 1 )
	{
	//flip the switch
	thread toggle_runway_switch				
	waitthread turn_on_runway_lights
	iprintln "Runway lights on!"
	thread lights
	}
	else
	{
	//flip the switch
	thread toggle_runway_switch				
	//waitthread turn_off_runway_lights
	iprintln "Runway lights off!"
	}
}
end

//////////////////////////////////////////////////////////
////////////////////////Hanger ONE////////////////////////
//////////////////////////////////////////////////////////

openhanger1drs:
while(1) 
{ 
// wait for trigger event 
while(1) 
{ 
$hangerdoors1 waittill trigger 
if(parm.other.dmteam == allies || parm.other.dmteam == axis) 
break 
} 
	if( level.hangar1_switch_up == 1 )
	{
	//flip the switch
	thread toggle_hangar_1_doors_switch				
	$hangar_doors_1 open $hangar_doors_1_entity 
	$hangar_doors_1 playsound hanger_open
	iprintln "Hangar 1 - doors opening!"
                level.hangar1_switch_up = 0
	}
	else
	{
	//flip the switch
	thread toggle_hangar_1_doors_switch		
	$hangar_doors_1 close $hangar_doors_1_entity 
	$hangar_doors_1 playsound hanger_close
	iprintln "Hangar 1 - doors closing!"
                level.hangar1_switch_up = 1
	}
}
end

//////////////////////////////////////////////////////////
////////////////////////Hanger TWO////////////////////////
//////////////////////////////////////////////////////////

openhanger2drs:
while(1) 
{ 
// wait for trigger event 
while(1) 
{ 
$hangerdoors2 waittill trigger 
if(parm.other.dmteam == allies || parm.other.dmteam == axis)
break 
} 
	if( level.hangar2_switch_up == 1 )
	{
	//flip the switch
	thread toggle_hangar_2_doors_switch		
	$hangar_doors_2 open $hangar_doors_2_entity 
	$hangar_doors_2 playsound hanger_open
	iprintln "Hangar 2 - doors opening!"
	}
	else
	{
	//flip the switch
	thread toggle_hangar_2_doors_switch		
	$hangar_doors_2 close $hangar_doors_2_entity 
	$hangar_doors_2 playsound hanger_close
	iprintln "Hangar 2 - doors closing!"
	}
}
end

lights:

while(1)
{ 
//Turn off the lights
wait 2 
$run_lights_01 hide 
wait .1 
$run_lights_02 hide 
wait .1 
$run_lights_03 hide 
wait .1 
$run_lights_04 hide 
wait .1 
$run_lights_05 hide 
wait .1 
$run_lights_06 hide 
wait .1 
$run_lights_07 hide 
wait .1 
$run_lights_08 hide 
wait .1 
$run_lights_09 hide 
wait .1 
$run_lights_10 hide  
wait .1 
$run_lights_11 hide 
wait .1 
$run_lights_12 hide 
wait .1
if( level.runway_switch_up == 1 )
break
//Turn on the lights 
$run_lights_01 show 
wait .1 
$run_lights_02 show 
wait .1 
$run_lights_03 show 
wait .1 
$run_lights_04 show 
wait .1 
$run_lights_05 show  
wait .1 
$run_lights_06 show  
wait .1 
$run_lights_07 show 
wait .1 
$run_lights_08 show 
wait .1 
$run_lights_09 show 
wait .1 
$run_lights_10 show 
wait .1 
$run_lights_11 show 
wait .1 
$run_lights_12 show 
} 

end