Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
riki2321

Countdown script (doom in UDMF format zDOOM)

Recommended Posts

Put this script to the SCRIPTS window:

#include "zcommon.acs"

script 1 ENTER
{
    Delay(12600); // 1 tic = 1/35 second, 35 tics = 1 second, 2100 tics = 1 minute, and 12600 tics = 6 minutes
    DamageThing(10000,0); // Deal 10000 damage to the player
}
Reference:
http://zdoom.org/wiki/ACS
http://zdoom.org/wiki/Delay
http://zdoom.org/wiki/DamageThing

The code above only handles the killing after 6 minutes, not any visible countdown. If you want visible second-by-second countdown, keep it in an integer variable and print it via HudMessage in regular intervals with Delay(35) between them.

Share this post


Link to post
scifista42 said:

Put this script to the SCRIPTS window:

#include "zcommon.acs"

script 1 ENTER
{
    Delay(12600); // 1 tic = 1/35 second, 35 tics = 1 second, 2100 tics = 1 minute, and 12600 tics = 6 minutes
    DamageThing(10000,0); // Deal 10000 damage to the player
}
Reference:
http://zdoom.org/wiki/ACS
http://zdoom.org/wiki/Delay
http://zdoom.org/wiki/DamageThing

The code above only handles the killing after 6 minutes, not any visible countdown. If you want visible second-by-second countdown, print it via HudMessage in regular intervals with Delay(35) between them.


Ok so i made this

#include "zcommon.acs"

script 1 ENTER
{
Delay(12600); // 1 tic = 1/35 second, 35 tics = 1 second, 2100 tics = 1 minute, and 12600 tics = 6 minutes
DamageThing(10000,0); // Deal 10000 damage to the player
}

script 2 ENTER
{
HudMessage(s:"A bomb has been set up. You gotta get out!"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
Delay(2100);
HudMessage(s:"5:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
Delay(2100);
HudMessage(s:"4:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
Delay(2100);
HudMessage(s:"3:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
Delay(2100);
HudMessage(s:"2:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
Delay(2100);
HudMessage(s:"1:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
Delay(1050);
HudMessage(s:"0:50 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
Delay(1050);
HudMessage(s:"0:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
}

Share this post


Link to post
riki2321 said:

HudMessage(s:"1:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
Delay(1050);
HudMessage(s:"0:50 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
Delay(1050);
HudMessage(s:"0:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);

There are actually 60 seconds in a minute, not 100. Half a minute is 0:30. :p

You can do both with a single script, by the way:

script 1 ENTER
{
	HudMessage(s:"A bomb has been set up. You gotta get out!"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(2100);
	HudMessage(s:"5:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(2100);
	HudMessage(s:"4:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(2100);
	HudMessage(s:"3:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(2100);
	HudMessage(s:"2:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(2100);
	HudMessage(s:"1:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(1050);
	HudMessage(s:"0:30 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(1050);
	HudMessage(s:"Too late now!"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	DamageThing(10000,0); // Deal 10000 damage to the player
}
Or you can even do it this way:
script 1 ENTER
{
	int timer = 6*60*35;
	while (timer > 0)
	{
		int seconds = timer / 35;
		int minutes = seconds / 60;
		seconds %= 60;
		HudMessage(d:minutes, s:":", d:seconds, s:" left!"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3);
		Delay(35);
	}
	DamageThing(10000,0); // Deal 10000 damage to the player
}

Share this post


Link to post
Gez said:

There are actually 60 seconds in a minute, not 100. Half a minute is 0:30. :p

You can do both with a single script, by the way:

script 1 ENTER
{
	HudMessage(s:"A bomb has been set up. You gotta get out!"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(2100);
	HudMessage(s:"5:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(2100);
	HudMessage(s:"4:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(2100);
	HudMessage(s:"3:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(2100);
	HudMessage(s:"2:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(2100);
	HudMessage(s:"1:00 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(1050);
	HudMessage(s:"0:30 left"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	Delay(1050);
	HudMessage(s:"Too late now!"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3.7);
	DamageThing(10000,0); // Deal 10000 damage to the player
}
Or you can even do it this way:
script 1 ENTER
{
	int timer = 6*60*35;
	while (timer > 0)
	{
		int seconds = timer / 35;
		int minutes = seconds / 60;
		seconds %= 60;
		HudMessage(d:minutes, s:":", d:seconds, s:" left!"; HUDMSG_PLAIN, 0, 0, 0.1, 0.8, 3);
		Delay(35);
	}
	DamageThing(10000,0); // Deal 10000 damage to the player
}


1 A global identifier already has this name (line 4)

2 Missing '(' (line 5)

Share this post


Link to post

Just replace "timer" by some other name if that name is reserved. Like "bombcountdown" for example.

Share this post


Link to post
Gez said:

Just replace "timer" by some other name if that name is reserved. Like "bombcountdown" for example.


thanks now what to do with the (

can't seem to find it

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×