script problem

Please use this forum to ask all your MoHAA Bots questions / discussions

Moderator: Moderators

Post Reply
Bender
Private
Posts: 3
Joined: Mon Apr 21, 2003 9:13 pm

script problem

Post 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

-------------------------------------------------------------------------------------
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

i think you'll have to add threads, like:

thread alliedvictory
thread axisvictory

alliedvictory:
//code here
end

axisvictory:
//code here
end
Live to map, not map to live.
-mohaa_rox, .map
moderator
Bender
Private
Posts: 3
Joined: Mon Apr 21, 2003 9:13 pm

Post by Bender »

:D thanx mate, worked like a charm.

You make scripting a fun job.
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

np, scripting IS fun.
Live to map, not map to live.
-mohaa_rox, .map
moderator
Post Reply