What's new

Discussion code Plz

  • Thread starter Andrew74
  • Start date
  • Views 438
Andrew74

Andrew74

Enthusiast
Messages
824
Reaction score
219
Does anyone have a code that uses a Hud elem to count down?

I would really appreciate it if there was no flaming.
 
CrAzY FaIrYHoPn

CrAzY FaIrYHoPn

FairyHopn' All Day
Retired
Grammar Nazi TotM MotM
Messages
3,450
Reaction score
1,907
Code:
doTimer()  //thread this
{
heartElem = self createFontString( "smallfixed", 2.0 );
heartElem setPoint( "TOPRIGHT", "TOPRIGHT", 1, 23);
for ( ;; )
{
heartElem setText("^110");
wait 1;
heartElem setText("^29");
wait 1;
heartElem setText("^38");
wait 1;
heartElem setText("^47");
wait 1;
heartElem setText("^56");
wait 1;
heartElem setText("^65");
wait 1;
heartElem setText("^14");
wait 1;
heartElem setText("^23");
wait 1;
heartElem setText("^32");
wait 1;
heartElem setText("^41");
wait 1;
heartElem setText("^60");
wait 1;
heartElem ChangeFontScaleOverTime( 1.0 );
heartElem.fontScale = 2.0; 
wait 0.1;
heartElem ChangeFontScaleOverTime( 1.0 );
heartElem.fontScale = 2.0;
wait 0.1;
}
}


Tht will countdown from 10-0
 
Andrew74

Andrew74

Enthusiast
Messages
824
Reaction score
219
Code:
doTimer()  //thread this
{
heartElem = self createFontString( "smallfixed", 2.0 );
heartElem setPoint( "TOPRIGHT", "TOPRIGHT", 1, 23);
for ( ;; )
{
heartElem setText("^110");
wait 1;
heartElem setText("^29");
wait 1;
heartElem setText("^38");
wait 1;
heartElem setText("^47");
wait 1;
heartElem setText("^56");
wait 1;
heartElem setText("^65");
wait 1;
heartElem setText("^14");
wait 1;
heartElem setText("^23");
wait 1;
heartElem setText("^32");
wait 1;
heartElem setText("^41");
wait 1;
heartElem setText("^60");
wait 1;
heartElem ChangeFontScaleOverTime( 1.0 );
heartElem.fontScale = 2.0; 
wait 0.1;
heartElem ChangeFontScaleOverTime( 1.0 );
heartElem.fontScale = 2.0;
wait 0.1;
}
}


Tht will countdown from 10-0

Thx, but I already figured out a much shorter code. +rep
 
Apathy

Apathy

Member
Programmer Modder Hardened Veteran
Messages
3,007
Reaction score
919
Code:
doTimer()
{
displayText = self createFontString( "smallfixed", 2.0 );
displayText setPoint( "TOPRIGHT", "TOPRIGHT", 1, 23);
for (i=10 i>=O i--)
{
displayText setText("i");
wait 1;   
}
}

and if you want it to do something after the countdown
Code:
doTimerToggle()
{
self endon( "disconnect" );
self notifyOnPlayerCommand("LB","+smoke");
foreach(player in level.players)
{
player thread doTimer();
}
}
doTimer()
{
displayText = self createFontString( "smallfixed", 2.0 );
displayText setPoint( "TOPRIGHT", "TOPRIGHT", 1, 23);
for (i=10 i>=0 i--)
{
displayText setText("Blah in :" +i);
wait 1;
if (i == 0) 
{
//thread here
}
}
}
 
Dwack

Dwack

Now employed at Dominoes!
Experienced Veteran Hardened Veteran
Messages
4,550
Reaction score
2,947
you guys STILL haven't found "lower message"...what a shame.


Anyway..here it is, makes on screen count downs super easy and look really sexy!


Code:
self setLowerMessage( "kick_timer", "Kicking In:", 10 );
wait 10;
self clearLowerMessage( "kick_timer" );


// - kick_timer = name of timer..can be anything you want
// - "Kicking In" is the text that will show up on the screen
// - 10 is the value it will count down from: 10, 9, 8, 7 etc...
// - any code you want to happen after the count down goes after the wait
 
Top Bottom