how to make an intermission script?

FroggityHoppity
Joined 17/11/2018
Posts 5
01:06 PM 18/11/2018
Like a script when 1 player joins it says "2 Players Needed" and when 2 join it will say "Game Starting soon" than wait 10 seconds and than a map will spawn and than a countdown 15 and than they will be telported? does anybody know how to do this in the GML Language? thanks!!


[TylFT] Tylorfoot
Joined 03/06/2017
Posts 6,581
06:34 PM 18/11/2018
global.MAX_TIME = 120;
global.TIME = 0;

script = '
if(instance_number(obj_client) > 1 {
if(global.TIME > 0) {
if(global.TIME == 120) {
messageAll("The minigame has started!");
with obj_client {playerRespawn(id);}
}
topPrintAll(string(global.TIME)+" seconds remaining",1);
global.TIME -= 1;
schedule(1000,script);
} else {
messageAll("The minigame is over!");
messageAll("Restarting in 10 seconds...");
global.TIME = global.MAX_TIME;
schedule(10000,script);
}
} else {
centerPrintAll("2 players required",1)
schedule(1000,script)
}
';
execute_string(script);


FroggityHoppity
Joined 17/11/2018
Posts 5
03:10 PM 19/11/2018
I mean like when game starts they get tped to a location and than 15 seconds a flood starts. 1 stud per second. it will stop at a specific location that I will put and when the flood stops. 10 seconds later it resets and loops again


FroggityHoppity
Joined 17/11/2018
Posts 5
03:12 PM 19/11/2018
like add a tp and a flood starts and ends into this code.

global.MAX_TIME = 120;
global.TIME = 0;

script = '
if(global.TIME > 0) {
if(global.TIME == 120) {
messageAll("The minigame has started!");
with obj_client {playerRespawn(id);}
}
topPrintAll(string(global.TIME)+" seconds remaining",1);
global.TIME -= 1;
schedule(1000,script);
} else {
messageAll("The minigame is over!");
messageAll("Restarting in 10 seconds...");
global.TIME = global.MAX_TIME;
schedule(10000,script);
}
';
execute_string(script);

1