439 lines
9.9 KiB
Text
439 lines
9.9 KiB
Text
// Tutorial_TOW
|
|
//
|
|
// Note: For objective function calls TakeOver and SetCurrent the
|
|
// teams are as such:
|
|
// 0 = Axis
|
|
// 1 = Allies
|
|
// 2 = Neutral
|
|
|
|
//----------------------------------------------------------
|
|
// Main
|
|
//----------------------------------------------------------
|
|
main:
|
|
|
|
level.script="maps/obj/MP_Tutorial_TOW.scr"
|
|
exec global/tow_dm.scr
|
|
|
|
level.gametype = int( getcvar( g_gametype ) )
|
|
|
|
//gametype 5 = Tug of War
|
|
if( level.gametype == 5 )
|
|
{
|
|
setcvar "g_obj_alliedtext1" "Protect Spawn Point"
|
|
setcvar "g_obj_alliedtext2" "Control Switch 1"
|
|
setcvar "g_obj_alliedtext3" "Control Switch 2"
|
|
setcvar "g_obj_alliedtext4" "Control Switch 3"
|
|
setcvar "g_obj_alliedtext5" "Detonate Axis Spawn Point"
|
|
|
|
setcvar "g_obj_axistext1" "Protect Spawn Point"
|
|
setcvar "g_obj_axistext2" "Control Switch 1"
|
|
setcvar "g_obj_axistext3" "Control Switch 2"
|
|
setcvar "g_obj_axistext4" "Control Switch 3"
|
|
setcvar "g_obj_axistext5" "Destroy Allied Spawn Point"
|
|
}
|
|
else
|
|
{
|
|
//Not a TOW game remove the bombs
|
|
$allie_bomb remove
|
|
$axis_bomb remove
|
|
|
|
|
|
// set scoreboard messages
|
|
setcvar "g_obj_alliedtext1" "Tow Tutorial"
|
|
setcvar "g_obj_alliedtext2" ""
|
|
setcvar "g_obj_alliedtext3" ""
|
|
setcvar "g_obj_axistext1" ""
|
|
setcvar "g_obj_axistext2" ""
|
|
setcvar "g_obj_axistext3" ""
|
|
|
|
}
|
|
|
|
//////////////////////////
|
|
level waittill prespawn
|
|
//////////////////////////
|
|
|
|
|
|
//////////////////////////
|
|
level waittill spawn
|
|
//////////////////////////
|
|
|
|
level.bRoundStarted = 0
|
|
|
|
// level.bswitch1SwitchUp = 1
|
|
// level.bswitch2SwitchUp = 1
|
|
// level.bswitch3SwitchUp = 1
|
|
level.axisFire = 1
|
|
|
|
// set the parameters for this round based match
|
|
level.dmrespawning = 1 // 1 or 0
|
|
level.dmroundlimit = 15 // round time limit in minutes
|
|
level.clockside = draw // set to axis, allies, kills, or draw
|
|
level.numObjectives = 5 // Number of objectives needed to win
|
|
level.numAxisObjectives = 0 // Number of objectives taken by the axis
|
|
level.numAlliedObjectives = 0 // Number of objectives taken by the allies
|
|
|
|
|
|
//////////////////////////
|
|
// level waittill roundstart
|
|
//////////////////////////
|
|
|
|
//If this is a tug of war game then we init all the TOW stuff
|
|
if( level.gametype == 5 )
|
|
{
|
|
//init the objectives
|
|
thread init_objectives
|
|
|
|
thread init_spawner_bombs
|
|
thread init_switch_lights
|
|
|
|
//Setup the starting team objectives
|
|
thread set_objectives
|
|
|
|
level.bRoundStarted = 1
|
|
}
|
|
|
|
|
|
end
|
|
|
|
|
|
//----------------------------------------------------------
|
|
//Destroy the allied spawner here
|
|
//----------------------------------------------------------
|
|
alliesspawnpoint:
|
|
|
|
iprintln "The Allied Spawn Point has been Destroyed!"
|
|
|
|
//Take over the objective
|
|
$Obj_alliespawnpoint TakeOver 0
|
|
level.numAxisObjectives++
|
|
level.numAlliedObjectives--
|
|
|
|
iprintln "The Allied Team Can No Longer Respawn!"
|
|
|
|
waitthread Check_End_Match
|
|
|
|
end
|
|
|
|
//----------------------------------------------------------
|
|
//Destroy the axis spawner here
|
|
//----------------------------------------------------------
|
|
axisspawnpoint:
|
|
|
|
iprintln "The Axis Spawn Point has been Destroyed!"
|
|
|
|
$Obj_axisspawnpoint TakeOver 1
|
|
level.numAlliedObjectives++
|
|
level.numAxisObjectives--
|
|
|
|
iprintln "The Axis Team Can No Longer Respawn!"
|
|
|
|
waitthread Check_End_Match
|
|
|
|
end
|
|
|
|
//----------------------------------------------------------
|
|
//control switch 1 green/red
|
|
//----------------------------------------------------------
|
|
switch1:
|
|
|
|
if( level.bRoundStarted == 1 )
|
|
{
|
|
if( parm.other.dmteam == axis )
|
|
{
|
|
if( $Obj_switch1.ControlledBy != 0 )
|
|
{
|
|
$Obj_switch1 TakeOver 0
|
|
level.numAxisObjectives++
|
|
level.numAlliedObjectives--
|
|
$obj2_light_allie hide
|
|
$obj2_light_axis show
|
|
iprintln "The Axis Control Switch 1!"
|
|
|
|
waitthread Check_End_Match
|
|
}
|
|
}
|
|
else if( parm.other.dmteam == allies )
|
|
{
|
|
if( $Obj_switch1.ControlledBy != 1 )
|
|
{
|
|
$Obj_switch1 TakeOver 1
|
|
level.numAlliedObjectives++
|
|
level.numAxisObjectives--
|
|
$obj2_light_axis hide
|
|
$obj2_light_allie show
|
|
|
|
iprintln "The Allies Control Switch 1!"
|
|
|
|
waitthread Check_End_Match
|
|
}
|
|
}
|
|
|
|
//Update team current objectives
|
|
thread set_objectives
|
|
}
|
|
|
|
end
|
|
|
|
//----------------------------------------------------------
|
|
//control switch 2 green/red
|
|
//----------------------------------------------------------
|
|
switch2:
|
|
|
|
if( level.bRoundStarted == 1 )
|
|
{
|
|
if( parm.other.dmteam == axis )
|
|
{
|
|
if( $Obj_switch2.ControlledBy != 0 )
|
|
{
|
|
$Obj_switch2 TakeOver 0
|
|
level.numAxisObjectives++
|
|
level.numAlliedObjectives--
|
|
$obj3_light_allie hide
|
|
$obj3_light_axis show
|
|
|
|
iprintln "The Axis Control Switch 2!"
|
|
|
|
waitthread Check_End_Match
|
|
}
|
|
}
|
|
else if( parm.other.dmteam == allies )
|
|
{
|
|
if( $Obj_switch2.ControlledBy != 1 )
|
|
{
|
|
$Obj_switch2 TakeOver 1
|
|
level.numAlliedObjectives++
|
|
level.numAxisObjectives--
|
|
$obj3_light_axis hide
|
|
$obj3_light_allie show
|
|
|
|
iprintln "The Allies Control Switch 2!"
|
|
|
|
waitthread Check_End_Match
|
|
}
|
|
}
|
|
|
|
//Update team current objectives
|
|
thread set_objectives
|
|
}
|
|
|
|
end
|
|
|
|
//----------------------------------------------------------
|
|
//control switch 3 green/red
|
|
//----------------------------------------------------------
|
|
switch3:
|
|
|
|
if( level.bRoundStarted == 1 )
|
|
{
|
|
if( parm.other.dmteam == axis )
|
|
{
|
|
if( $Obj_switch3.ControlledBy != 0 )
|
|
{
|
|
$Obj_switch3 TakeOver 0
|
|
level.numAxisObjectives++
|
|
level.numAlliedObjectives--
|
|
$obj4_light_allie hide
|
|
$obj4_light_axis show
|
|
|
|
iprintln "The Axis Control Switch 3!"
|
|
|
|
waitthread Check_End_Match
|
|
}
|
|
}
|
|
else if( parm.other.dmteam == allies )
|
|
{
|
|
if( $Obj_switch3.ControlledBy != 1 )
|
|
{
|
|
$Obj_switch3 TakeOver 1
|
|
level.numAlliedObjectives++
|
|
level.numAxisObjectives--
|
|
$obj4_light_axis hide
|
|
$obj4_light_allie show
|
|
|
|
iprintln "The Allies Control Switch 3!"
|
|
|
|
waitthread Check_End_Match
|
|
}
|
|
|
|
}
|
|
|
|
//Update team current objectives
|
|
thread set_objectives
|
|
}
|
|
|
|
end
|
|
|
|
|
|
//----------------------------------------------------------
|
|
//Set the teams current objectives
|
|
//----------------------------------------------------------
|
|
set_objectives:
|
|
|
|
//First lets do the allies
|
|
if( $Obj_switch3.ControlledBy == 0 )
|
|
{
|
|
$Obj_switch3 SetCurrent 1
|
|
}
|
|
else if( $Obj_switch2.ControlledBy == 0 )
|
|
{
|
|
$Obj_switch2 SetCurrent 1
|
|
}
|
|
else if( $Obj_switch1.ControlledBy == 0 )
|
|
{
|
|
$Obj_switch1 SetCurrent 1
|
|
}
|
|
else if( $Obj_axisspawnpoint.ControlledBy == 0 )
|
|
{
|
|
$Obj_axisspawnpoint SetCurrent 1
|
|
}
|
|
|
|
//Now the Axis
|
|
if( $Obj_switch1.ControlledBy == 1 )
|
|
{
|
|
$Obj_switch1 SetCurrent 0
|
|
}
|
|
else if( $Obj_switch2.ControlledBy == 1 )
|
|
{
|
|
$Obj_switch2 SetCurrent 0
|
|
}
|
|
else if( $Obj_switch3.ControlledBy == 1 )
|
|
{
|
|
$Obj_switch3 SetCurrent 0
|
|
}
|
|
else if( $Obj_alliespawnpoint.ControlledBy == 1 )
|
|
{
|
|
$Obj_alliespawnpoint SetCurrent 0
|
|
}
|
|
|
|
end
|
|
|
|
//--------------------------------------------------------------
|
|
//init the spawner bombs
|
|
//--------------------------------------------------------------
|
|
init_spawner_bombs:
|
|
|
|
//Allied spawner bomb
|
|
$axis_bomb thread global/tow_dm.scr::bomb_thinker "axis" maps/obj/MP_Tutorial_TOW.scr::alliesspawnpoint
|
|
$allie_bomb thread global/tow_dm.scr::bomb_thinker "allies" maps/obj/MP_Tutorial_TOW.scr::axisspawnpoint
|
|
end
|
|
|
|
//-----------------------------------------------
|
|
// Blow up Allied Spawner
|
|
//-----------------------------------------------
|
|
axis_bomb_relay_explode:
|
|
|
|
self waittill trigger
|
|
thread alliesspawnpoint
|
|
end
|
|
|
|
//-----------------------------------------------
|
|
// Blow up Axis Spawner
|
|
//-----------------------------------------------
|
|
allie_bomb_relay_explode:
|
|
|
|
self waittill trigger
|
|
thread axisspawnpoint
|
|
end
|
|
|
|
//----------------------------------------------------------
|
|
//Initialize the switch lights (start all lights off)
|
|
//----------------------------------------------------------
|
|
init_switch_lights:
|
|
|
|
$obj2_light_allie hide
|
|
$obj2_light_axis hide
|
|
$obj3_light_allie hide
|
|
$obj3_light_axis hide
|
|
$obj4_light_allie hide
|
|
$obj4_light_axis hide
|
|
|
|
end
|
|
|
|
//-----------------------------------------------
|
|
// init the objectives
|
|
//-----------------------------------------------
|
|
init_objectives:
|
|
|
|
//Allied spawn point
|
|
if( $Obj_alliespawnpoint.ControlledBy == 0 )
|
|
{
|
|
level.numAxisObjectives++
|
|
}
|
|
else if( $Obj_alliespawnpoint.ControlledBy == 1 )
|
|
{
|
|
level.numAlliedObjectives++
|
|
}
|
|
|
|
//Axis spawn point
|
|
if( $Obj_axisspawnpoint.ControlledBy == 0 )
|
|
{
|
|
level.numAxisObjectives++
|
|
}
|
|
else if( $Obj_axisspawnpoint.ControlledBy == 1 )
|
|
{
|
|
level.numAlliedObjectivse++
|
|
}
|
|
|
|
//switch 1
|
|
if( $Obj_switch1.ControlledBy == 0 )
|
|
{
|
|
level.numAxisObjectives++
|
|
}
|
|
else if( $Obj_switch1.ControlledBy == 1 )
|
|
{
|
|
level.numAlliedObjectives++
|
|
}
|
|
|
|
//switch 2
|
|
if( $Obj_switch2.ControlledBy == 0 )
|
|
{
|
|
level.numAxisObjectives++
|
|
}
|
|
else if( $Obj_switch2.ControlledBy == 1 )
|
|
{
|
|
level.numAlliedObjectives++
|
|
}
|
|
|
|
//switch 3
|
|
if( $Obj_switch3.ControlledBy == 0 )
|
|
{
|
|
level.numAxisObjectives++
|
|
}
|
|
else if( $Obj_switch3.ControlledBy == 1 )
|
|
{
|
|
level.numAlliedObjectives--
|
|
}
|
|
|
|
end
|
|
|
|
//-----------------------------------------------
|
|
// init the objectives
|
|
//-----------------------------------------------
|
|
Check_End_Match:
|
|
|
|
//Allies first
|
|
if( level.numAlliedObjectives == level.numObjectives )
|
|
{
|
|
//ignore the clock
|
|
level ignoreclock 1
|
|
|
|
//if there is a bomb ticking stop it.
|
|
waitthread global/tow_dm.scr::StopBomb
|
|
|
|
//Allies win play the movie
|
|
teamwin allies
|
|
}
|
|
else if( level.numAxisObjectives == 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
|
|
teamwin axis
|
|
}
|
|
|
|
end
|
|
|