Page 1 of 1

Disable objectives until 2 players have joined?

Posted: Thu Oct 23, 2003 6:09 am
by sysQuik
Does anyone know how the objectives in a TOW map are disabled until at least 2 players, each on different teams have joined? The tutorial_tow file has the bombs disabled, but a player can go through and flip the switches before another player is in.

In the all of the actually TOW maps, the objectives are disabled until both teams have players. If you try to flip a switch before an opponent is in, nothing happens. I've gone through the level scripts, but I didn't see anything. I know how to disable stuff until the round starts, using level waittill roundstart, but that doesn't help if a single player has joined and started the round.

Anyone have any ideas?

Thanks a lot!
Sysquik

Posted: Thu Oct 23, 2003 7:32 am
by jv_map
How can 1 player start the round? :?

Posted: Fri Oct 24, 2003 5:03 am
by sysQuik
I guess more of what I'm asking is how much of the script is run again when a new round starts? Do all of the lines of main get run again, like:

level waittill prespawn
level waittill spawn
level waittill roundstart
ect

Thanks for your response!

Sysquik

test

Posted: Fri Oct 24, 2003 7:26 am
by tltrude
Here is a little test script you can run to find out.

main:

level waittill prespawn
iprintln "Prespawn check........"

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

level waittill spawn
iprintln "Spawn check........"

level waittill roundstart
iprintln "Roundstart check........"

end


//The text should show up on the left side of the screen.

Posted: Fri Oct 24, 2003 7:40 am
by jv_map
You also need an iprintln above prespawn for the test to be really successful :wink:

Anyway I think any following round the script 'starts' at level waittill spawn (that may also explain why you can't have more than 1 level waittill spawn).

Posted: Fri Oct 24, 2003 3:15 pm
by nuggets
level waittill spawn can be used in infinite threads, but not after a level waittill spawn, as you've already spawned

level waittill prespawn
thread 1
thread 2
thread 3
end

1:
level waittill spawn
//do stuff
end

2:
level waittill spawn
//do more stuff
end

3:
//do stuff before spawning
end

Posted: Sat Oct 25, 2003 12:39 am
by nuggets
you could create a loop to see if a person of a specific team is in there or a person of both teams are in,

thread player_count
end

player_count:
if ($player.size > 1) //if more than 1 player
{
level.allies = 0 //reset counters
level.axis = 0
for (local.i=1;local.<=$player.size;local.i++)
{
if ($player[local.i].dmteam == "allies") //if players team is allied
{level.allies++}
if ($player[local.i].dmteam == "axis") //if players team is axis
{level.axis}
}
}
//if (level.allies > 0) //if at least 1 ally
// if (level.axis > 0) //if at least 1 axis
if ((level.allies > 0) && (level.axis > 0) //if at least 1 ally AND 1 axis
// if ((level.allies > 0) || (level.axis > 0) //if at least 1 ally OR 1 axis
// just take out the slashes of the one you need and comment out the red line by inserting //
{
thread the_setup
end
}
else
{
wait 1
goto player_count
}

the_setup:
//do what you want here
end

Posted: Sat Oct 25, 2003 4:11 am
by sysQuik
Thanks for everyones responses! I'm going to setup a test script and see what comes of it. Thanks nuggets for the script, that would take care of it once and for all. I still want to understand how the main section of a script is executed better.

Thanks,
Sysquik