TOW Objectives
Posted: Thu Apr 10, 2003 7:44 pm
Well I fixed the map not loading on other peoples machine problem, it was the battery that rox told me to remove. I was testing it with my friend, the objectives..spawn bombs and tow objectives all seem to work except that after the player spawn is blown up you can still respawn and even when you complete all objectives no one wins the match.
I am useless at scripting so I stole the objectives and bombs from the tow tutorial map in the sdk folders. I just changed the text to be displayed in the scr.
Below is the text from the scr I am using, could anyone tell me why its not working ?
Or Nuggets I know you love this type of thing so is there any chance you could rewrite the whole script for me ? I can send you the .map if you need to change settings inside there. I have no clue how to set it all up.
Of course you would have full credit for your work,
please someone help
// 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_peenemunde_TOW.scr"
exec global/tow_dm.scr
exec global/ambient.scr m5l1b
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" "Disable the factory electricity"
setcvar "g_obj_alliedtext3" "Disable the fuel pumps"
setcvar "g_obj_alliedtext4" "Disable the tracking radar"
setcvar "g_obj_alliedtext5" "Detonate Axis Spawn Point"
setcvar "g_obj_axistext1" "Protect Spawn Point"
setcvar "g_obj_axistext2" "Connect the factory electricity"
setcvar "g_obj_axistext3" "Turn on the fuel pumps"
setcvar "g_obj_axistext4" "Enable the tracking radar"
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" "Peenemunde"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "Peenemunde"
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 turned on the factory electricity!"
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 turned off the factory electricity!!"
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 turned on the fuel pumps!"
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 turned off the fuel pumps!"
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 started the tracking radar!"
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 disabled the tracking radar!"
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
Thanks in advance
Jack
I am useless at scripting so I stole the objectives and bombs from the tow tutorial map in the sdk folders. I just changed the text to be displayed in the scr.
Below is the text from the scr I am using, could anyone tell me why its not working ?
Or Nuggets I know you love this type of thing so is there any chance you could rewrite the whole script for me ? I can send you the .map if you need to change settings inside there. I have no clue how to set it all up.
Of course you would have full credit for your work,
please someone help
// 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_peenemunde_TOW.scr"
exec global/tow_dm.scr
exec global/ambient.scr m5l1b
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" "Disable the factory electricity"
setcvar "g_obj_alliedtext3" "Disable the fuel pumps"
setcvar "g_obj_alliedtext4" "Disable the tracking radar"
setcvar "g_obj_alliedtext5" "Detonate Axis Spawn Point"
setcvar "g_obj_axistext1" "Protect Spawn Point"
setcvar "g_obj_axistext2" "Connect the factory electricity"
setcvar "g_obj_axistext3" "Turn on the fuel pumps"
setcvar "g_obj_axistext4" "Enable the tracking radar"
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" "Peenemunde"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "Peenemunde"
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 turned on the factory electricity!"
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 turned off the factory electricity!!"
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 turned on the fuel pumps!"
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 turned off the fuel pumps!"
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 started the tracking radar!"
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 disabled the tracking radar!"
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
Thanks in advance
Jack