TOW>TDM---Flughafen
Posted: Sat Mar 26, 2005 4:15 am
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!
// 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