Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. Script "ManageFootsteps" (void)
  2. {
  3.     while(Playeringame(PlayerNumber()) && IsAlive())
  4.     {
  5.         if (GetActorZ(0) - GetActorFloorZ(0) == 0)
  6.         {
  7.             // Scale the terrain volume and delay
  8.             Fixed actorSpeed = GetActorCurrentSpeed2D(0);
  9.             int   stepVolume = ifloor(FixedMul(12.0, actorSpeed)),
  10.                   delayTime  = ifloor(18.0 - FixedDiv(actorSpeed, 2.0));
  11.            
  12.             // Get the terrain sound
  13.             str terrainDef = StrParam(s:"STEP_", s:GetActorFloorTexture(0)),
  14.                 terrainSound = StrParam(l:terrainDef);
  15.            
  16.             // No sound found, use default
  17.             if (StrEquals(terrainDef, terrainSound))
  18.                 terrainSound = StrParam(l:"STEP_DEFAULT");
  19.            
  20.             ActivatorSound(terrainSound, stepVolume);
  21.         }
  22.        
  23.         Delay(Max(delayTime, 1));
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement