Disable objectives until 2 players have joined?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
sysQuik
Corporal
Posts: 25
Joined: Fri Feb 07, 2003 9:54 am

Disable objectives until 2 players have joined?

Post 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
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

How can 1 player start the round? :?
Image
sysQuik
Corporal
Posts: 25
Joined: Fri Feb 07, 2003 9:54 am

Post 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
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

test

Post 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.
Tom Trude,

Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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).
Image
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post 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
hope this helps, prob not cos it's all foreign 2 me :-/
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post 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
hope this helps, prob not cos it's all foreign 2 me :-/
sysQuik
Corporal
Posts: 25
Joined: Fri Feb 07, 2003 9:54 am

Post 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
Post Reply