Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Map choosing
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#1
Map choosing

I'm just gonna tell you how it is.

There is a main map, which you walk around in.

Then, at a specific point I call the ChangeMap function, and want the player to change map.
It has to change to one of the 10 maps. This map should be picked, randomly. Maybe with the RandInt(1, 10) function

After completing this first map, the player returns to the main map.
Again at a specific point I will call the ChangeMap function, and the player must be changed to one of the 10 maps, BUT it must not be the same as he just went to, or any other he has been at.

When all the maps are completed, he can start over again...

Is there a way i can script this?

It's like

1. Choose random map.
2. Choose new random map, that is not the already chosen.
3. When all maps are tried, with a random map, from 1 out of the 10.

Trying is the first step to success.
03-29-2013, 04:32 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#2
RE: Map choosing

For this method, I recommend you naming your maps in the following order:
Map_01, Map_02, or map1, map2 and so on. I'll use the Map_0x for this example:
//At the first time
int rand_1 = RandInt(1, 10);
ChangeMap("Map_0"+rand_1+".map", "PlayerStartArea_1", "StartSound.snt", "OtherSound.snt");

//At later times
int rand_2;
do
{
rand_2 = RandInt(1, 10);
}
while(rand_2 == rand_1);

ChangeMap("Map_0"+rand_2+".map", "PlayerStartArea_2", "StartSound.snt", "OtherSound.snt");

//At the third time
int rand_3;
do
{
rand_3 = RandInt(1,10);
}
while( !((rand_3 != rand_2) && (rand_3 != rand_1)) );
ChangeMap("Map_0"+rand_3+".map", "PlayerStartArea_3", "StartSound.snt", "OtherSound.snt");

I hope you got my example.
(This post was last modified: 03-29-2013, 04:42 PM by ClayPigeon.)
03-29-2013, 04:40 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#3
RE: Map choosing

Yea, i think i got it. You used the while-function.

But in this case the problem is that the script don't know when it's the first, second, third, and so on

Trying is the first step to success.
03-29-2013, 04:58 PM
Find




Users browsing this thread: 1 Guest(s)