Advertisement
Guest User

OnlyClearOneTimer

a guest
Mar 6th, 2013
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Copyright 1998-2012 Epic Games, Inc. All Rights Reserved.
  3.  */
  4. class BreachPawn extends GamePawn
  5.     config(Game);
  6.  
  7. //Working on a Sprintfunction
  8.  
  9. var float       SprintTick;
  10. var float       ReplenishTick;
  11. var float       SprintTimer;
  12.  
  13. exec function StartSprint()
  14. {
  15.     ConsoleCommand("Sprint");
  16.        
  17.     if(SprintTimer > 0){
  18.         ClearAllTimers();   //For better functionality use "Clear replenish timer"
  19.         Groundspeed = 560;
  20.         SetTimer(SprintTick, true, 'Sprinting');
  21.     }
  22. }
  23. exec function StopSprint()
  24. {
  25.     ClearAllTimers();   //For better functionality use "Clear sprint timer"
  26.     ConsoleCommand("StopSprint");
  27.     GroundSpeed = 280;
  28.     SetTimer(ReplenishTick, true, 'ReplenishSprint');
  29. }
  30. simulated function Sprinting()
  31. {
  32.     if(SprintTimer >= 1){
  33.         SprintTimer = SprintTimer - 1;
  34.     }else{
  35.         StopSprint();
  36.     }  
  37. }
  38. simulated function ReplenishSprint()
  39. {
  40.         if(SprintTimer < 10){
  41.         SprintTimer = SprintTimer + 1;
  42.     }else{
  43.         ClearAllTimers();   //For better functionality use "Clear replenish timer"
  44.     }
  45. }
  46.  
  47.  
  48.  
  49. defaultproperties
  50. {
  51.     //Jump + Speed properties
  52.     GroundSpeed=280.0   //Speed value
  53.     bJumpCapable=false      //Toggle jump on and off
  54.    
  55.  
  56.     //Sprint Properties
  57.     SprintTimer=5.0
  58.     SprintTick=1.0;
  59.     ReplenishTick=4.0;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement