Page 1 of 1

script problem

Posted: Fri Apr 25, 2003 12:13 pm
by Bender
Bots can plant and diffuse bombs. When Allies plant their 2 bombs and then explode, the allied team wins. So far, so good.

But when the axis team plants their bomb, which works, the level doesn't finish. It only finishes after the allied team met their objectives.

Here's the script:

-------------------------------------------------------------------------------------
main:
setcvar "g_scoreboardpic" "scr1"
setcvar "g_obj_alliedtext1" "Destroy the:"

setcvar "g_obj_axistext1" "Defend the radio"
setcvar "g_obj_axistext2" "and com dish."
setcvar "g_obj_axistext3" " "
setcvar "g_obj_axistext4" "Destroy the ammo depot"

exec global/DMprecache.scr
soundtrack "music/opcenter_bots_obj.mus"
forcemusic normal

$world farplane_color "0.752941 0.752941 0.752941"
level.fogplane=9000
$world farplane level.fogplane

level waittill spawn

$radio_sparks anim stop
$dish_inferno anim stop

setcvar "g_obj_alliedtext2" "[ ] Radio"
setcvar "g_obj_alliedtext3" "[ ] Dish"


level.dmrespawning = 1

level.clockside = kills
level.dmroundlimit_allowoverwrite = 1
level.dmroundlimit = 10
level.alliesbots = 5
level.axisbots = 5


$table_bomb thread global/jv_obj_dm.scr::bomb_thinker
$dish_bomb thread global/jv_obj_dm.scr::bomb_thinker
$gun_bomb thread global/jv_obj_dm.scr::bomb_thinker
waitthread global/jv_bots/jv_mp_ai.scr::enable 0 0 0 0

while !(level.roundstart)
wait 0.1

$speaker_radio loopsound m2l1_radio3
$speaker_amb_radio loopsound m2l1_radio3
$speaker_alarm loopsound m2l1_radio3
$speaker_cricket loopsound cricket

thread dish
thread table


while !(level.obj[dish] == 1 && level.obj[table] == 1)
wait 1

teamwin allies
end

thread gun

while !(level.obj[gun] == 1)
wait 1

teamwin axis
end

dish:
while($dish_bomb.exploded != 1)
wait 0.5
iprintlnbold_noloc "The Allies have destroyed the dish!"
level.obj[dish] = 1

setcvar "g_obj_alliedtext3" "[X] Dish"

$dish_inferno anim start
end

table:
while($table_bomb.exploded != 1)
wait 0.5

$speaker_radio stoploopsound m2l1_radio3
$radio_sparks anim start

iprintlnbold_noloc "The Allies have destroyed the radio!"
level.obj[table] = 1

setcvar "g_obj_alliedtext2" "[X] Radio"


end

gun:
while($gun_bomb.exploded != 1)
wait 0.5

$speaker_radio stoploopsound m2l1_radio3
$radio_sparks anim start

iprintlnbold_noloc "The Allies have destroyed the ammo depot!"
level.obj[gun] = 1

setcvar "g_obj_axistext2" "[X] ammo depot"

end

-------------------------------------------------------------------------------------

Posted: Fri Apr 25, 2003 3:06 pm
by mohaa_rox
i think you'll have to add threads, like:

thread alliedvictory
thread axisvictory

alliedvictory:
//code here
end

axisvictory:
//code here
end

Posted: Fri Apr 25, 2003 4:29 pm
by Bender
:D thanx mate, worked like a charm.

You make scripting a fun job.

Posted: Sat Apr 26, 2003 3:11 am
by mohaa_rox
np, scripting IS fun.