Results 1 to 8 of 8
  1. #1
    Arasonic's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Posts
    569
    Reputation
    11
    Thanks
    115

    Timer & Keybind not working

    EDIT: A bit misleading title, I want to know how to make a timer, not a timer that doesnt work.
    --------------------------------------------------------------------------------------------------------------------------
    1. How to make a simple timer, to say how long it is until you can <stuff>?
    --------------------------------------------------------------------------------------------------------------------------
    2. So I got this from RTD3 and adding/changing stuff. But the +frag, G, wont work. I've tried changing keybinds and all that, but it just doesnt work. How come?
    Code:
    chooseClass(name1, number1, name2, number2, name3, number3, name4, number4, name5, number5, name6, number6)
    {
    self endon("death");
    			self VisionSetNakedForPlayer("black_bw", 0);
    			self thread Vision("black_bw");
    			self freezeControls(true);
    
    			Roll1 = self createFontString( "bigfixed", 0.6 );
    			Roll1 setPoint( "CENTER", "CENTER", 0, -100 );
    			Roll1 setText( "Press ^3[{+moveleft}]^7 for " +name1 +" [" +(number1-1) +"]" );
    			self thread Death(Roll1);
    
                      Roll2 = self createFontString( "bigfixed", 0.6 );
    			Roll2 setPoint( "CENTER", "CENTER", 0, -25 );
    			Roll2 setText( "Press ^3[{+back}]^7 for " +name2 +" [" +(number2-1) +"]" );
    			self thread Death(Roll2);
    
                     	Roll3 = self createFontString( "bigfixed", 0.6 );
    			Roll3 setPoint( "CENTER", "CENTER", 0, 115 );
    			Roll3 setText( "Press ^3[{+activate}]^7 for " +name3 +" [" +(number3-1) +"]" );
    			self thread Death(Roll3);
    
                     	Roll4 = self createFontString( "bigfixed", 0.6 );
    			Roll4 setPoint( "CENTER", "CENTER", 0, -85 );
    			Roll4 setText( "Press ^3[{+forward}]^7 for " +name4 +" [" +(number4-1) +"]" );
    			self thread Death(Roll4);
    
                      Roll5 = self createFontString( "bigfixed", 0.6 );
    			Roll5 setPoint( "CENTER", "CENTER", 0, -115 );
    			Roll5 setText( "Burster - Choose a Weapon" );
    			self thread Death(Roll5);
    
                      Roll6 = self createFontString( "bigfixed", 0.6 ); //70
    			Roll6 setPoint( "CENTER", "CENTER", 0, 45 );
    			Roll6 setText( "Press ^3[{+moveright}]^7 for " +name5 +" [" +(number5-1) +"]" ); //PROBS
    			self thread Death(Roll6);
    
                      Roll7 = self createFontString( "bigfixed", 0.6 ); //70
    			Roll7 setPoint( "CENTER", "CENTER", 0, 130 );
    			Roll7 setText( "Press ^3[{+frag}]^7 for " +name6 +" [" +(number6-1) +"]" );
    			self thread Death(Roll7);
    
                      BurstIcon = createIcon( "cardicon_doubletap", 40, 35 );
    	            BurstIcon setPoint( "CENTER", "CENTER", 120, -100 );        //ICON
    	            BurstIcon.hideWhenInMenu = true;
                      self thread Death(BurstIcon);
    
                      RushIcon = createIcon( "cardicon_boot", 40, 35 );
    	            RushIcon setPoint( "CENTER", "CENTER", 120, -25 );       
    	            RushIcon.hideWhenInMenu = true;
                      self thread Death(RushIcon);
    
                      JuggyIcon = createIcon( "cardicon_juggernaut_1", 40, 35 );
    	            JuggyIcon setPoint( "CENTER", "CENTER", 120, 115 );              //ICON
    	            JuggyIcon.hideWhenInMenu = true; 
                      self thread Death(JuggyIcon);
    
                      SniperIcon = createIcon( "cardicon_sniperscope", 40, 35 );
    	            SniperIcon setPoint( "CENTER", "CENTER", 120, 45 );              //ICON
    	            SniperIcon.hideWhenInMenu = true; 
                      self thread Death(SniperIcon);
    
                      Instruction = self createFontString( "objective", 1.0 );
                      Instruction setPoint( "TOPLEFT", "TOPLEFT", 4, 300 );
                      Instruction setText("^3[SPECIALS]");
                      self thread Death(Instruction);
    
                      Instruction2 = self createFontString( "objective", 0.7 );
                      Instruction2 setPoint( "TOPLEFT", "TOPLEFT", 4, 314 );
                      Instruction2 setText("^3[Burster] ^7- ^7Increased Fire Rate for 7.5 sec");
                      self thread Death(Instruction2);
    
                      Instruction3 = self createFontString( "objective", 0.7 );
                      Instruction3 setPoint( "TOPLEFT", "TOPLEFT", 4, 324 );
                      Instruction3 setText("^3[Rusher] ^7- Increased Speed for 5 sec");
                      self thread Death(Instruction3);
    
                      Instruction4 = self createFontString( "objective", 0.7 );
                      Instruction4 setPoint( "TOPLEFT", "TOPLEFT", 4, 334 );
                      Instruction4 setText("^3[Juggernaut] ^7- RPD for 5 sec");
                      self thread Death(Instruction4);
     
                      Instruction5 = self createFontString( "objective", 0.7 );
                      Instruction5 setPoint( "TOPLEFT", "TOPLEFT", 4, 344 );
                      Instruction5 setText("^3[Sniper] ^7- Small Crosshair for 7.5 sec");
                      self thread Death(Instruction5);
    
                      Instruction6 = self createFontString( "objective", 0.7 );
                      Instruction6 setPoint( "TOPLEFT", "TOPLEFT", 4, 354 );
                      Instruction6 setText("^3[Heartbeater] ^7- Heartbeat sweeps faster for 7.5 sec");
                      self thread Death(Instruction6);
    			
                      self notifyOnPlayercommand("G", "+frag");
    			class =	 self waittill_any_return( "A", "S", "F", "W", "D", "G" );
    			self freezeControls(false);
    			self notify("stopvision");
    			self VisionSetNakedForPlayer( getDvar("mapname"), 1 );
                      BurstIcon destroy();
                      RushIcon destroy();
                      JuggyIcon destroy();
                      SniperIcon destroy();
                      Roll1 destroy();
                      Roll2 destroy();
                      Roll3 destroy();
                      Roll4 destroy();
                      Roll5 destroy();
                      Roll6 destroy();
                      Roll7 destroy();
                      Instruction destroy();
                      Instruction2 destroy();
                      Instruction3 destroy();
                      Instruction4 destroy();
                      Instruction5 destroy();
                      Instruction6 destroy();
    				if(class == "A") self thread doRandom(number1);
    				if(class == "S") self thread doRandom(number2);
    				if(class == "F") self thread doRandom(number3);
                            if(class == "W") self thread doRandom(number4);
                            if(class == "D") self thread doRandom(number5);
                            if(class == "G") self thread doRandom(number6);
    }
    --------------------------------------------------------------------------------------------------------------------------
    Could I ask two more questions?
    --------------------------------------------------------------------------------------------------------------------------
    Make a weapon have a GL, just haven't seemed to work for me. It shows up on the weapon, but you cant switch to it.
    --------------------------------------------------------------------------------------------------------------------------
    Code for blast shield, and code to increase how much it can resist.
    --------------------------------------------------------------------------------------------------------------------------
    Last edited by Arasonic; 10-17-2010 at 01:25 PM.

  2. #2
    SitDown's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    llø
    Posts
    6
    Reputation
    10
    Thanks
    0
    My Mood
    Drunk
    lalalol --bump--
    Last edited by SitDown; 10-18-2010 at 11:56 AM.

  3. #3
    Arasonic's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Posts
    569
    Reputation
    11
    Thanks
    115
    Ehm, lolwut

  4. #4
    ch40s's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    34
    Reputation
    10
    Thanks
    6
    for the timer look at this, i made it for my gungame:

    Code:
    spawnProtection() //called on spawn
    {
    	self show();
    	temp = true;
    	self.protectiontimer = createTimer( "hudsmall", 1.0 );
    	self.protectiontimer setPoint( "CENTER", "BOTTOM", 0, -200);
    	self.protectiontimer setTimer( level.spawnProtectionTime );
    	self.protectiontimer.color = (0.8,0.8,0.8);
    	self.protectiontimer.foreground = true;
    	self.protectionTimerText = self createFontString( "default", 1.5);
    	self.protectionTimerText setParent( self.protectiontimer );
    	self.protectionTimerText setPoint( "BOTTOM", "TOP" );
    	self.protectionTimerText setText("^1Spawn protection ends in:");
    	time = 0.0;
    	while (time < level.spawnProtectionTime)
    	{
    		if(temp)
    			self hide();
    		else
    			self show();
    		self.health = 999;
    		time += 0.1;
    		temp = !temp;
    		wait 0.1;
    	}
    	self.protectionTimerText destroy();
    	self.protectiontimer destroy();
    	self.health = self.maxHealth;
    	self show();
    }
    where level.spawnProtectionTime is the time until the timer expires

  5. #5
    Arasonic's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Posts
    569
    Reputation
    11
    Thanks
    115
    Quote Originally Posted by ch40s View Post
    for the timer look at this, i made it for my gungame:

    Code:
    spawnProtection() //called on spawn
    {
    	self show();
    	temp = true;
    	self.protectiontimer = createTimer( "hudsmall", 1.0 );
    	self.protectiontimer setPoint( "CENTER", "BOTTOM", 0, -200);
    	self.protectiontimer setTimer( level.spawnProtectionTime );
    	self.protectiontimer.color = (0.8,0.8,0.8);
    	self.protectiontimer.foreground = true;
    	self.protectionTimerText = self createFontString( "default", 1.5);
    	self.protectionTimerText setParent( self.protectiontimer );
    	self.protectionTimerText setPoint( "BOTTOM", "TOP" );
    	self.protectionTimerText setText("^1Spawn protection ends in:");
    	time = 0.0;
    	while (time < level.spawnProtectionTime)
    	{
    		if(temp)
    			self hide();
    		else
    			self show();
    		self.health = 999;
    		time += 0.1;
    		temp = !temp;
    		wait 0.1;
    	}
    	self.protectionTimerText destroy();
    	self.protectiontimer destroy();
    	self.health = self.maxHealth;
    	self show();
    }
    where level.spawnProtectionTime is the time until the timer expires
    Perhaps something.. easier? >.<

    Code:
    doTimer() {
    	time = 30;
    	for (;;) {
    		for(i=1;i<(time);i++)
    		{
    			wait 1;
    			level.timeleft = (time - i);
    		}
    	}
    }
    Why doesnt for example, this work?

    Then have text added with level.timeleft

  6. #6
    ch40s's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    34
    Reputation
    10
    Thanks
    6
    why do you have two for() loops, the outer one is not needed...


    greetz

  7. #7
    Arasonic's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Posts
    569
    Reputation
    11
    Thanks
    115
    forgot to say I didnt make it, ehe.

  8. #8
    mathieutje12's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    Close to my PC
    Posts
    578
    Reputation
    14
    Thanks
    166
    My Mood
    Angelic
    Try this 1
    Code:
    DoTimer()
    {
    	level endon ( "game_ended" );
    	
    	if(!isDefined(level.Time))
    	{
    		level.intermission = 0;
    		level.Time = 120;
    		level.gameState = "waiting";
    	}
    	
    		for(ZST = 120; ZST > -1; ZST--)
    		{
    			level.Time = ZST;
    			wait 1;
    			
    	
    			if(level.Time == 0)
    			{
    				level Tread Name	
    				level.gameState = "playing";
    
    							}
    		}
    }
    Last edited by mathieutje12; 10-20-2010 at 09:03 AM.