Steal obj and get to another place
Moderator: Moderators
Steal obj and get to another place
Is there a way to make it so after they steal the obj in multiplayer they get to a certain place with it to win? The problem would be if they died to make the documents return to the spot where they started.
- Axion
- Major General
- Posts: 683
- Joined: Mon Sep 29, 2003 5:14 am
- Location: Northern California
- Contact:
There's an objective map in Breakthrough (Palermo) that fits your description. There's a map that the Axis need to steal/memorize which is located in a room with a locked door. They have to blow the door open and any person on the team can memorize the map by walking up to it and pressing the use key. They then need to return to their spawn in order to win. Here's the script:
Hopefully that will provide some clues/help.
Code: Select all
//MP_Palermo_OBJ
//ARCHITECTURE: Jeff Zaring
//SCRIPTING: Jason Abbott
main:
level.gametype = int( getcvar( g_gametype ) )
if( level.gametype == 1 )
{
$crustywerfer angle 254
$crustywerfer_turret0 maxyawoffset 45.0
$crustywerfer nodamage
$crustywerfer_turret0 nodamage
}
else
{
$crustywerfer remove
}
if( level.gametype == 4 )
{
setcvar "g_obj_alliedtext1" ( loc_convert_string "Protect the" ) // do not change these objectives
setcvar "g_obj_alliedtext2" ( loc_convert_string "Documents" )
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ( loc_convert_string "Retrieve the" ) // do not change these objectives
setcvar "g_obj_axistext2" ( loc_convert_string "Documents" )
setcvar "g_obj_axistext3" ""
}
else
{
setcvar "g_obj_alliedtext1" ""
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" "Palermo"
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
}
setcvar "g_scoreboardpic" "MP_Palermo_OBJ"
level.music="MP_Palermo"
level waittill prespawn
//*** Precache Dm Stuff
exec global/DMprecache.scr
level.script = maps/obj/MP_Palermo_OBJ.scr
exec global/ambient.scr obj_team4
exec global/exploder.scr
//thread global/exploder.scr::explode 10141
//thread global/exploder.scr::main
//thread global/minefield.scr::minefield_setup
exec global/door_locked.scr::lock
$dm_door_locked thread global/door_locked.scr::door_locked_wood
level waittill spawn
if (level.gametype == 4)
{
level.defusing_team = "allies"
level.planting_team = "axis"
level.targets_to_destroy = 1 // only one of the two bombs in the level needs to be blown
level.bomb_damage = 300
level.bomb_explosion_radius = 1024
}
level.dmroundlimit = 5 // round time limit in minutes
if (level.gametype == 4)
{
// set the parameters for this round/wave based match
level.clockside = allies // set to axis, allies, kills, or draw
} else
{
// set the parameters for this round/wave based match
level.clockside = kills // set to axis, allies, kills, or draw
}
if (level.gametype > 1)
{
$dm_door_1 remove
$dm_door_2 remove
$dm_door_locked remove
level waittill roundstart
}
if (level.gametype == 4)
{
$obj_bomb thread bomb_thinker
thread axis_win_bomb
thread allied_win_timer
addobjective 1 1 "" $obj_bomb.origin
setcurrentobjective 1
}
else
{
$obj_bomb remove
$bomb_trigger remove
$AxisHQ remove
}
end
//*** --------------------------------------------
//*** Play a creaking board sound if the player runs up the steps
//*** --------------------------------------------
creakyboards:
self nottriggerable
local.speed = vector_length( parm.other.velocity )
if (local.speed > 120)
{
self playsound creakyboards
}
wait 3
self triggerable
end
//*** --------------------------------------------
//*** Bomb Code
//*** --------------------------------------------
bomb_thinker:
level.bomb_defuse_time = 20 //tenths of a second
level.bomb_set_time = 10 //tenths of a second, 50
level.bomb_tick_time = 10 //seconds, 15
level.bomb_explosion_radius = 1054 //quake units
level.bomb_use_distance = 128 //quake units
level.bomb_damage = 200
level.bombusefov = 30
level.subtitleX = 100
level.subtitleY = 50
self.live = 0
if (self.target != NIL && self.target != NULL && $(self.target) != NULL)
{
self.target.collisionent = self.target.target
self.target notsolid
}
thread bomb_waittill_set
end
bomb_waittill_set:
self model items/pulse_explosive.tik
while ( $(self.trigger_name) )
{
self.trigger_name waittill trigger
local.player = parm.other
if (local.player.dmteam != level.planting_team)
{
local.player iprint ( loc_convert_string "You are the wrong team to plant a bomb here!" )
goto bomb_waittill_set
}
local.counter = 0
while ( (Isalive local.player) && (local.player cansee self level.bombusefov level.bomb_use_distance) && (local.player.useheld == 1) && self.live == 0 )
{
if (local.counter == 0)
local.player stopwatch (level.bomb_set_time * .1)
local.counter++
wait 0.1
if (local.counter >= level.bomb_set_time)
{
iprintlnbold ( loc_convert_string "The Axis have planted a bomb!" )
if (level.planting_team == "allies")
self playsound dfr_objective_o
else
self playsound den_objective_o
thread bomb_waittill_defuse
thread bomb_waittill_explode
self.live = 1
end
}
}
if (local.counter > 0)
local.player stopwatch 0
}
end
bomb_waittill_defuse:
while ( $(self.trigger_name) )
{
self.trigger_name waittill trigger
local.player = parm.other
if (local.player.dmteam != level.defusing_team)
{
local.player iprint ( loc_convert_string "You're on the wrong team to defuse this bomb!" )
goto bomb_waittill_defuse
}
local.counter = 0
while ( (Isalive local.player) && (local.player cansee self level.bombusefov level.bomb_use_distance) && (local.player.useheld == 1) && self.live == 1 )
{
if (local.counter == 0)
local.player stopwatch (level.bomb_defuse_time * .1)
local.counter++
wait 0.1
if (local.counter >= level.bomb_defuse_time)
{
iprintlnbold ( loc_convert_string "The Axis bomb has been defused!" )
if (level.defusing_team == "allies")
self playsound dfr_diffused_d
else
self playsound den_diffused_d
thread bomb_waittill_set //start first thread again
self.live = 0
end
}
}
if (local.counter > 0)
local.player stopwatch 0
}
end
bomb_waittill_explode:
self model items/explosive.tik
self playsound plantbomb
self loopsound bombtick
local.start_time = level.time
while (level.time < (local.start_time + level.bomb_tick_time) )
{
wait 0.1
if (self.live != 1)
{
self stoploopsound
end
}
if (level.time == (local.start_time + level.bomb_tick_time - 10) )
{
self stoploopsound
self loopsound final_countdown
}
}
self stoploopsound
thread bomb_explode
end
bomb_explode:
self.trigger_name remove
thread global/obj_dm.scr::jitter_large 0
if (self.exploder_set != NIL)
{
thread global/exploder.scr::explode self.exploder_set
}
if (self.explosion_fx != NIL)
self thread global/obj_dm.scr::spawn_fx self.explosion_fx
if (self.explosion_sound != NIL)
self playsound self.explosion_sound
if (self.target != NIL && self.target != NULL && self.target != "" && self.target.size == 1)
{
if (self.target.destroyed_model != NIL)
{
local.damaged = self.target thread spawn_damaged self.target.destroyed_model
}
if (self.exploder_set == NIL)
{
self.target remove
}
waitframe
}
radiusdamage self.origin level.bomb_damage level.bomb_explosion_radius
if (self.killarea != NIL)
{
self.killarea volumedamage 1000
}
self hide
self notsolid
self remove
self.live = 0
set_objective_pos $map
// we delay the decrementing of level.bombs_planted so that
// the script has time to determin the winner before the
// timelimit gets checked and hit
wait 0.5
end
//*** --------------------------------------------
//*** This player has to run home to win
//*** --------------------------------------------
view_map local.player:
if ( local.player.dmteam != "axis" ) {
end
}
if ( ! (local.player cansee $map 60 80) ) {
end
}
if ( local.player.seenMap == 1 ) {
local.player iprint ( loc_convert_string "You've memorized the map! Run the back to the headquarters!!!" )
// local.player iprint ( loc_convert_string ( local.player.netname + " has already memorized the map!!!" ) )
end
}
local.player thread run_home_to_win
end
setCompass:
for (local.i = 1; local.i <= $player.size; local.i++)
{
if ( ! (Isalive $player[local.i] ) )
continue
if ( $player[local.i].dmteam != "axis" )
continue
if ( $player[local.i].seenMap != 1 )
continue
set_objective_pos $AxisHQ[1]
end
}
set_objective_pos $map
end
run_home_to_win:
self.seenMap = 1
set_objective_pos $AxisHQ[1]
iprintln ( loc_convert_string ( self.netname + " has a copy of the Allies map!" ) )
self iprint ( loc_convert_string "You've memorized the map! Run the back to the headquarters!!!" )
while ( self != NULL )
{
if ( ! (Isalive self) )
{
iprintln ( loc_convert_string "The Axis spy has been killed!" )
self.seenMap = 0
thread setCompass
end
}
if ( self.dmteam != "axis" )
{
iprintln ( loc_convert_string "Axis spy has defected!" )
self.seenMap = 0
thread setCompass
end
}
for (local.i = 1; local.i <= $AxisHQ.size; local.i++) {
if ( self isinside $AxisHQ[local.i] )
{
iprintln ( loc_convert_string "The Axis has won!" )
thread AxisVictory
end
}
}
wait 0.1
}
iprintln ( loc_convert_string "The Axis spy has vanished!" )
end
//*** --------------------------------------------
//*** "Axis Victory"
//*** --------------------------------------------
AxisVictory:
teamwin axis
end
axis_win_bomb:
level waittill axiswin
end
//*** --------------------------------------------
//*** "Allied Victory"
//*** --------------------------------------------
allied_win_timer:
level waittill allieswin
end
"The work of a thousand years is nothing but rubble."
- Dr. Carl Goerdeler (1943)
Visit my mapping site: http://www.freewebs.com/axion9

