Ok, my map is working almost perfectly, only thing is when the round starts I want all the objectives to not be owned by anyone, at the moment a couple of them are owned right from the start, which part of this script tells them to do that, I know that to be neutral they should be set to "2".
heres the script
main:
level.script="maps/obj/MP_peenemunde_TOW.scr"
setcvar "g_scoreboardpic" "none"
exec global/ambient.scr mohdm6
exec global/exploder.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 Transport"
setcvar "g_obj_alliedtext2" "Shut Down the Fuel Pumps"
setcvar "g_obj_alliedtext3" "Shut Down Tracking Radar"
setcvar "g_obj_alliedtext4" "Disable Factory Power"
setcvar "g_obj_alliedtext5" "Destroy Axis Transport"
setcvar "g_obj_axistext1" "Protect Transport"
setcvar "g_obj_axistext2" "Turn On the Factory Power"
setcvar "g_obj_axistext3" "Power Up Tracking Radar"
setcvar "g_obj_axistext4" "Turn On the Fuel Pumps"
setcvar "g_obj_axistext5" "Destroy Allied Transport"
}
else
{
//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
//Not a TOW game remove the bombs
$gmc_bomb remove
$mg42_bomb remove
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Peenemunde"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" "Death or Glory?"
setcvar "g_obj_axistext1" "Peenemunde"
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" "Death or Glory?"
}
//////////////////////////
level waittill prespawn
//////////////////////////
//////////////////////////
level waittill spawn
/////////////////////////
iprintlnbold_noloc "Welcome to [Spec Ops] Peenemunde!"
level.bRoundStarted = 0
level.bArtillerySwitchUp = 1
level.bAirStrikeSwitchUp = 1
level.bRadarControlSwitchUp = 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 waittill roundstart
//////////////////////////
//If this is a tug of war game then we init all the TOW stuff
if( level.gametype == 5 )
{
thread init_switches
thread init_spawner_bombs
//Setup the starting team objectives
thread set_objectives
level.bRoundStarted = 1
}
thread start_generator_sound
end
//----------------------------------------------------------
//Sound for Radar Generator
//----------------------------------------------------------
start_generator_sound:
$gen_sound_speaker loopsound sub_idle1
end
//----------------------------------------------------------
//Destroy the allied spawner here
//----------------------------------------------------------
alliesammodepot local.planter:
iprintln "The Allied Ammo Depot has been destroyed!"
//Take over the objective
$Obj_alliesammodepot 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
//----------------------------------------------------------
axisammodepot local.planter:
iprintln "The Axis Ammo Depot has been destroyed!"
$Obj_axisammodepot 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
//----------------------------------------------------------
//Turn on/off Flak88's
//----------------------------------------------------------
artillerystrike:
if( level.bRoundStarted == 1 )
{
if( parm.other.dmteam == axis )
{
if( $Obj_artillerystrike.ControlledBy != 0 )
{
//Flip the switch
thread artillerystrike_switch
//$artillery_radio_speaker playsound radio_on
$Obj_artillerystrike TakeOver 0
$tower_lights_02 show
//Call in the artillery strike
thread call_artillery_strike
//Give 2 points for taking objective
parm.other AddKills 2
iprintln "The Axis have turned on the factory power!"
}
}
else if( parm.other.dmteam == allies )
{
if( $Obj_artillerystrike.ControlledBy != 1 )
{
//Flip the switch
thread artillerystrike_switch
//$artillery_radio_speaker playsound radio_off
$Obj_artillerystrike TakeOver 1
$tower_lights_02 hide
//Give 2 points for taking objective
parm.other AddKills 2
iprintln "The Allies have turned off the factory power!"
}
}
//Did anyone win?
thread Check_End_Match
//Update team current objectives
thread set_objectives
}
end
//----------------------------------------------------------
//Control Radar Dish
//----------------------------------------------------------
radarcontrol:
if( level.bRoundStarted == 1 )
{
if( parm.other.dmteam == axis )
{
if( $Obj_radarcontrol.ControlledBy != 0 )
{
//Flip the switch
thread radarcontrol_switch
$Obj_radarcontrol TakeOver 0
//Give 2 points for taking objective
parm.other AddKills 2
iprintln "The Axis have control of the tracking Radar!"
}
}
else if( parm.other.dmteam == allies )
{
if( $Obj_radarcontrol.ControlledBy != 1 )
{
//Flip the switch
thread radarcontrol_switch
$Obj_radarcontrol TakeOver 1
//Give 2 points for taking objective
parm.other AddKills 2
iprintln "The Allies have control of the tracking Radar!"
}
}
//Did anyone win?
thread Check_End_Match
//Update team current objectives
thread set_objectives
}
end
//----------------------------------------------------------
//Call on/off Airstrikes
//----------------------------------------------------------
airstrike:
if( level.bRoundStarted == 1 )
{
if( parm.other.dmteam == axis )
{
if( $Obj_airstrike.ControlledBy != 0 )
{
//Flip the switch
thread airstrike_switch
//$airstrike_radio_speaker playsound radio_off
$Obj_airstrike TakeOver 0
$tower_lights_01 hide
//Give 2 points for taking objective
parm.other AddKills 2
iprintln "The Axis have turned on the fuel pumps!"
}
}
else if( parm.other.dmteam == allies )
{
if( $Obj_airstrike.ControlledBy != 1 )
{
//Flip the switch
thread airstrike_switch
//$airstrike_radio_speaker playsound radio_on
$Obj_airstrike TakeOver 1
$tower_lights_01 show
//call in the air strike
thread call_air_strike
//Give 2 points for taking objective
parm.other AddKills 2
iprintln "The Allies have turned off the fuel pumps!"
}
}
//Did anyone win?
thread 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_airstrike.ControlledBy == 0 )
{
$Obj_airstrike SetCurrent 1
}
else if( $Obj_radarcontrol.ControlledBy == 0 )
{
$Obj_radarcontrol SetCurrent 1
}
else if( $Obj_artillerystrike.ControlledBy == 0 )
{
$Obj_artillerystrike SetCurrent 1
}
else if( $Obj_axisammodepot.ControlledBy == 0 )
{
$Obj_axisammodepot SetCurrent 1
}
//Now the Axis
if( $Obj_artillerystrike.ControlledBy == 1 )
{
$Obj_artillerystrike SetCurrent 0
}
else if( $Obj_radarcontrol.ControlledBy == 1 )
{
$Obj_radarcontrol SetCurrent 0
}
else if( $Obj_airstrike.ControlledBy == 1 )
{
$Obj_airstrike SetCurrent 0
}
else if( $Obj_alliesammodepot.ControlledBy == 1 )
{
$Obj_alliesammodepot SetCurrent 0
}
end
//----------------------------------------------------------
//Called when a player tries to open a locked door
//----------------------------------------------------------
doorlocked:
self playsound door_wood_locked1
end
//--------------------------------------------------------------
//Init the switches
//--------------------------------------------------------------
init_switches:
$artillerystrike_switch bind $artillerystrike_origin
$airstrike_switch bind $airstrike_origin
$radarcontrol_switch bind $radarcontrol_origin
//Make the switches non solid so they don't hurt the player when triggered
$artillerystrike_switch notsolid
$artillerystrike_origin notsolid
$airstrike_switch notsolid
$airstrike_origin notsolid
$radarcontrol_switch notsolid
$radarcontrol_origin notsolid
end
//--------------------------------------------------------------
//Turns On/Off Artillery Fire
//--------------------------------------------------------------
artillerystrike_switch:
if( level.bArtillerySwitchUp == 1 )
{
//$artillerystrike_origin speed 1.0
//$artillerystrike_origin rotatexdownto 180
$artillerystrike_origin waitmove
$artillerystrike_origin playsound switchbox
level.bArtillerySwitchUp = 0
}
else
{
//$artillerystrike_origin rotatexupto 0
$artillerystrike_origin waitmove
level.bArtillerySwitchUp = 1
}
end
//--------------------------------------------------------------
//Turns On/Off Airstike bombs
//--------------------------------------------------------------
airstrike_switch:
if( level.bAirStrikeSwitchUp == 1 )
{
//$airstrike_origin speed 1.0
//$airstrike_origin rotatexdownto 180
$airstrike_origin waitmove
$airstrike_origin playsound switchbox
level.bAirStrikeSwitchUp = 0
}
else
{
//$airstrike_origin rotatexupto 0
$airstrike_origin waitmove
level.bAirStrikeSwitchUp = 1
}
end
//--------------------------------------------------------------
//Take control of Radar for more explosions
//--------------------------------------------------------------
radarcontrol_switch:
if( level.bRadarControlSwitchUp == 1 )
{
//$radarcontrol_origin speed 1.0
//$radarcontrol_origin rotatexdownto 180
$radarcontrol_origin waitmove
$radarcontrol_origin playsound switchbox
level.bRadarControlSwitchUp = 0
}
else
{
//$radarcontrol_origin rotatexupto 0
$radarcontrol_origin waitmove
level.bRadarControlSwitchUp = 1
}
end
//--------------------------------------------------------------
//init the spawner bombs
//--------------------------------------------------------------
init_spawner_bombs:
//Allied spawner bomb
$gmc_bomb thread global/tow_dm.scr::bomb_thinker "axis" maps/obj/MP_peenemunde_TOW.scr::alliesammodepot
$mg42_bomb thread global/tow_dm.scr::bomb_thinker "allies" maps/obj/MP_peenemunde_TOW.scr::axisammodepot
//Allied bomb (Bridge, not a spawner bomb)
$bridge_bomb thread global/tow_dm.scr::bomb_thinker "axis" maps/obj/MP_peenemunde_TOW.scr::bridge_bomb_relay_explode
//Axis bomb (Archway, not a spawner bomb)
$archway_bomb thread global/tow_dm.scr::bomb_thinker "allies" maps/obj/MP_peenemunde_TOW.scr::archway_bomb_relay_explode
end
//-----------------------------------------------
// Blow up the truck (Allied Spawner)
//-----------------------------------------------
truck_bomb_relay_explode:
self waittill trigger
thread alliesammodepot
end
//-----------------------------------------------
// Blow up the MG42 (Axis Spawner)
//-----------------------------------------------
mg42_bomb_relay_explode:
self waittill trigger
thread axisammodepot
end
//----------------------------------------------------------
FacingFix:
//
//
// jsl--> Make the axis face the correct way...
//----------------------------------------------------------
self angles "0 0 0"
end
//----------------------------------------------------------
// Allies are enemyspawners with #set 20 with a leader #set 25
// Axis are enemyspawners with #set 10 with a leader #set 15
// all spawners are targeting info_pathnodes
// 2 cameras placed $targetname alliewincamera_1 & alliewincamera_2
//----------------------------------------------------------
win_game_allie:
//hide and freeze the players
$player nodamage
$player hide
freezeplayer
//spawn the allies
waitthread global/dm_ai.scr::spawnset 20 set20
waitthread global/dm_ai.scr::spawnset 25 cappy
//spawn the axis
waitthread global/dm_ai.scr::spawnset 10 set10
waitthread global/dm_ai.scr::spawnset 15 set15
$set10 waitthread FacingFix
$set15 waitthread FacingFix
for( local.i = 1; local.i <= $set10.size; local.i++ )
{
$set10[local.i] thread Do_Loser_End
}
$set15 thread Do_Loser_End
//Turn on the winning music
forcemusic aux2 aux2
//Turn off the hud for the movie
drawhud 0
$alliewincamera_1 watch $alliewincamera_2
$alliewincamera_1 cut
cuecamera $alliewincamera_1
wait 3
for( local.i = 1; local.i <= $set20.size; local.i++ )
{
local.rand = randomfloat .5
local.rand += .5
if( local.i <= $set10.size )
{
$set20[local.i] thread Do_Winner_End local.rand $set10[local.i]
}
else
{
$set20[local.i] thread Do_Winner_End local.rand NULL
}
}
$cappy thread Do_Winner_Allied_Cappy_End 5 $set15
end
//----------------------------------------------------------
// Allies are enemyspawners with #set 30 with a leader #set 35
// Axis are enemyspawners with #set 40 with a leader #set 45
// all spawners are targeting info_pathnodes
// 2 cameras placed $targetname axiswincamera_1 & axiswincamera_2
//----------------------------------------------------------
win_game_axis:
//hide and freeze the players
$player nodamage
$player hide
freezeplayer
//spawn the axis
waitthread global/dm_ai.scr::spawnset 40 set40
waitthread global/dm_ai.scr::spawnset 45 cappy
//spawn the allies
waitthread global/dm_ai.scr::spawnset 30 set30
waitthread global/dm_ai.scr::spawnset 35 set35
drawhud 0
//Start the music
forcemusic aux4 aux4
$axiswincamera_1 speed .3
$axiswincamera_1 fov 70
$axiswincamera_1 follow $axiswincamera_spline $axiswincamera_target
$axiswincamera_1 cut
cuecamera $axiswincamera_1
wait 2.0
//Run the winner threads
for( local.i = 1; local.i <= $set40.size; local.i++ )
{
local.rand = randomfloat 3.0
local.rand += 2.5
if( local.i <= $set30.size )
{
$set40[local.i] thread Do_Winner_End local.rand $set30[local.i]
}
else
{
$set40[local.i] thread Do_Winner_End local.rand NULL
}
}
//run the winners captain thread
$cappy thread Do_Winner_Axis_Cappy_End 5 $set35
wait 1
//run the losers threads
for( local.i = 1; local.i <= $set30.size; local.i++ )
{
$set30[local.i] thread Do_Allie_Loser_End
}
$set35 thread Do_Allie_Loser_End
end
//----------------------------------------------------------
//Do the winner anims and stuff
//----------------------------------------------------------
Do_Winner_End local.wait local.target:
self nodamage
self runto self.target
wait local.wait
self fire
if( local.target != NULL )
{
local.target takedamage
local.target damage NULL 1000 NULL (0 0 0) (0 0 0) (0 0 0) 0 9 0 0
}
end
//----------------------------------------------------------
//Do the winners captain end sequence
//----------------------------------------------------------
Do_Winner_Allied_Cappy_End local.wait local.target:
self nodamage
self runto self.target
local.rand = randomfloat 1.5
local.rand += .5
self fire
level.axisFire = 0
if( local.target != NULL )
{
local.target takedamage
local.target damage NULL 1000 NULL (0 0 0) (0 0 0) (0 0 0) 0 9 0 0
}
wait 3.5
$alliewincamera_2 watch $cappy
$alliewincamera_2 fov 40
$alliewincamera_2 cut
cuecamera $alliewincamera_2
wait 2
dprintln "Playing Cappy end anim"
self anim 00A001_victory
wait 2
//Allies have won
teamwin allies
//fade out the music
forcemusic aux3 aux3
wait 5
end
//----------------------------------------------------------
//Do the winners captain end sequence
//----------------------------------------------------------
Do_Winner_Axis_Cappy_End local.wait local.target:
self nodamage
self runto self.target
wait local.wait
self fire
if( local.target != NULL )
{
local.target takedamage
local.target damage NULL 1000 NULL (0 0 0) (0 0 0) (0 0 0) 0 9 0 0
}
wait 5
self anim 00A001_victory
//Axis have won
teamwin axis
//fade out the music
forcemusic aux5 aux5
wait 5
end
//----------------------------------------------------------
//Axis end, they fire and die
//----------------------------------------------------------
Do_Loser_End:
self nodamage
self aimat $airstrike_origin
//self runto self.target
while ( level.axisFire == 1 )
{
local.delay = randomfloat 1.5
local.delay += .5
wait local.delay
self fire
}
end
//----------------------------------------------------------
//Allies run away
//----------------------------------------------------------
Do_Allie_Loser_End:
self nodamage
self runto self.target
end
//-----------------------------------------------
// init the objectives
//-----------------------------------------------
Check_End_Match:
local.nAxis = 0
local.nAllied = 0
//Allied ammo depot
if( $Obj_alliesammodepot.ControlledBy == 0 )
{
local.nAxis++
}
else if( $Obj_alliesammodepot.ControlledBy == 1 )
{
local.nAllied++
}
//Axis ammo depot
if( $Obj_axisammodepot.ControlledBy == 0 )
{
local.nAxis++
}
else if( $Obj_axisammodepot.ControlledBy == 1 )
{
local.nAllied++
}
//Artillery Strike
if( $Obj_artillerystrike.ControlledBy == 0 )
{
local.nAxis++
}
else if( $Obj_artillerystrike.ControlledBy == 1 )
{
local.nAllied++
}
//Radar
if( $Obj_radarcontrol.ControlledBy == 0 )
{
local.nAxis++
}
else if( $Obj_radarcontrol.ControlledBy == 1 )
{
local.nAllied++
}
//Air strike
if( $Obj_airstrike.ControlledBy == 0 )
{
local.nAxis++
}
else if( $Obj_airstrike.ControlledBy == 1 )
{
local.nAllied++
}
//Allies first
if( local.nAllied == 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
//Allies win play the movie
//thread win_game_allie
teamwin allies
}
}
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 win_game_axis
teamwin axis
}
}
end
Initialising Objectives
Moderator: Moderators
Initialising Objectives
Philip II of Macedon sent a message to Sparta:
"If I win this war, you will be slaves forever."
The Spartan ephors sent back a one word reply: "If".
"If I win this war, you will be slaves forever."
The Spartan ephors sent back a one word reply: "If".
-
nuggets
- General
- Posts: 1006
- Joined: Fri Feb 28, 2003 2:57 am
- Location: U-england-K (england in the UK) :P
- Contact:
they're already neutral
the way i did it in the scripting was they already had 0 as switchowner i think i called it
so when it's checking the owners of the switch it adds up all the numbers for each switch
meaning
switch1 = 0
switch2 = 0
switch3 = 0
so the total will be 0
then if the allies get the
switch1 = 1
switch2 = 1
switch3 = 1
so the total will be 3, meaning the allies will win
and if the axis get the
switch1 = -1
switch2 = -1
switch3 = -1
so the total will be -3, meaning the axis will win,
if ur trying to set up something else in the game for the switches to change colour say
then have
switch1box1 hide //hides the 1st box (possibly blue if allies own it)
switch1box2 hide //hides the 2nd box (possibly red if axis own it)
// switch1box3 won't be used on startup, as it' will be shown (possibly green for neutral)
then inside the scripting of operating a switch you will have
if axis blah blah blah
switch1box1 show
switch1box2 hide
switch1box3 hide
that kinda thing... but what are you trying 2 do here?
the way i did it in the scripting was they already had 0 as switchowner i think i called it
so when it's checking the owners of the switch it adds up all the numbers for each switch
meaning
switch1 = 0
switch2 = 0
switch3 = 0
so the total will be 0
then if the allies get the
switch1 = 1
switch2 = 1
switch3 = 1
so the total will be 3, meaning the allies will win
and if the axis get the
switch1 = -1
switch2 = -1
switch3 = -1
so the total will be -3, meaning the axis will win,
if ur trying to set up something else in the game for the switches to change colour say
then have
switch1box1 hide //hides the 1st box (possibly blue if allies own it)
switch1box2 hide //hides the 2nd box (possibly red if axis own it)
// switch1box3 won't be used on startup, as it' will be shown (possibly green for neutral)
then inside the scripting of operating a switch you will have
if axis blah blah blah
switch1box1 show
switch1box2 hide
switch1box3 hide
that kinda thing... but what are you trying 2 do here?
hope this helps, prob not cos it's all foreign 2 me :-/
Ah, well I found out it was the TOW objects in the .map file, they had a tag in there telling them to be owned by 0 or 1, I changed them all to 2 and bingo, they are neutral when the map starts.
Philip II of Macedon sent a message to Sparta:
"If I win this war, you will be slaves forever."
The Spartan ephors sent back a one word reply: "If".
"If I win this war, you will be slaves forever."
The Spartan ephors sent back a one word reply: "If".