Page 1 of 2

Runway Lights?:

Posted: Tue Nov 16, 2004 11:56 pm
by PacMan
Hello all,

1. I have gotten the runway lights in the map "Flughafen" to turn on and off in sequence by itself using this script:

thread lights

lights:

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

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

goto lights

end

2. The problem that I am having is that It works on the first round of a "roundbased" match for map "MP_Flughafe_TOW", but when another round or any other round after the first "intitial" round starts, only 4 lights stay on completely and the rest stays off. Is there a way I can fix this issue?

Thank you in advance for any help..

Posted: Wed Nov 17, 2004 2:41 am
by strafer
I didn't notice anything wrong, but that might be because I'm stupid. :lol:

Anyway, try making it a while loop instead of a goto command.

Code: Select all

lights: 

while(1)
{
//Turn on the lights 
$run_lights_01 show 
$run_lights_01 playsound runway_lights_on 
wait 1 
$run_lights_02 show 
$run_lights_02 playsound runway_lights_on 
wait 1 
$run_lights_03 show 
$run_lights_03 playsound runway_lights_on 
wait 1 
$run_lights_04 show 
$run_lights_04 playsound runway_lights_on 
wait 1 
$run_lights_05 show 
$run_lights_05 playsound runway_lights_on 
wait 1 
$run_lights_06 show 
$run_lights_06 playsound runway_lights_on 
wait 1 
$run_lights_07 show 
$run_lights_07 playsound runway_lights_on 
wait 1 
$run_lights_08 show 
$run_lights_08 playsound runway_lights_on 
wait 1 
$run_lights_09 show 
$run_lights_09 playsound runway_lights_on 
wait 1 
$run_lights_10 show 
$run_lights_10 playsound runway_lights_on 
wait 1 
$run_lights_11 show 
$run_lights_11 playsound runway_lights_on 
wait 1 
$run_lights_12 show 
$run_lights_12 playsound runway_lights_on 

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

}

end

Hmmm:

Posted: Wed Nov 17, 2004 2:53 am
by PacMan
1. Well I tried it "looped"...now this time, i get all the lights on after a new round begins....it still worked the first round, but after that it just stays lit..Any ideas..I really do appreciate your help..

2. I know this can be fixed...its just a matter of getting the proper script inline or I might be missing something ....dunno ..perhaps more opinions still awaits...

Re: Hmmm:

Posted: Wed Nov 17, 2004 3:24 am
by strafer
PacMan wrote:1. Well I tried it "looped"...now this time, i get all the lights on after a new round begins....it still worked the first round, but after that it just stays lit..Any ideas..I really do appreciate your help..

2. I know this can be fixed...its just a matter of getting the proper script inline or I might be missing something ....dunno ..perhaps more opinions still awaits...
Are you trying to have them light up, then in (say about 5 seconds) turn off? If so, try using the wait command. Just do wait 5. Otherwise, I don't fully understand what you are saying.

ahh:

Posted: Wed Nov 17, 2004 3:31 am
by PacMan
What I meant was that....it still worked for the first round..the lights came on in sequence and turned off in sequence..I have a "wait 1" for each row of lights. The problem is that when the first rounds ends and another round starts, the lights just stay on this time...I hear the sounds of it turning on and off in sequence but nothing else happens.

Posted: Wed Nov 17, 2004 8:57 am
by jv_map
Did you put 'thread lights' below level waittill roundstart?

Hmmmmmmmmmmm:

Posted: Wed Nov 17, 2004 5:03 pm
by PacMan
1. Do you mean something like this:

roundbasedthread:

// Can specify different scoreboard messages for round based games here.

level waitTill prespawn

level waittill spawn

// set the parameters for this round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 20 // round time limit in minutes
level.clockside = kills // set to axis, allies, kills, or draw

level waittill roundstart

thread lights

end

2. ?

Posted: Wed Nov 17, 2004 5:05 pm
by jv_map
Oh I was assuming this was an obj map... if it's dm just place it below level waittill spawn :)

Hmmm

Posted: Wed Nov 17, 2004 7:12 pm
by PacMan
1. The map Flughafen is being made into a "Demoltion" type game..which would be roundbased....I am making some changes by having the runway lights go on and off in a sequence...it works during the first start of the game...but when a new round is added, it stops working..I was wandering if I need to put a command script to make it restart when a new round begins..

2. Thanks for your replies...

Posted: Wed Nov 17, 2004 8:30 pm
by Bjarne BZR
The lights: method code looks totally OK... so there may be sme problem in calling it. Could you post the entire script?

Well..it is big...but maybe there is a conflict:

Posted: Wed Nov 17, 2004 9:06 pm
by PacMan
1. Here you go:

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

// **********************************************************************
// Extended-Gametype Mapscript Version 1.1.1 (08-15-04)
// By Mark Follett (Mefy)
// email: mef123@geocities.com
// web: www.planetmedalofhonor.com/mefy
// You are free to modify and redistribute as long as you keep these
// credits.
// **********************************************************************
// Credits to Kaotik for CTF base positions

