Enable/Disable Spawners and problems

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Slyk
Lieutenant Colonel
Posts: 361
Joined: Sun Jul 14, 2002 12:42 am
Location: Elizabethtown, PA

Enable/Disable Spawners and problems

Post by Slyk »

Ok, using this feature AGAIN in my latest map. What I have: Allied and Axis spawners tied to the OBJ switch. When the switch is flipped by the opposite team the spawns are disabled (this works). If the original team can 'reactivate'/flip the switch, SOMETIMES the spawners turn back on, but most of the time they don't. Any ideas/thoughts?? This feature is used in the Omaha objective map for the Allies and it is pretty straight forward. Is there an issues 'in-game' that can't be beat here???
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

I think there may be something wrong in your script. Can you post substantial parts here? ;)
Image
Slyk
Lieutenant Colonel
Posts: 361
Joined: Sun Jul 14, 2002 12:42 am
Location: Elizabethtown, PA

Post by Slyk »

Here's the part for the allied spawner.....

//----------------------------------------------------------
// TAKE CONTROL OF OBJECTIVE 1 - - ALLIES SPAWNER
//----------------------------------------------------------
obj1:
if( parm.other.dmteam == allies )
{
if( $obj1.ControlledBy != 1 )
{
//Flip the switch
thread moveobj1

//Take the objective
$obj1 TakeOver 1
iprintln "The Allies have control of their HEADQUARTERS"
iprintln "The gallent defenders are receiving reinforcements!"

//Update team current objectives
thread set_objectives

waitthread Check_End_Match

}
}
else if( parm.other.dmteam == axis )
{
if( $obj1.ControlledBy != 0 )
{
//Flip the switch
thread moveobj1

//Take the objective
$obj1 TakeOver 0
iprintln "The Axis have control of ALLIED HEADQUARTERS"
iprintln "REINFORCEMENTS have been cut off to this sector!!"
iprintln "The Allies must regain their HQ to receive more assistance!!"

//Update team current objectives
thread set_objectives

waitthread Check_End_Match
}
}
end


//--------------------------------------------------------------
// Move the switch handle - OBJ1 - - ALLIED SPAWNER
//--------------------------------------------------------------
moveobj1:
$obj1_switch_trigger nottriggerable
$obj1switch bind $obj1_switch_origin
if( level.obj1switch_up == 1 )
{
$obj1_switch_origin speed 1.0
$obj1_switch_origin rotatezdownto 180
$obj1_switch_origin waitmove
$obj1_switch_origin playsound switchbox
level.obj1_switch_up = 2

$alliedspawner disablespawn

$obj1allies hide
$obj1axis show
}
else
{
$obj1_switch_origin speed 1.0
$obj1_switch_origin rotatezupto 0
$obj1_switch_origin waitmove
$obj1_switch_origin playsound switchbox
level.obj1_switch_up = 1

$alliedspawner enablespawn

$obj1allies show
$obj1axis hide
}
$obj1_switch_trigger triggerable
end
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

if( level.obj1switch_up == 1 )

isn't that supposed to be

if( level.obj1_switch_up == 1 )

?
Image
Slyk
Lieutenant Colonel
Posts: 361
Joined: Sun Jul 14, 2002 12:42 am
Location: Elizabethtown, PA

Post by Slyk »

You would be correct..........

NOW, new issue on different map..........

was working perfectly, but obviously I screwed something up without knowing it. Here's the situation... Axis control 4 of 5 objectives, BUT as soon as you enter the game, the Axis automatically win, keeps doing this over and over every 5 seconds. I have all the objectives set up correctly. If I tweak the allied spawner 'setcurrent' it won't spawn ANY player for ANY team. I'm so tired of it and probably blind to the issue.

Here's that script:

main:
level.script="maps/obj/MP_GunAssault_TOW.scr"

setcvar "g_scoreboardpic" "none"

level.gametype = int( getcvar( g_gametype ) )

//Exec our helper scripts
exec global/tow_dm.scr
exec global/ambient.scr MP_GunAssault_TOW


