Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
cyber-menace

Countdown

Recommended Posts

Is there anyway using Doom2 or Zdoom features to make an on screen countdown? If so how? I know of one way but it would require me to type print (s:""); 300 times... is there an easier way? Oh yes I want this countdown to last 5 minutes before activating a script.

Share this post


Link to post

Here's a simple way (I hope):

script 1 (void)
{
    int var0;

    var0 = 300;
    do
    {
        print(d:var0, s:" SECONDS REMAINING");
        delay(35);
        var0--;
    }   until(var0 == 0);
    if(var0 == 0)
    {
        Whatever;
    }
}

Share this post


Link to post

revising Ichors:

script 1 (void)
{
    int var0 = 300;
    while(!var)
    {
        print(d:var0, s:" SECONDS REMAINING");
        delay(35);
        var0--;
    }
    //do stuff here
}
if you want it to print out mins as well (ie instead of 300 seconds, 5:00) that requires a couple extra lines of code and some padding but nothing too complex. you could also use hudmessage(); instead of print which allows a lot more freedom, in this case you can position the time anywhere on screen (print just centers it) or have it fade out upon completion.

Share this post


Link to post

It works except for one problem. It won't activate the function that comes after the countdown. Here's what I have so far...

#include "zcommon.acs"
int countd;

script 1 OPEN
{
print (s:"Objective 1\n\nFind the next elevator.");
Delay (5*35);
print (s:"Warning! Multiple bomb threats detected!");
Delay (3*35);
print (s:"All personel evacuate immediatly!");
Delay (5*35);
countd = 5;
do
{
print(d:countd, s:" Seconds Until Explosion");
delay(35);
countd--;
}   until(countd == 0);
if(countd == 0)
{
Thing_Damage (1, 400);
terminate;
}
}
What do I need to do?

Share this post


Link to post

When I use your script Cyb the countdown doesn't even get displayed. Can you show me the lines of scripting necessary to display it in minutes in the upper right hand corner. If so thanks.

Share this post


Link to post

Cyb's while loop says while (!var) and should read while (!var0) unless I'm reading it wrong.

Share this post


Link to post

Hmm... I was afraid that would happen. Let's try this:

#include "zcommon.acs"

int countd;

script 1 OPEN
{
    print (s:"Objective 1\n\nFind the next elevator.");
    Delay (5*35);
    print (s:"Warning! Multiple bomb threats detected!");
    Delay (3*35);
    print (s:"All personel evacuate immediatly!");
    Delay (5*35);
    countd = 5;
    do
    {
        print(d:countd, s:" Seconds Until Explosion");
        delay(35);
        countd--;
        if(countd == 0)
        {
            Thing_Damage(1, 400);
            terminate;
        }
    }   until(countd == 0);
}

Share this post


Link to post

I still don't have any function. Oh and I tried doing my function on a line. I have my player with a tag of 1, but when Thing_Destroy (1); activates the player is still alive. How can I destroy a player with Thing_Destory?

Share this post


Link to post

Uh oh I just found a problem. The function does activate, but for some reason the player doesn't die! I added Sector_SetColor (0, 255, 0, 0); to test this and it does work. For some reason Thing_Destroy (1); doesn't work even though the player is tagged as 1. Any suggestions?

Share this post


Link to post

You can't tag player starts. And with this special you can't use tag 0, as that kills all untagged monsters instead. You could use DamageThing (400) assuming the script is not OPEN (as the player doesn't activate those) or telefrag a manikin with something on a scrolling floor (and unblock the teleport linedef when time is up).

Although I think there's a special that lets you tag a player, but I can't remember what it was. (it's like Player_ChangeTID or something)

Share this post


Link to post

However, you can set a fast crusher that does a lot of damage right on top of a dummy player. Once that countdown reaches zero...splat!

Share this post


Link to post

One more problem... how do I make dummy players? And I need dummy players for each of the 8 players is the problem because of the game being multiplayer as well.

Share this post


Link to post

All you need is another player one start spot. For normal Doom, this is all you need, but for ZDoom and Hexen, it has to have the same tag number. I'm guessing that more than one player two, player three, etc. will work the same way, but I haven't tested that.







3000th post!


Share this post


Link to post
cyber-menace said:

One more problem... how do I make dummy players? And I need dummy players for each of the 8 players is the problem because of the game being multiplayer as well.


More player 1 starts as suggested, but the one you create last will be the actual start (the highest thing number). You don't need to make them all the same tag number (not sure what he means there), but if you're using hubs, then you need a manikin for each of the start points (ie. one for player start 0, one for player start 1 etc.).

You only need to do this for entrance points that get used when you first enter the map.

And you'll need to repeat this for all the multiplayer starts, too.

Share this post


Link to post
Ichor said:

It isn't actually.

Oh so it's a special mods-only thing. I see how it is.

Share this post


Link to post
The Ultimate DooMer said:

You can't tag player starts.

You can give the player a tid, Randy posted an example. All you need is an open script that uses ChangeTid() or whatever the function is.

Share this post


Link to post
Archvile46 said:

BTW when did HTML become enabled in posts?

I think this answers your question.

Archvile46 said:

Oh so it's a special mods-only thing. I see how it is.

Supermods, admins and Ling, to be precise. It is also enabled in the moderators' forum. I had used it to post "peace be with you" in Inuktitut (when Julian went on holiday), so you can see it is a really valuable feature.

Share this post


Link to post
Nanami said:

You can give the player a tid, Randy posted an example. All you need is an open script that uses ChangeTid() or whatever the function is.

script 1 enter
   thing_changetid(0, tag);
assigns tag to the player

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
×