//----------------------------------------------------------
// Main
//----------------------------------------------------------
main:
	// set scoreboard messages
	setcvar "g_obj_alliedtext1" "Flughafen" 
	setcvar "g_obj_alliedtext2" ""
	setcvar "g_obj_alliedtext3" ""
	setcvar "g_obj_axistext1" ""
	setcvar "g_obj_axistext2" ""
	setcvar "g_obj_axistext3" ""

	setcvar "g_scoreboardpic" "textures/mohmenu/credits/i_ho-ix.jpg" 

	level.mef_mapname = "mp_flughafen_tow"
	level.mef_maptype = "dm"
	level.mef_supportedgametypes = "ffa"::"tdm"::"rbm"::"tow"::"ft"::"ctf"::"ftctf"::"fttow"::"dem"::"ftdem"
	level.mef_defaultgametype = "dem"

	switch (waitthread global/libmef/util.scr::get_gametype)
	{
		case "ctf":
		case "ftctf":
			// CTF Base positions by Kaotik
			waitthread global/libmef/bases.scr::addbasepair "3104.87 3101.83 -23.88 180 North Wall" "-2966.4 80.87 -23.88 -90 Rear Of E Hangar"
			waitthread global/libmef/bases.scr::addbasepair "-334.13 3920.46 -23.88 180 S Side W Hangar" "544.87 -800.82 -23.88 180 N Control Tower"
			thread global/libmef/ctf.scr::ctf_begin
			break

		case "ft":
			thread global/libmef/ft.scr::ft_begin
			break

            case "dem":
		case "ftdem":
                  //exec maps/mapfix/MP_Flughafen_TOW.scr    
                  thread fix1
                  thread lights          
			level.mef_settings["respawn"] = 1
			level.mef_settings["ticktime"] = 60
                  waitthread setup_bases
			thread global/libmef/dem.scr::dem_begin
			break

		case "rbm":
			thread roundbasedthread
			break

		case "tow":
			thread towthread
			break

		case "fttow":
			thread global/libmef/ft.scr::ft_begin
			thread towthread
			break
	}

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

	exec global/ambient.scr m5l1b
	exec global/door_locked.scr

	if (level.mef_gametype != "tow" && level.mef_gametype != "fttow")
	{
		//remove all ai
		$enemyspawner remove

		$gmc_bomb remove
		$opel_bomb remove
	}

	//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

	//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

	//init aagun params
	$aagun.collisionent = $aagun_collision
	$aagun_turret0.collisionent = $aagun_turret_collision
	if (!level.mef_removeturrets)
	{
		$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
	if (!level.mef_removeturrets)
	{
		$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
	if (!level.mef_removeturrets)
	{
		$granat_2 thread global/stationaryweapons.scr::MountedStationaryWeaponWithCollision "models/statweapons/p_granatwerfer_d.tik" $granatwerfer_destroyed_collision
	}
	$granat_2_turret0 maxyawoffset "40"
end

//-----------------------------------------------------------------------------------------------

fix1:

$plane1 delete
$plane2 delete
$obj_runway_lights delete
$t1 delete
$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	
//$runway_switch_origin delete
//$hangar_doors_2_entity delete
//$hangar_doors_1 delete
//$hangar_doors_2 delete
//$obj_hangar_doors_1 delete
//$obj_hangar_doors_2 delete
//$cine_hangar_doors delete
//$cine_hangar_doors open delete
//$cine_hangar_doors_entity delete

end

//--------------------------------------------------------------------- 

lights: 

while(1) 
{ 
//Turn on the lights 
$run_lights_01 show 
$run_lights_01 playsound runway_lights_on 
wait 1 
$run_lights_02 show 
$run_lights_02 playsound runway_lights_on 
wait 1 
$run_lights_03 show 
$run_lights_03 playsound runway_lights_on 
wait 1 
$run_lights_04 show 
$run_lights_04 playsound runway_lights_on 
wait 1 
$run_lights_05 show 
$run_lights_05 playsound runway_lights_on 
wait 1 
$run_lights_06 show 
$run_lights_06 playsound runway_lights_on 
wait 1 
$run_lights_07 show 
$run_lights_07 playsound runway_lights_on 
wait 1 
$run_lights_08 show 
$run_lights_08 playsound runway_lights_on 
wait 1 
$run_lights_09 show 
$run_lights_09 playsound runway_lights_on 
wait 1 
$run_lights_10 show 
$run_lights_10 playsound runway_lights_on 
wait 1 
$run_lights_11 show 
$run_lights_11 playsound runway_lights_on 
wait 1 
$run_lights_12 show 
$run_lights_12 playsound runway_lights_on 

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

} 

end 

//--------------------------------------------------------------------- 

roundbasedthread:

	// Can specify different scoreboard messages for round based games here.

	level waitTill prespawn

	level waittill spawn

	// set the parameters for this round based match
	level.dmrespawning = 0 // 1 or 0
	level.dmroundlimit = 5 // round time limit in minutes
	level.clockside = kills // set to axis, allies, kills, or draw

	level waittill roundstart

end

//-----------------------------------------------------------------------------------------------

setup_bases:
	// common bases for dem and ctf
      waitthread global/libmef/bases.scr::addbasepair "380 3684 -15 -90 Allies Hangar Suprise #1" "-2912 698 -15 90 Axis Hangar Suprise #1" fockwulf stuka

 end

//-----------------------------------------------------------------------------------------------

towthread:	
	exec global/ai.scr
	exec global/friendly.scr
	exec global/tow_dm.scr

	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"
	
	//////////////////////////
	level waittill prespawn
	//////////////////////////
	
	waitthread global/libmef/tow.scr::copy_towobjective $obj_allied_spawner 1 5 1
	waitthread global/libmef/tow.scr::copy_towobjective $obj_axis_spawner 5 1 5

	//////////////////////////
	level waittill spawn
	//////////////////////////	
	
	// 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	

	//////////////////////////
	if (!level.mef_devmode)
	{
		level waittill roundstart
	}
	//////////////////////////
	
	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
	waitthread global/libmef/tow.scr::spawner_destroyed allies

	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
	waitthread global/libmef/tow.scr::spawner_destroyed axis

	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 (parm.other.mef_spectator)
	{
		end
	}
	
	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				
				waitthread global/libmef/tow.scr::objective_captured axis

				//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
				waitthread global/libmef/tow.scr::objective_captured allies

				//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 (parm.other.mef_spectator)
	{
		end
	}
	
	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
				waitthread global/libmef/tow.scr::objective_captured axis

				//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
				waitthread global/libmef/tow.scr::objective_captured allies

				//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 (parm.other.mef_spectator)
	{
		end
	}
	
	if( level.bRoundStarted == 1 )
	{
		if( parm.other.dmteam == allies )
		{
			if( $obj_runway_lights.ControlledBy != 1 )
			{
				//Take the objective
				$obj_runway_lights TakeOver 1
				waitthread global/libmef/tow.scr::objective_captured allies

				//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
				waitthread global/libmef/tow.scr::objective_captured axis

				//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/libmef/bomb.scr::tow_bomb_thinker "axis" maps/obj/MP_Flughafen_TOW.scr::destroy_allied_spawner
	$opel_bomb thread global/libmef/bomb.scr::tow_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 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 )
	{
		//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
			level.mef_gameover = 1

			//if there is a bomb ticking stop it.
			waitthread global/libmef/bomb.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
			level.mef_gameover = 1

			//if there is a bomb ticking stop it.
			waitthread global/libmef/bomb.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.mef_hidehud = 1

	level ignoreclock 1
	level.mef_gameover = 1
	
	// FIX BEFORE RELEASE: delete the following comment before release
	// added by JP to so vote can be held to end the oppression of the cinematic
	// See why we need to delete that? :-), what are you doing reading this anyway
	level.cinematic = getcvar(g_cinematics_off)
	
	if(level.cinematic == "1")
	{
		freezeplayer
		waitthread global/libmef/util.scr::do_teamwin allies
		end
	}

	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
	
	waitthread global/libmef/util.scr::do_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
	
	// added by JP to so vote can be held to end the oppression of the cinematic
	level.cinematic = getcvar(g_cinematics_off)
	
	if(level.cinematic == "1")
	{
		freezeplayer
		waitthread global/libmef/util.scr::do_teamwin axis
		end
	}
	drawhud 0
	level.mef_hidehud = 1
	
	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

	waitthread global/libmef/util.scr::do_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

//-----------------------------------------------------------------------------
2. Hopefully theres a solution....

Posted: Wed Nov 17, 2004 9:27 pm
by Bjarne BZR
:shock: 1092 lines... :shock: :shock:

Well, I had a quick look through it, and couldent find any obvious errors ( but in such a code mass its hard to keep sharp :? )

Have you had a proper look in the consol? Using the logfile 1 command? Errors written early will sometimes be pushed out of the buffer before you get a chance to read it in the game.... especially when using an utterly humongus script like this ;)

interesting:

Posted: Wed Nov 17, 2004 9:34 pm
by PacMan
1. where would i put that command..can u give me an example?

2. Just as a reminder, its just that when a new round starts, the lights remain lit. I do know that when once the server is launched and the "First" round starts, the lights work perfectly, then when I destroy an "item' and the rounds ends (which is normal for demolition mode), and a new round starts, just the lights and only the lights do not work..I am wandering, is there a command i can put in it to reset the lights at the beginning of every round?

Posted: Wed Nov 17, 2004 10:01 pm
by Green Beret
im one of the noobs but,i see were u call for thread lights.
after lights on script i think u have to call for the thread to turn of fthe lights
thread init_runway_lights ,followed by an end

then the scripting for lights off????
does that sound close

remeber im a NOOOB!! :lol:

hMmm:

Posted: Wed Nov 17, 2004 10:11 pm
by PacMan
1. if you were to copy the script and place it into a template "MP_Flughafen_TOW.scr " file, have another person get on the server and play one round, you will see how the lights work on the first round, but when the next round starts, the lights do not work anymore..

2. If i had a way to upload the file so that everyone can assists, please let me know how I can go abouts with that....