Frictional Games Forum (read-only)
[SCRIPT] Map choosing - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Map choosing (/thread-20966.html)



Map choosing - FlawlessHappiness - 03-29-2013

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.


RE: Map choosing - ClayPigeon - 03-29-2013

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:
Code:
//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.


RE: Map choosing - FlawlessHappiness - 03-29-2013

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