//gametype 5 = Tug of War
if( level.gametype == 5 )
{
setcvar "g_obj_alliedtext1" "Defend the Transports!"
setcvar "g_obj_alliedtext2" "Capture the Estate House"
setcvar "g_obj_alliedtext3" "Capture the Old Ruins"
setcvar "g_obj_alliedtext4" "Control the Bunker"
setcvar "g_obj_alliedtext5" "Control Radio Room"

setcvar "g_obj_axistext1" "Defend the Radio Room"
setcvar "g_obj_axistext2" "Control the Bunker"
setcvar "g_obj_axistext3" "Hold the Old Ruins"
setcvar "g_obj_axistext4" "Control the Estate House"
setcvar "g_obj_axistext5" "Destroy Allied Transport"
}
else
{

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Slyk's Gun Assault v2.0 TOW"
setcvar "g_obj_alliedtext2" "by: Mark 'Slyk' Dittman"
setcvar "g_obj_alliedtext3" "May, 2003"
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" "BETA Version 1.9a"
setcvar "g_obj_axistext3" ""

}
setcvar "g_scoreboardpic" "gun_assault.tga"


//////////////////////////
level waittill prespawn
//////////////////////////


$world farplane_color "0.756863 0.796078 0.815686"
level.fogplane = 4608
$world farplane level.fogplane
$world farplane_cull 0


//////////////////////////
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 = 25 // round time limit in minutes
level.numObjectives = 5 // Number of objectives needed to win

level.ruins_switch_up = 1 //1=axis/up, 2=allies/down
level.house_switch_up = 1 //1=axis/up, 2=allies/down
level.hq_switch_up = 1 //1=axis/up, 2=allies/down
level.bunker_switch_up = 1



thread set_allied_spawns
thread set_axis_spawns
thread set_collisionents

thread global/minefield.scr::minefield_setup

//////////////////////////
//level waittill roundstart
//////////////////////////

//TOW match init the TOW stuff
if( level.gametype == 5 )
{

//Init the spawner bombs
thread init_spawner_bombs

//Setup the starting team objectives
thread set_objectives

//level.bRoundStarted = 1
}

end

//****************************************************************************************************************

//----------------------------------------------
// Set the Collision Entities
//----------------------------------------------
set_collisionents:

$allied_truck_mask bind $allied_truck
$m3amask bind $m3a
$m3bmask bind $m3b
$allied_truck.collisionent = $allied_truck_mask
$m3a.collisionent = $m3amask
$m3b.collisionent = $m3bmask
end


//-----------------------------------------------
// Init the ALLIED Spawn Locations
//-----------------------------------------------
set_allied_spawns:

$spawn_allied1 enablespawn
$spawn_allied2 disablespawn
$spawn_allied3 disablespawn
end

//-----------------------------------------------
// Init the AXIS Spawn Locations
//-----------------------------------------------
set_axis_spawns:

$spawn_axis1 enablespawn
$spawn_axis2 disablespawn
$spawn_axis3 disablespawn
end


//-----------------------------------------------
// Init the spawner bombs
//-----------------------------------------------
init_spawner_bombs:
//Allied spawner bomb
$allied_truck_bomb thread global/tow_dm.scr::bomb_thinker "axis"

maps/obj/MP_GunAssault_TOW.scr::destroy_allied_spawner


//----------------------------------------------------------
//Destroy the allied spawner here
//----------------------------------------------------------
destroy_allied_spawner:

iprintln "The Allied Transport has been destroyed!"

//Take over the objective
$obj_allied_spawner TakeOver 0

$spawn_allied1 disablespawn
$spawn_allied2 disablespawn
$spawn_allied3 disablespawn

iprintln "The Allied Team can no longer respawn!"

//See if someone won
thread Check_End_Match
end


//----------------------------------------------------------
//Set the teams current objectives
//----------------------------------------------------------
set_objectives:

//First lets do the allies
if( $obj_house.ControlledBy == 0 )
{
$obj_house SetCurrent 1
}
else if( $obj_ruins.ControlledBy == 0 )
{
$obj_ruins SetCurrent 1
}
else if( $obj_bunker.ControlledBy == 0 )
{
$obj_bunker SetCurrent 1
}
else if( $obj_axis_spawner.ControlledBy == 0 )
{
$obj_axis_spawner SetCurrent 1
}

//Now the Axis
if( $obj_house.ControlledBy == 1 )
{
$obj_house SetCurrent 0
}
else if( $obj_ruins.ControlledBy == 1 )
{
$obj_ruins SetCurrent 0
}
else if( $obj_bunker.ControlledBy == 1 )
{
$obj_bunker SetCurrent 0
}
else if( $obj_allied_spawner.ControlledBy == 1 )
{
$obj_allied_spawner SetCurrent 0
}
end

//**********************************************************************************************

//----------------------------------------------------------
// Control the Estate House
//----------------------------------------------------------
toggle_house:
if( parm.other.dmteam == allies )
{
if( $obj_house.ControlledBy != 1 )
{
//Flip the switch
thread movehouse

//Take the objective
$obj_house TakeOver 1
iprintln "The Allies have captured the Estate House!"

//Update team current objectives
thread set_objectives

waitthread Check_End_Match
}
}
else if( parm.other.dmteam == axis )
{
if( $obj_house.ControlledBy != 0 )
{
//Flip the switch
thread movehouse

//Take the objective
$obj_house TakeOver 0
iprintln "The Axis have control of the Estate House!"

//Update team current objectives
thread set_objectives

waitthread Check_End_Match
}
}
end


//--------------------------------------------------------------
// Move the switch handle - Estate House
//--------------------------------------------------------------
movehouse:
$house_switch_trigger nottriggerable
$house_switch bind $house_switch_origin
if( level.house_switch_up == 1 )
{
$house_switch_origin speed 1.0
$house_switch_origin rotatezdownto 180
$house_switch_origin waitmove
$house_switch_origin playsound switchbox
level.house_switch_up = 2

thread disable_allied_spawn1
}
else
{
$house_switch_origin speed 1.0
$house_switch_origin rotatezupto 0
$house_switch_origin waitmove
$house_switch_origin playsound switchbox
level.house_switch_up = 1

thread disable_allied_spawn22
}

$house_switch_trigger triggerable
end

//*********************************************************************


//----------------------------------------------------------
// Control the Ruins
//----------------------------------------------------------
toggle_ruins:
if( parm.other.dmteam == axis )
{
if( $obj_ruins.ControlledBy != 0 )
{
//Flip the switch
thread moveruins

//Take the objective
$obj_ruins TakeOver 0
iprintln "The Axis have occupied the Ruins!"

//Update team current objectives
thread set_objectives

waitthread Check_End_Match
}
}
else if( parm.other.dmteam == allies )
{
if( $obj_ruins.ControlledBy != 1 )
{
//Flip the switch
thread moveruins

//Take the objective
$obj_ruins TakeOver 1
iprintln "The Allies have occupied the Ruins!"

//Update team current objectives
thread set_objectives

waitthread Check_End_Match
}
}
end

//--------------------------------------------------------------
// Move the switch handle - Ruins
//--------------------------------------------------------------
moveruins:
$ruins_trigger nottriggerable
$ruins_switch bind $ruins_switch_origin
if( level.ruins_switch_up == 1 )
{
$ruins_switch_origin speed 1.0
$ruins_switch_origin rotatezdownto 180
$ruins_switch_origin waitmove
$ruins_switch_origin playsound switchbox
level.ruins_switch_up = 2

thread enable_allied_spawn3

}
else
{
$ruins_switch_origin speed 1.0
$ruins_switch_origin rotatezupto 0
$ruins_switch_origin waitmove
$ruins_switch_origin playsound switchbox
level.ruins_switch_up = 1

thread disable_allied_spawn3
}

$ruins_switch_trigger triggerable


end
//************************************************************

//----------------------------------------------------------
// Control the Axis HQ
//----------------------------------------------------------
toggle_hq:
if( parm.other.dmteam == axis )
{
if( $obj_axis_spawner.ControlledBy != 0 )
{
//Flip the switch
thread movehq

//Take the objective
$obj_axis_spawner TakeOver 0
iprintln "The Axis have control of their Headquarters Room!"
iprintln "Axis reinforcements are on the way!"

//Update team current objectives
thread set_objectives

waitthread Check_End_Match
}
}
else if( parm.other.dmteam == allies )
{
if( $obj_axis_spawner.ControlledBy != 1 )
{
//Flip the switch
thread movehq

//Take the objective
$obj_axis_spawner TakeOver 1
iprintln "The Allies have occupied the Axis Headquarters!"
iprintln "The Axis can no longer recieve support!"

//Update team current objectives
thread set_objectives

waitthread Check_End_Match
}
}
end

//--------------------------------------------------------------
// Move the switch handle - Axis HQ
//--------------------------------------------------------------
movehq:
$hq_trigger nottriggerable
$hq_switch bind $hq_switch_origin
if( level.hq_switch_up == 1 )
{
$hq_switch_origin speed 1.0
$hq_switch_origin rotatezdownto 180
$hq_switch_origin waitmove
$hq_switch_origin playsound switchbox
level.hq_switch_up = 2

thread disable_allied_spawn1
thread disable_allied_spawn2
thread disable_allied_spawn3

}
else
{
$hq_switch_origin speed 1.0
$hq_switch_origin rotatezupto 0
$hq_switch_origin waitmove
$hq_switch_origin playsound switchbox
level.hq_switch_up = 1

thread enable_allied_spawn1
thread enable_allied_spawn2
thread enable_allied_spawn3

}

