Page 1 of 1

How to change footsteps for ScriptedPawn and DeusExPlayer

Posted: Fri Dec 16, 2016 8:31 am
by Kelkos

Code: Select all

// ----------------------------------------------------------------------
// PlayFootStep()
//
// Plays footstep sounds based on the texture group
// (yes, I know this looks nasty -- I'll have to figure out a cleaner way to do this)
// ----------------------------------------------------------------------

function PlayFootStep()
{
	local Sound stepSound;
	local float rnd;
	local name mat;
	local float speedFactor, massFactor;
	local float volume, pitch, range;
	local float radius, maxRadius;
	local float volumeMultiplier;

	local DeusExPlayer dxPlayer;
	local float shakeRadius, shakeMagnitude;
	local float playerDist;

	rnd = FRand();
	mat = GetFloorMaterial();

	volumeMultiplier = 1.0;
	if (WalkSound == None)
	{
		if (FootRegion.Zone.bWaterZone)
		{
			if (rnd < 0.33)
				stepSound = Sound'WaterStep1';
			else if (rnd < 0.66)
				stepSound = Sound'WaterStep2';
			else
				stepSound = Sound'WaterStep3';
		}
		else
		{
			switch(mat)
			{
			case 'Textile':
			case 'Paper':
				volumeMultiplier = 0.7;
				if (rnd < 0.25)
					stepSound = Sound'CarpetStep1';
				else if (rnd < 0.5)
					stepSound = Sound'CarpetStep2';
				else if (rnd < 0.75)
					stepSound = Sound'CarpetStep3';
				else
					stepSound = Sound'CarpetStep4';
				break;

			case 'Foliage':
				volumeMultiplier = 0.6;
				if (rnd < 0.25)
					stepSound = Sound'GameMedia.Misc.Step_Grass1';
				else if (rnd < 0.5)
					stepSound = Sound'GameMedia.Misc.Step_Grass2';
				else if (rnd < 0.75)
					stepSound = Sound'GameMedia.Misc.Step_Grass3';
				else
					stepSound = Sound'GameMedia.Misc.Step_Grass4';
				break;
							
			case 'Earth':
				volumeMultiplier = 0.6;
				if (rnd < 0.25)
					stepSound = Sound'GameMedia.Misc.Step_Earth1';
				else if (rnd < 0.5)
					stepSound = Sound'GameMedia.Misc.Step_Earth2';
				else if (rnd < 0.75)
					stepSound = Sound'GameMedia.Misc.Step_Earth3';
				else
					stepSound = Sound'GameMedia.Misc.Step_Earth4';
				break;

			case 'Metal':
			case 'Ladder':
				volumeMultiplier = 1.0;
				if (rnd < 0.25)
					stepSound = Sound'GameMedia.Misc.Step_Metal1';
				else if (rnd < 0.5)
					stepSound = Sound'GameMedia.Misc.Step_Metal2';
				else if (rnd < 0.75)
					stepSound = Sound'GameMedia.Misc.Step_Metal3';
				else
					stepSound = Sound'GameMedia.Misc.Step_Metal4';
				break;

			case 'Snow':
				volumeMultiplier = 0.6;
				if (rnd < 0.25)
					stepSound = Sound'GameMedia.Misc.Step_Snow1';
				else if (rnd < 0.5)
					stepSound = Sound'GameMedia.Misc.Step_Snow2';
				else if (rnd < 0.75)
					stepSound = Sound'GameMedia.Misc.Step_Snow3';
				else
					stepSound = Sound'GameMedia.Misc.Step_Snow4';
				break;

			case 'Ceramic':
			case 'Glass':
			case 'Tiles':
				volumeMultiplier = 0.7;
				if (rnd < 0.25)
					stepSound = Sound'TileStep1';
				else if (rnd < 0.5)
					stepSound = Sound'TileStep2';
				else if (rnd < 0.75)
					stepSound = Sound'TileStep3';
				else
					stepSound = Sound'TileStep4';
				break;

			case 'Wood':
				volumeMultiplier = 0.7;
				if (rnd < 0.25)
					stepSound = Sound'GameMedia.Misc.Step_Wood1';
				else if (rnd < 0.5)
					stepSound = Sound'GameMedia.Misc.Step_Wood2';
				else if (rnd < 0.75)
					stepSound = Sound'GameMedia.Misc.Step_Wood3';
				else
					stepSound = Sound'GameMedia.Misc.Step_Wood4';
				break;

			case 'Brick':
			case 'Concrete':
				volumeMultiplier = 0.7;
				if (rnd < 0.25)
					stepSound = Sound'GameMedia.Misc.Step_Concrete1';
				else if (rnd < 0.5)
					stepSound = Sound'GameMedia.Misc.Step_Concrete2';
				else if (rnd < 0.75)
					stepSound = Sound'GameMedia.Misc.Step_Concrete3';
				else
					stepSound = Sound'GameMedia.Misc.Step_Concrete4';
				break;
				
			case 'Stone':
			case 'Stucco':
			default:
				volumeMultiplier = 0.7;
				if (rnd < 0.25)
					stepSound = Sound'GameMedia.Misc.Step_Stone1';
				else if (rnd < 0.5)
					stepSound = Sound'GameMedia.Misc.Step_Stone2';
				else if (rnd < 0.75)
					stepSound = Sound'GameMedia.Misc.Step_Stone3';
				else
					stepSound = Sound'GameMedia.Misc.Step_Stone4';
				break;
			}
		}
	}
	else
	{
		stepSound = WalkSound;
		
		if(!IsA('Robot'))
		{
			volumeMultiplier = 0.5;
		}
	}

	// compute sound volume, range and pitch, based on mass and speed
	speedFactor = VSize(Velocity)/120.0;
	massFactor  = Mass/150.0;
	radius      = 768.0;
	maxRadius   = 2048.0;
//	volume      = (speedFactor+0.2)*massFactor;
//	volume      = (speedFactor+0.7)*massFactor;
	volume      = massFactor*1.5;
	range       = radius * volume;
	pitch       = (volume+0.5);
	volume      = 1.0;
	range       = FClamp(range, 0.01, maxRadius);
	pitch       = FClamp(pitch, 1.0, 1.5);

	// play the sound and send an AI event
	PlaySound(stepSound, SLOT_Interact, volume, , range, pitch);
	AISendEvent('LoudNoise', EAITYPE_Audio, volume*volumeMultiplier, range*volumeMultiplier);

	// Shake the camera when heavy things tread
	if (Mass > 400)
	{
		dxPlayer = DeusExPlayer(GetPlayerPawn());
		if (dxPlayer != None)
		{
			playerDist = DistanceFromPlayer;
			shakeRadius = FClamp((Mass-400)/600, 0, 1.0) * (range*0.5);
			shakeMagnitude = FClamp((Mass-400)/1600, 0, 1.0);
			shakeMagnitude = FClamp(1.0-(playerDist/shakeRadius), 0, 1.0) * shakeMagnitude;
			if (shakeMagnitude > 0)
				dxPlayer.JoltView(shakeMagnitude);
		}
	}
}

This Is for the ScriptedPawn, but how do I change Footstep sounds for JCD?

Re: How to change footsteps for ScriptedPawn and DeusExPlaye

Posted: Fri Dec 16, 2016 11:32 am
by Cybernetic pig
DeusExPlayer.uc, same function name.

Re: How to change footsteps for ScriptedPawn and DeusExPlayer

Posted: Mon Apr 03, 2023 6:46 am
by Jack90
let’s talk about the design of each type of camera. DSLR cameras have a mirror inside the camera body, which reflects light from the lens up to the viewfinder. This allows you to see exactly what you’re shooting before you take the shot. Mirrorless cameras, on the other hand, use an electronic viewfinder (EVF) to display the scene. The EVF is much more detailed than an optical viewfinder, and it allows you to view the image in real time. https://elegantcamera.com/best-camera-for-music-videos/