- Dr. Carl Goerdeler (1943)
Visit my mapping site: http://www.freewebs.com/axion9

-
Green Beret
- Major General
- Posts: 746
- Joined: Mon Apr 19, 2004 12:21 pm
- Contact:
You could just hide the documents when a player picks them up and show them again when he dies. Are you attaching documents to the player when he picks them up ? When a player picks up the documents you can set a variable on that player . This thread was for a map where you could pick up a radio to use for calling an airraid.
A thread like this thread would be run from a trigger_use for example except that you would not need to move the documents like this radio is moved after the player dies. You notice in this thread that the trigger was moved too when the player died too so you would not have to do that either .
all you would have to do is put in something that attaches some documents to the player then removes them when he dies . For the end spot all you would have to do is to check if the variable that you will set was set or not in a thread run by a trigger useing setthread .
A thread like this thread would be run from a trigger_use for example except that you would not need to move the documents like this radio is moved after the player dies. You notice in this thread that the trigger was moved too when the player died too so you would not have to do that either .
Code: Select all
airraid_player:
level.radioplayer=parm.other
level.radioplayer.airstrike=1
level.player_hasradio=1
$radio hide
$radio notsolid
$radio_trigger nottriggerable
local.team = parm.other.dmteam
while((isalive level.radioplayer)&&(level.radioplayer.dmteam == local.team))
waitframe
$radio.origin=level.radioplayer.origin
$radio show
$radio_trigger.origin =level.radioplayer.origin
$radio_trigger triggerable
level.player_hasradio=0
level.radioplayer.airstrike=0
level.radioplayer= null
end-
Green Beret
- Major General
- Posts: 746
- Joined: Mon Apr 19, 2004 12:21 pm
- Contact:
Read this thread, It has a couple different examples
http://dynamic.gamespy.com/~map/mohaa/f ... php?t=6158
http://dynamic.gamespy.com/~map/mohaa/f ... php?t=6158
-
Green Beret
- Major General
- Posts: 746
- Joined: Mon Apr 19, 2004 12:21 pm
- Contact:
That is for Multiplayer.
Just change the targetnames to match yours.
Theres jus a sample for the code, Read the thread and youll find what you need.If your looking for a .pk3 already done, Im not sure if there is one.
Just change the targetnames to match yours.
Code: Select all
thread objs
end
objs:
// handles the objectives for the mission.
waitthread global/objectives.scr::add_objectives 1 2 "Steal the documents." $documents.origin //compass
waitthread global/objectives.scr::current_objectives 1
end
objective1:
// remove the docs
// should have a trigger_use with a setthread to this thread.
$documents remove //documents disappear after player's reached them
end
Thread objs doesnt work.
but this:
Trigger_use called airraid_player if used
airraid_player:
if ( parm.other.dmteam != "allies" ) {
end
}
level.radioplayer=parm.other
level.radioplayer.airstrike=1
level.player_hasradio=1
$map hide
$map notsolid
$map_trigger nottriggerable
set_objective_pos $base
local.team = parm.other.dmteam
while((isalive level.radioplayer)&&(level.radioplayer.dmteam == local.team))
waitframe
$map.origin=level.radioplayer.origin
$map show
$map_trigger.origin =level.radioplayer.origin
$map_trigger triggerable
level.player_hasradio=0
level.radioplayer.airstrike=0
level.radioplayer= null
set_objective_pos $map
end
allies can steal docus, axis not
allies let them fall when died
allies can pick them up again, axis not
Now i have created a trigger_multiple, targetname $base, setthread win
trigger works every time an allied go into. without papers too
Heres the script - can someone help please?
Finish is: Is allied, has papers, is alive, is in base
win:
if ( parm.other.dmteam != "allies" ) {
end
}
level.radioplayer=parm.other
level.radioplayer.airstrike=1
level.player_hasradio=1
iprintlnbold "Die Allierten haben gesiegt!"
thread allieswins
while((isalive level.radioplayer)&&(level.radioplayer.dmteam == local.team))
waitframe
end
but this:
Trigger_use called airraid_player if used
airraid_player:
if ( parm.other.dmteam != "allies" ) {
end
}
level.radioplayer=parm.other
level.radioplayer.airstrike=1
level.player_hasradio=1
$map hide
$map notsolid
$map_trigger nottriggerable
set_objective_pos $base
local.team = parm.other.dmteam
while((isalive level.radioplayer)&&(level.radioplayer.dmteam == local.team))
waitframe
$map.origin=level.radioplayer.origin
$map show
$map_trigger.origin =level.radioplayer.origin
$map_trigger triggerable
level.player_hasradio=0
level.radioplayer.airstrike=0
level.radioplayer= null
set_objective_pos $map
end
allies can steal docus, axis not
allies let them fall when died
allies can pick them up again, axis not
Now i have created a trigger_multiple, targetname $base, setthread win
trigger works every time an allied go into. without papers too
Heres the script - can someone help please?
Finish is: Is allied, has papers, is alive, is in base
win:
if ( parm.other.dmteam != "allies" ) {
end
}
level.radioplayer=parm.other
level.radioplayer.airstrike=1
level.player_hasradio=1
iprintlnbold "Die Allierten haben gesiegt!"
thread allieswins
while((isalive level.radioplayer)&&(level.radioplayer.dmteam == local.team))
waitframe
end
-
Green Beret
- Major General
- Posts: 746
- Joined: Mon Apr 19, 2004 12:21 pm
- Contact:

