DAZZLE'S UPGRADE PACK

If you haven't already done so, upgrade your game by downloading Dazzle's all-in-one upgrade pack. It comes with everything you need for today's servers. Does your blue bar freeze when joining servers? Do you lag in games? Do you get an annoying siren in Phobik's Servers? This is what you need. CLICK HERE TO DOWNLOAD.

Could someone show me how to make a timer?

Modding questions, answers, help.....

Moderators: Warfare, Moderator, Admin

User avatar
TMG Leader
Veteran Light
Veteran Light
Posts: 962
Joined: Mon Jun 25, 2007 10:31 am
Location: In my refrigerator....

Could someone show me how to make a timer?

Post by TMG Leader »

Okay so I'm working on a game type. Everything is easy until I get to this part. I've looked at the CTF script for reference and I am still confused on how to do this. I need a time that counts down in center print and its time corresponds to a preference. After the timer ends I need it to kill all players and have a message with that.

Then for the scoring I need it to somewhat "remember" which team activated the timer so that when the timer runs out it gives them points corresponding to a preference.

Any help would be appreciated.

Thanks in advance.
First to fall, last man standing.
Mr Phobik
Site Mechanic
Site Mechanic
Posts: 283
Joined: Wed Apr 30, 2008 2:35 pm
Location: Toronto, CANADA

Re: Could someone show me how to make a timer?

Post by Mr Phobik »

Alright i dont think this is the best way to do it but here is my version:

Code: Select all

$maxTime = 5; // (in secs)

function Timer(%time)
{
    %time++;

     if ( %time >= $maxTime )
        return;

        BottomPrintAll("Timer:"@ %time @ "/" @ $maxTime,1,2);
           schedule(1000,0,"Timer",%time);
}

function killall()
{
   for(%i=0; %i<clientgroup.getCount(); %i++)
   {
      %client = clientgroup.getObject(%i);

      if(isobject(%client.player))
      {
      %client.player.schedule(2000,"hurtMe","1000");
      }
   }

   for(%i=0; %i<botclientgroup.getCount(); %i++)
   {
      %client = botclientgroup.getObject(%i);

      if(isobject(%client.player))
      {
      %client.player.schedule(2000,"hurtMe","1000");
      }
   }
}

function Start::onEnter(%db,%this,%tank,%time)
{
schedule(1,0,"Timer",%time);
schedule($maxTime*1000-500,0,"killall",%tank);
schedule($maxTime*1000-1000,false,"centerprintall","YOURMESSAGEHERE", 4,2);
}
If there is a better way or i did something wrong, please correct me. Also this is just the timer that kills someone with the message, Not the scoring.
Image
User avatar
TMG Leader
Veteran Light
Veteran Light
Posts: 962
Joined: Mon Jun 25, 2007 10:31 am
Location: In my refrigerator....

Re: Could someone show me how to make a timer?

Post by TMG Leader »

One q before I test it. The game type is a team game. If I want the time to say certain messages for a certain team should I put an "if" statement for each team or should I do something totally different.
First to fall, last man standing.
Mr Phobik
Site Mechanic
Site Mechanic
Posts: 283
Joined: Wed Apr 30, 2008 2:35 pm
Location: Toronto, CANADA

Re: Could someone show me how to make a timer?

Post by Mr Phobik »

Do you want each team to have a different message when everyone is killed?
Image
User avatar
TMG Leader
Veteran Light
Veteran Light
Posts: 962
Joined: Mon Jun 25, 2007 10:31 am
Location: In my refrigerator....

Re: Could someone show me how to make a timer?

Post by TMG Leader »

No, I need a different message for each team when the timer is activated.
Thx for your help.
First to fall, last man standing.
Mr Phobik
Site Mechanic
Site Mechanic
Posts: 283
Joined: Wed Apr 30, 2008 2:35 pm
Location: Toronto, CANADA

Re: Could someone show me how to make a timer?

Post by Mr Phobik »

Ok so the timer still does like 1..2..3 bla bla, but u want a message for each team when the timer is activated? Just like 1 message saying for instance "Mr Phobik activated the timer for the green team" to the blue team and "someone on your team activated the goal" to the green team?
Image
User avatar
TMG Leader
Veteran Light
Veteran Light
Posts: 962
Joined: Mon Jun 25, 2007 10:31 am
Location: In my refrigerator....

Re: Could someone show me how to make a timer?

Post by TMG Leader »

Yeah like that. Now one more thing that has to do with the timer. I will also have a gate for each team that will stop the timer with separate messages for each team.
So I was thinking something like this.

Code: Select all

function stoptimer()
{
if(%team=blueteam)
{
centerprintall("The blue team has stopped the timer!,4,4");
}
if(%team=greenteam)
{
centerprintall(("The green team has stopped the timer!",4,4);
}
}
Will this stop the timer, or will it just center print this and continue counting down. The goal is that I don't want all the players to be killed if the timer is stopped.
First to fall, last man standing.
Mr Phobik
Site Mechanic
Site Mechanic
Posts: 283
Joined: Wed Apr 30, 2008 2:35 pm
Location: Toronto, CANADA

Re: Could someone show me how to make a timer?

Post by Mr Phobik »

That won't stop the timer, and it probably won't even work for the center print. Ok I'll make the script to stop the timer and I'll have to edit the original script that I posted.
Image

Who is online

Users browsing this forum: ClaudeBot [Bot] and 16 guests