Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Script "ManageFootsteps" (void)
- {
- while(Playeringame(PlayerNumber()) && IsAlive())
- {
- if (GetActorZ(0) - GetActorFloorZ(0) == 0)
- {
- // Scale the terrain volume and delay
- Fixed actorSpeed = GetActorCurrentSpeed2D(0);
- int stepVolume = ifloor(FixedMul(12.0, actorSpeed)),
- delayTime = ifloor(18.0 - FixedDiv(actorSpeed, 2.0));
- // Get the terrain sound
- str terrainDef = StrParam(s:"STEP_", s:GetActorFloorTexture(0)),
- terrainSound = StrParam(l:terrainDef);
- // No sound found, use default
- if (StrEquals(terrainDef, terrainSound))
- terrainSound = StrParam(l:"STEP_DEFAULT");
- ActivatorSound(terrainSound, stepVolume);
- }
- Delay(Max(delayTime, 1));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement