Page 1 of 1
spawn tirgger through map script
Posted: Tue Jan 11, 2005 6:51 am
by unclebob
Well I need help! My knowledge of scripting is limited to cut & paste & I am looking to do something beyond that level! I have tried several things over the past 2 weeks to be sure I wasn?t giving up to easily.
Here is what I need: A Map Script Spawned switch that has a neutral start position at level spawn, then is axis & allied selectable to activate different threads for each team.
I know how to add the switch entity in that?s no big deal but splitting the trigger with neutral, allied & axis is beyond me! Any help would be gratefully appreciated & I will give credit in score message!
unclebob@wi.rr.com
Posted: Tue Jan 11, 2005 9:34 am
by lizardkid
if i understand you right, you want a switch spawned, with a trigger on it, which can be "owned" by either side? it's an interesting idea,
in any case, you want this little bit to decide if the player touching it is Axis or Allied.
Code: Select all
if($player[local.i].dmteam == "Allies")
{
iprintlnbold.noloc "You are Allied!"
}
if($player[local.i].dmteam == "Axis")
{
iprintlnbold.noloc "You are Axis!"
}
i cant think straight right now because it's 2:30 AM my time and woo... i need sleep... i'l ltry and psot sometime later today.

Re: spawn tirgger through map script
Posted: Tue Jan 11, 2005 10:19 am
by wacko
unclebob wrote:I know how to add the switch entity in that?s no big deal but splitting the trigger with neutral, allied & axis is beyond me! Any help would be gratefully appreciated & I will give credit in score message!
If u knew how to spawn it... In containerz, there's a switch triggering a turret to shoot either axis or allies. Download the files at the
mohaa recycling bin (map section) and take a look urself
Posted: Tue Jan 11, 2005 11:29 am
by unclebob
Well I actualy figgured it out 20min after I posted this.
But have a small problem with it yet. I put extra spawn points aswell as a func_beam in the thread, Beam works shows who holds the spawn. But the spawn points dont work. now I saw that Omaha has the shingle spawns disabled, which hints that then need to be spawned at level spawn then given a wait 2 & removed or disable or what not untill the thread for the proper team is activated & the spawns are reactivated!
Is this right or am I going to far into this & there is a simpler answer?
unclebob
I pulled the info to solve first part from flak88 on ardense & ajusted it to script
Posted: Tue Jan 11, 2005 1:00 pm
by Elgan
spanw points need spawning first thing where svars are set .
like setcvar "allkies_text2" or something.
under or above there.
Posted: Tue Jan 11, 2005 2:26 pm
by bdbodger
try spawning the spawnpoints before level waittill prespawn at the top of your script . Then you can disable or enable them when ever you feel the need just remember to give them a targetname .
Posted: Tue Jan 11, 2005 6:21 pm
by Green Beret
to target a flak to just shoot allies.would it be sumtin like
local.flak.target $allies
or
local.flak.target = $allies

Posted: Tue Jan 11, 2005 10:19 pm
by unclebob
So it should be somthing like this then?
I only put in switch A stuff to save forum space why cluder with same thing just difrent names off to work!
main:
setcvar "g_obj_alliedtext1" "Test"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" "This is only at TEST"
setcvar "g_obj_axistext3" "BEEEEEEEEEEEEEP!!!!!"
setcvar "g_scoreboardpic" "Bep.bsp"
thread mainspawns //<<< Static spawns NO script Run from map start
thread secspawna //<<< script defined spawn for one capture point (point A)
thread secspawnb //<<< script defined spawn for one capture point (point B)
thread ini_switches //<<< used to activate Spawn switching for point A & B
level waittill prespawn
$alla disablespawn //<<< Disabled after spanwing till enabled by switch
$axisa disablespawn //<<< Disabled after spanwing till enabled by switch
$allb disablespawn //<<< Disabled after spanwing till enabled by switch
$axisb disablespawn //<<< Disabled after spanwing till enabled by switch
//*** Precache Dm Stuff
exec global/DMprecache.scr
exec global/ambient.scr
level.script = "maps/dm/bep.scr"
thread global/exploder.scr::main
level waittill spawn
level.bRoundStarted = 1 //<<< can I remove this from script or is it needed for switches
end
mainspawns:
//Allied
local.allies = spawn info_player_allied
local.allies.angle = 100
local.allies.origin = ( 1500 1500 150 )
local.axis = spawn info_player_axis
local.axis.angle = 100
local.axis.origin = ( 2500 2500 250 )
end
secspawna:
// location A spawns waiting for switch to be selected by a team
local.allies = spawn info_player_allied targetname alla
local.allies.angle = 1
local.allies.origin = ( 1 1 1 )
local.axis = spawn info_player_axis targetname axisa
local.axis.angle = 1
local.axis.origin = ( 11 11 11 )
end
ini_switches:
local.ent = spawn script_model
local.ent model "animate/trainswitch_pulsating.tik"
local.ent.origin = ( 14 14 14 )
local.ent.angle = 0
local.atrig = spawn trigger_use targetname loca_trig
local.atrig.origin = ( 14 14 14 )
local.atrig setsize ( -10 -10 0 ) ( 10 10 50 )
local.atrig setthread control_spawna
end
//Control the spawn A
control_spawna:
if( level.bRoundStarted == 1 )
{
if( parm.other.dmteam == axis )
{
if( $obj_hold_spawna.ControlledBy != 0 )
{
//Take the objective
$obj_hold_spawna TakeOver 0
iprintln "The Axis control the spawnA!"
//Axis Spawn
waitthread openaxisa
}
}
else if( parm.other.dmteam == allies )
{
if( $obj_hold_spawna.ControlledBy != 1 )
{
//Take the objective
$obj_hold_spawna TakeOver 1
iprintln "The Allies control the spawnA!"
//Allied Spawn
waitthread openallieda
}
}
thread set_objectives
}
end
set_objectives:
//First lets do the allies
if( $obj_hold_spawna.ControlledBy == 0 || $obj_hold_spawna.ControlledBy == 2 )
{
$obj_hold_spawna SetCurrent 1
}
//Now the Axis
if( $obj_hold_spawnb.ControlledBy == 1 || $obj_hold_spawnb.ControlledBy == 2 )
{
$obj_hold_spawnb SetCurrent 0
}
end
openaxisa:
thread axisspawna
local.spotter = spawn func_beam
local.spotter.origin = ( 8 8 8 )
local.spotter.angles = ( 0 0 0 )
local.spotter endpoint ( 8 8 218 )
local.spotter minoffset 0.0
local.spotter maxoffset 0.0
local.spotter alpha 1.0
local.spotter color ( 1.0 1.0 1.0 )
local.spotter scale 20.0
local.spotter tileshader ("textures/hud/allies_headicon.tga")
local.spotter numsegments 1
local.spotter activate
iprintlnbold "Axis control the spawnA!"
end
spawna:
thread allspawna
local.spotter = spawn func_beam
local.spotter.origin = ( 8 8 8 )
local.spotter.angles = ( 0 0 0 )
local.spotter endpoint ( 8 8 218 )
local.spotter minoffset 0.0
local.spotter maxoffset 0.0
local.spotter alpha 1.0
local.spotter color ( 1.0 1.0 1.0 )
local.spotter scale 20.0
local.spotter tileshader ("textures/hud/allies_headicon.tga")
local.spotter numsegments 1
local.spotter activate
iprintlnbold "Allies control the spawnA!"
end
axisspawna:
$axisa enablespawn
end
allspawna:
$alla enablespawn
end
[/code]
Posted: Wed Jan 12, 2005 5:17 pm
by Grassy
It might be better to use waitthread when calling threads that set up spawn points to give them priority.
Also I noticed you are calling threads that dont exist, that will stop a script in it's tracks and nothing will be executed.