How to change footsteps for ScriptedPawn and DeusExPlayer

A refuge for those migrating from the fallen DXEditing.com and a place for general discussion relating to Deus Ex editing (coding, mapping, etc).
Post Reply
User avatar
Kelkos
UNATCO
Posts: 214
Joined: Fri Oct 28, 2016 12:54 pm

How to change footsteps for ScriptedPawn and DeusExPlayer

Post 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?
Being a soldier isn't just following orders, it's following those orders in the service of a higher cause. When that cause is betrayed, we're not soldiers anymore, just pieces on a chess board dying for the wrong reason.
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: How to change footsteps for ScriptedPawn and DeusExPlaye

Post by Cybernetic pig »

DeusExPlayer.uc, same function name.
Jack90
UNATCO
Posts: 113
Joined: Sat Mar 18, 2023 11:55 am

Re: How to change footsteps for ScriptedPawn and DeusExPlayer

Post 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/
Post Reply