$hq_switch_trigger triggerable


end

//***************************************************************



//----------------------------------------------------------
// Control the Bunker
//----------------------------------------------------------
toggle_bunker:
if( parm.other.dmteam == axis )
{
if( $obj_bunker.ControlledBy != 0 )
{
//Flip the switch
thread movebunker

//Take the objective
$obj_bunker TakeOver 0
iprintln "The Axis have control of the Bunker."

//Update team current objectives
thread set_objectives

waitthread Check_End_Match
}
}
else if( parm.other.dmteam == allies )
{
if( $obj_bunker.ControlledBy != 1 )
{
//Flip the switch
thread movebunker

//Take the objective
$obj_bunker TakeOver 1
iprintln "The Allies have control of the Bunker."

//Update team current objectives
thread set_objectives

waitthread Check_End_Match
}
}
end

//--------------------------------------------------------------
// Move the switch handle - Bunker
//--------------------------------------------------------------
movebunker:
$bunker_trigger nottriggerable
$bunker_switch bind $bunker_switch_origin
if( level.bunker_switch_up == 1 )
{
$bunker_switch_origin speed 1.0
$bunker_switch_origin rotatezdownto 180
$bunker_switch_origin waitmove
$bunker_switch_origin playsound switchbox
level.bunker_switch_up = 2

}
else
{
$bunker_switch_origin speed 1.0
$bunker_switch_origin rotatezupto 0
$bunker_switch_origin waitmove
$bunker_switch_origin playsound switchbox
level.bunker_switch_up = 1

}

$bunker_switch_trigger triggerable


end

//***************************************************************



//-----------------------------------------------
// Turn OFF ALLIED Spawn1 - turn ON AXIS spawn2 **when Allies capture Estate House**
//-----------------------------------------------
disable_allied_spawn1:

$spawn_allied1 disablespawn
$spawn_allied2 enablespawn
$spawn_axis1 disablespawn
$spawn_axis2 enablespawn
end

//-----------------------------------------------
// Turn OFF ALLIED Spawn2 - turn ON AXIS spawn3 **when Allies capture Ruins**
//-----------------------------------------------
enable_allied_spawn3:

$spawn_allied2 disablespawn
$spawn_allied3 enablespawn
$spawn_axis2 disablespawn
$spawn_axis3 enablespawn
end


//-----------------------------------------------
// Turn OFF ALLIED Spawn3 - turn ON AXIS spawn2 **when Axis capture Ruins**
//-----------------------------------------------
disable_allied_spawn3:

$spawn_allied3 disablespawn
$spawn_allied2 enablespawn
$spawn_axis1 disablespawn
$spawn_axis2 enablespawn
end

//-----------------------------------------------
// Turn OFF ALLIED Spawn2 - turn ON AXIS spawn1 **when Axis capture Estate House**
//-----------------------------------------------
disable_allied_spawn22:

$spawn_allied2 disablespawn
$spawn_allied1 enablespawn
$spawn_axis2 disablespawn
$spawn_axis1 enablespawn
end


//-----------------------------------------------
// Check for end match condition
//-----------------------------------------------
Check_End_Match:

//Check to see if axis have won
//Axis win by controlling allies spawn, the house, ruins and the bunker.
//-----------------------------
if( ( $obj_house.ControlledBy == 0 ) && ( $obj_ruins.ControlledBy == 0 ) && ( $obj_bunker.ControlledBy == 0 ) && (

$obj_allied_spawner.ControlledBy == 0 ) )
{
//if there is a bomb ticking stop it.
waitthread global/tow_dm.scr::StopBomb

teamwin axis
}


//Check to see if allies have won
//Allies win by controlling axis spawn, the house, ruins and the bunker.
//-----------------------------
if( ( $obj_axis_spawner.ControlledBy == 1 ) && ( $obj_house.ControlledBy == 1 ) && ( $obj_ruins.ControlledBy == 1 )

&& ( $obj_bunker.ControlledBy == 1 ) )
{
//if there is a bomb ticking stop it.
waitthread global/tow_dm.scr::StopBomb

teamwin allies
}
end
Post Reply