Page 1 of 1

Multi OBJ's

Posted: Wed May 19, 2004 4:13 am
by {WSS|P}Velociraptor
Hello, I would like to have two bombs in my map and I can oly get one to work at a time.


I HAVE READ THE MULTI OBJ TUTUORIAL


Could some one give a sample script file of what it looks like?



Thankz.

obj_team2

Posted: Wed May 19, 2004 1:12 pm
by tltrude
Here is the script from obj_team2 "V2 Facility". It may be different from the tutorial, as there are different ways of doing it. I have color coded the two bombs.

========================================

// V2 FACILITY
// ARCHITECTURE: POWZER
// SCRIPTING: POWZER

main:

setcvar "g_obj_alliedtext1" "- Destroy the Control"
setcvar "g_obj_alliedtext2" "Room"
setcvar "g_obj_alliedtext3" "- Destroy V2 Rocket"

setcvar "g_obj_axistext1" "- Defend the Control"
setcvar "g_obj_axistext2" " Room and the V2"
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "objdm2"

level waittill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr

//***Flyby Planes
exec global/bomber.scr

//***Ambient sounds
level.script = maps/obj/obj_team2.scr
exec global/ambient.scr obj_team2

exec global/door_locked.scr::lock
thread global/exploder.scr::main

level waittill spawn

level.defusing_team = "axis"
level.planting_team = "allies"
level.bomb_damage = 200
level.bomb_explosion_radius = 2048

// set the parameters for round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw

level waittill roundstart


$v2_explode thread global/obj_dm.scr::bomb_thinker
$ctrlroom_explode thread global/obj_dm.scr::bomb_thinker

thread allies_win_bomb $v2_explode $ctrlroom_explode // sends bomb names to new thread.
$v2_explode thread axis_win_timer

end


allies_win_bomb local.bomb1 local.bomb2:

while (local.bomb1.exploded != 1) // ( != ) means "does not equal".
wait .1
while (local.bomb2.exploded != 1)
wait .1

teamwin allies
end

//*** --------------------------------------------
//*** "Axis Victory"
//*** --------------------------------------------

axis_win_timer:

level waittill axiswin

end

========================================

The global/obj_dm.scr bomb thinkers are what set "self.exploded = 1" when a bomb goes off. That makes the "while" loops untrue and stop looping, allowing the script to continue to the team win.

Hope that helps!