The bonus about the ActuallyPlayFootStepSound function is that it references the material type under the players feet and so call the relevant footstep sound. I have footstep sounds for each of my materials but if done the way you have shown will only give me one run sound. I want the run sound to also match the material type.
Thanks for the input though, your code should help me try and figure out the last part.
Announcement
Collapse
No announcement yet.
Custom Pawn Sounds
Collapse
X
-
Shindawg repliedThis is how the ActuallyPlayFootStepSound function is called. This is from UpdateEyeHeight in UTPawn:
Code:if ( (Physics == PHYS_Walking) && (VSizeSq(Velocity) > 100) && IsFirstPerson() ) { m = int(0.5 * Pi + FootFrequency * OldBobTime/Pi); //'m' and 'n' represent the frequency of the footstep sounds n = int(0.5 * Pi + FootFrequency * BobTime/Pi); if ( (m != n) && !bIsWalking && !bIsCrouched ) { ActuallyPlayFootStepSound(0); } }
Code:if ( (Physics == PHYS_Walking) && (VSizeSq(Velocity) > 100) && IsFirstPerson() ) { m = int(0.5 * Pi + FootFrequency * OldBobTime/Pi); //'m' and 'n' represent the frequency of the footstep sounds n = int(0.5 * Pi + FootFrequency * BobTime/Pi); if ( (m != n) && !bIsWalking && !bIsCrouched && bSprinting == false) { ActuallyPlayFootStepSound(0); } else if ( (m != n) && !bIsWalking && !bIsCrouched && bSprinting == true) { PlaySound(SprintingFootStepSound); } }
Leave a comment:
-
maintunez repliedThanks for the response Shindawg,
It is 1st person so the character mesh animations are not important, I have already created and added custom footstep sounds just by extending the code in the UtPawnSoundGroup and creating physical materials for each step sound. I also have 'RUN' versions of each soundcue for each of my materials but cant figure out how to call these.
What I wanted was for UDK to switch between normal footstep cues and my run cues acording to the 'MovementSpeedModifier' which I have tied to my player to control movement speed.
Would I need to define this action by extending the UTPawn class you mentioned?
Leave a comment:
-
Shindawg repliedForgive me if I missed something vital, but according to your OP you just wanted your own footstep sounds? First of all, footsteps are called differently depending on which view you are in (1st person or 3rd person). If in third person, they are called directly through the character mesh's animations, using an AnimNotify (you can look at the default running anims for examples of this).If in first person, they are called directly from script using this, taken from UTPawn:
Code:/** * Handles actual playing of sound. Separated from PlayFootstepSound so we can * ignore footstep sound notifies in first person. */ simulated function ActuallyPlayFootstepSound(int FootDown) { local SoundCue FootSound; FootSound = SoundGroupClass.static.GetFootstepSound(FootDown, GetMaterialBelowFeet()); if (FootSound != None) { PlaySound(FootSound, false, true,,, true); }
Leave a comment:
-
maintunez replied@JessieG
Thanks a lot for sharing that tutorial, I have been trying for ages to get this working
Currently I have LeftShift bound to a Run function within the kismet which adjusts the 'MovementSpeedModifier' allowing my player to speed up when it is pressed. Now I want to add a custom 'Run' footstep cue which cuts in when the player runs but not 100% sure on how to do this. Any ideas?
Here is what I have added to the UTPawnSoundGroup to identify my run sounds but I am not a coder so it been a bit of guess work.
Code:/** * Copyright 1998-2013 Epic Games, Inc. All Rights Reserved. */ class UTPawnSoundGroup extends Object abstract dependson(UTPhysicalMaterialProperty); var SoundCue DodgeSound; var SoundCue DoubleJumpSound; var SoundCue DefaultJumpingSound; var SoundCue LandSound; var SoundCue FallingDamageLandSound; var SoundCue DyingSound; var SoundCue HitSounds[3]; var SoundCue GibSound; var SoundCue DrownSound; var SoundCue GaspSound; var SoundCue RunSound; var float MovementSpeedModifier; struct FootstepSoundInfo { var name MaterialType; var SoundCue Sound; }; /** footstep sound effect to play per material type */ var array<FootstepSoundInfo> FootstepSounds; /** default footstep sound used when a given material type is not found in the list */ var SoundCue DefaultFootstepSound; /** footstep sound effect to play per material type */ var array<FootstepSoundInfo> RunSounds; var array<FootstepSoundInfo> JumpingSounds; var array<FootstepSoundInfo> LandingSounds; var SoundCue DefaultLandingSound; // The following are /body/ sounds, not vocals: /* sound for regular bullet hits on the body */ var SoundCue BulletImpactSound; /* sound from being crushed, such as by a vehicle */ var SoundCue CrushedSound; /* sound when the body is gibbed*/ var SoundCue BodyExplosionSound; var SoundCue InstagibSound; static function PlayInstagibSound(Pawn P) { P.Playsound(Default.InstagibSound, false, true); } static function PlayBulletImpact(Pawn P) { P.PlaySound(Default.BulletImpactSound, false, true); } static function PlayCrushedSound(Pawn P) { P.PlaySound(Default.CrushedSound,false,true); } static function PlayBodyExplosion(Pawn P) { P.PlaySound(Default.CrushedSound,false,true); } static function PlayDodgeSound(Pawn P) { P.PlaySound(Default.DodgeSound, false, true); } static function PlayDoubleJumpSound(Pawn P) { P.PlaySound(Default.DoubleJumpSound, false, true); } static function PlayJumpSound(Pawn P) { P.PlaySound(Default.DefaultJumpingSound, false, true); } static function PlayLandSound(Pawn P) { // PlayOwnedSound(GetSound(EST_Land), SLOT_Interact, FMin(1,-0.3 * P.Velocity.Z/P.JumpZ)); P.PlaySound(Default.LandSound, false, true); } static function PlayFallingDamageLandSound(Pawn P) { P.PlaySound(Default.FallingDamageLandSound, false, true); } static function SoundCue GetFootstepSound(int FootDown, name MaterialType) { local int i; i = default.FootstepSounds.Find('MaterialType', MaterialType); return (i == -1 || MaterialType=='') ? default.DefaultFootstepSound : default.FootstepSounds[i].Sound; // checking for a '' material in case of empty array elements } static function SoundCue GetRunSound(name MaterialType) { local int i; i = default.RunSounds.Find('MaterialType', MaterialType); return (i == -1 || MaterialType=='') ? default.DefaultLandingSound : default.RunSounds[i].Sound; // checking for a '' material in case of empty array elements } static function SoundCue GetJumpSound(name MaterialType) { local int i; i = default.JumpingSounds.Find('MaterialType', MaterialType); return (i == -1 || MaterialType=='') ? default.DefaultJumpingSound : default.JumpingSounds[i].Sound; // checking for a '' material in case of empty array elements } static function SoundCue GetLandSound(name MaterialType) { local int i; i = default.LandingSounds.Find('MaterialType', MaterialType); return (i == -1 || MaterialType=='') ? default.DefaultLandingSound : default.LandingSounds[i].Sound; // checking for a '' material in case of empty array elements } static function PlayDyingSound(Pawn P) { P.PlaySound(Default.DyingSound); } /** play sound when taking a hit * this sound should be played replicated */ static function PlayTakeHitSound(Pawn P, int Damage) { local int HitSoundIndex; if ( P.Health > 0.5 * P.HealthMax ) { HitSoundIndex = (Damage < 20) ? 0 : 1; } else { HitSoundIndex = (Damage < 20) ? 1 : 2; } P.PlaySound(default.HitSounds[HitSoundIndex]); } static function PlayGibSound(Pawn P) { P.PlaySound(default.GibSound, true); } static function PlayGaspSound(Pawn P) { P.PlaySound(default.GaspSound, true); } static function PlayDrownSound(Pawn P) { P.PlaySound(default.DrownSound, true); } defaultproperties { DrownSound=SoundCue'A_Character_IGMale_Cue.Efforts.A_Effort_IGMale_MaleDrowning_Cue' GaspSound=SoundCue'A_Character_IGMale_Cue.Efforts.A_Effort_IGMale_MGasp_Cue' DefaultJumpingSound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_DirtJumpCue' FootstepSounds[0]=(MaterialType=Stone,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_StoneCue') FootstepSounds[1]=(MaterialType=Dirt,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_DirtCue') FootstepSounds[2]=(MaterialType=Energy,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_EnergyCue') FootstepSounds[3]=(MaterialType=Flesh_Human,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_FleshCue') FootstepSounds[4]=(MaterialType=Foliage,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_FoliageCue') FootstepSounds[5]=(MaterialType=Glass,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_GlassPlateCue') FootstepSounds[6]=(MaterialType=Water,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_WaterDeepCue') FootstepSounds[7]=(MaterialType=ShallowWater,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_WaterShallowCue') FootstepSounds[8]=(MaterialType=Metal,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_MetalCue') FootstepSounds[9]=(MaterialType=Snow,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_SnowCue') FootstepSounds[10]=(MaterialType=Wood,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_WoodCue') FootstepSounds[11]=(MaterialType=BoringFootstep,Sound=SoundCue'GATA_Sound.Foley.FSWoodNorm') FootstepSounds[12]=(MaterialType=ConcatFootstep,Sound=SoundCue'GATA_Sound.Foley.FSWoodConcatenate') FootstepSounds[13]=(MaterialType=Test1,Sound=SoundCue'My_Custom_Steps.Custom_steps_Cue') FootstepSounds[14]=(MaterialType=MyGravel,Sound=SoundCue'My_Custom_Steps.Gravel_Footsteps_Cue') FootstepSounds[15]=(MaterialType=Wood_Floor,Sound=SoundCue'Dungeon_Own.FootSteps.Steps_Wood') FootstepSounds[16]=(MaterialType=Stone_Floor,Sound=SoundCue'Dungeon_Own.FootSteps.Footsteps_Stone_Cue') FootstepSounds[17]=(MaterialType=Wet_Floor,Sound=SoundCue'Dungeon_Own.FootSteps.Footsteps_Wet_Cue') FootstepSounds[18]=(MaterialType=Metal_Floor,Sound=SoundCue'Dungeon_Own.FootSteps.Footsteps_Metal_Cue') FootstepSounds[19]=(MaterialType=Stone_Step_Floor,Sound=SoundCue'Dungeon_Own.FootSteps.Footsteps_Steps_Cue') FootstepSounds[20]=(MaterialType=Wet_Floor_2,Sound=SoundCue'Dungeon_Own.FootSteps.Footsteps_Wet_2Cue') RunSounds[0]=(MaterialType=Stone_Floor,Sound=SoundCue'Dungeon_Own.FootSteps.Footsteps_Stone_Run_Cue') RunSounds[1]=(MaterialType=Wet_Floor,Sound=SoundCue'Dungeon_Own.FootSteps.Footsteps_Wet_Run_Cue') RunSounds[2]=(MaterialType=Metal_Floor,Sound=SoundCue'Dungeon_Own.FootSteps.Footsteps_Metal_Run_Cue') RunSounds[3]=(MaterialType=Stone_Step_Floor,Sound=SoundCue'Dungeon_Own.FootSteps.Footsteps_Steps_Run_Cue') JumpingSounds[0]=(MaterialType=Stone,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_StoneJumpCue') JumpingSounds[1]=(MaterialType=Dirt,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_DirtJumpCue') JumpingSounds[2]=(MaterialType=Energy,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_EnergyJumpCue') JumpingSounds[3]=(MaterialType=Flesh_Human,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_FleshJumpCue') JumpingSounds[4]=(MaterialType=Foliage,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_FoliageJumpCue') JumpingSounds[5]=(MaterialType=Glass,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_GlassPlateJumpCue') JumpingSounds[6]=(MaterialType=GlassBroken,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_GlassBrokenJumpCue') JumpingSounds[7]=(MaterialType=Grass,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_GrassJumpCue') JumpingSounds[8]=(MaterialType=Metal,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_MetalJumpCue') JumpingSounds[9]=(MaterialType=Mud,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_MudJumpCue') JumpingSounds[10]=(MaterialType=Metal,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_MetalJumpCue') JumpingSounds[11]=(MaterialType=Snow,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_SnowJumpCue') JumpingSounds[12]=(MaterialType=Tile,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_TileJumpCue') JumpingSounds[13]=(MaterialType=Water,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_WaterDeepJumpCue') JumpingSounds[14]=(MaterialType=ShallowWater,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_WaterShallowJumpCue') JumpingSounds[15]=(MaterialType=Wood,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_WoodJumpCue') DefaultLandingSound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_DirtLandCue' LandingSounds[0]=(MaterialType=Stone,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_StoneLandCue') LandingSounds[1]=(MaterialType=Dirt,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_DirtLandCue') LandingSounds[2]=(MaterialType=Energy,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_EnergyLandCue') LandingSounds[3]=(MaterialType=Flesh_Human,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_FleshLandCue') LandingSounds[4]=(MaterialType=Foliage,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_FoliageLandCue') LandingSounds[5]=(MaterialType=Glass,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_GlassPlateLandCue') LandingSounds[6]=(MaterialType=GlassBroken,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_GlassBrokenLandCue') LandingSounds[7]=(MaterialType=Grass,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_GrassLandCue') LandingSounds[8]=(MaterialType=Metal,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_MetalLandCue') LandingSounds[9]=(MaterialType=Mud,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_MudLandCue') LandingSounds[10]=(MaterialType=Metal,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_MetalLandCue') LandingSounds[11]=(MaterialType=Snow,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_SnowLandCue') LandingSounds[12]=(MaterialType=Tile,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_TileLandCue') LandingSounds[13]=(MaterialType=Water,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_WaterDeepLandCue') LandingSounds[14]=(MaterialType=ShallowWater,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_WaterShallowLandCue') LandingSounds[15]=(MaterialType=Wood,Sound=SoundCue'A_Character_Footsteps.FootSteps.A_Character_Footstep_WoodLandCue') BulletImpactSound=SoundCue'A_Character_BodyImpacts.BodyImpacts.A_Character_BodyImpact_Bullet_Cue' }
Leave a comment:
-
Nightmask3 repliedThanks a lot elf13oy!
Used this and it helped resolve the issues I had.
A million cookies to you!
Leave a comment:
-
elf13oy repliedAfter running through all the things suggested in this thread, I ran into the problem that I still had to extend UTGame. If you too need to as well. Add this into your player pawn and it should overwrite the soundgroupclass and work just fine!
simulated function SetCharacterClassFromInfo(class<UTFamilyInfo> Info)
{
Super.SetCharacterClassFromInfo(Info);
SoundGroupClass= class'CUSTOMGAMEPawnSoundGroup';
}
Leave a comment:
-
Kelt'ar repliedOriginally posted by BirthNight View PostSo it's been a over a year...
I apologize to those of you waiting for that tutorial. I was never able put up a link because, as far as I know, it was never made by the person who figured it all out. We stopped working together and I moved on to a new engine.
Anyway! I'm back with UDK now and now I've arrived at the same problem. I can't believe this hasn't been explored more since I dealt with this. I can really only find this old post and one other, and neither are helpful.
So, here we go...
The following line can be found in UTPawn:
Code:SoundGroupClass = Info.default.SoundGroupClass;
Thanks
Then u should be able to specify it in your pawn class.
Leave a comment:
-
Kelt'ar repliedOriginally posted by Hitpawz View PostI'm having a major problem with this. It appears setting physical materials to call different footstep sounds only works on objects with perpoly collision set on them. This is really bad for objects using multiple materials on them.
If I use the collision objects I exported with the asset (UCX, UBX, USP) then it sets one physical material to the entire object and ignores the material I'm on. If I have it per poly, it registers the material I'm standing on.
So is it possible to have multiple physical materials present on objects with their own optimized collision meshes? How do we assign a physical material to specific Prim in the collision?
If per poly is the only way physical materials will work, it's inherently set up to make sure our games run like **** and should be fixed. If I'm dumb, which is often the case, I apologize and appreciate pointers on how to set it up.
Leave a comment:
-
cjw92 repliedYeah, I have been doing the same thing too. Extending UTPawnSoundGroup but I kept hearing the epic default. Sometimes I got no choice but to comment all the default sound. Because I couldn't get my code to work... But I put my classes in the folders I created, not inside UTGame class. So is that why it couldn't read?
I have got error in extending UDKGame. They forced me to extend from UTGame instead, so am I making any steps wrong???
Leave a comment:
-
TorQueMoD repliedSo everything worked great for me, the only problem I'm having is with assigning a material sound type (wood, grass, stone etc.) to a custom material. I've looked at Epic's materials and none of them seem to have a physics material associated with them. Also, it seems that the Jumping and Landing have a default sound cue but none of the foot step sounds do. When I compile my code, I've only modified the FootStepSounds [0] cue but the sounds don't play in game. I figured 0 would be the default material sound type?
Leave a comment:
-
BirthNight repliedIt was all you man, thanks! Now I'm gonna go make some soundcues
Leave a comment:
-
JessieG repliedOriginally posted by BirthNight View PostHOLY!!!!!!!
DUDE, this did it. It was the UDKGame / UTGame difference. I guess I needed to extend from UDKGame! Wow... thank you SOOO much....so what does this mean for me? If I'm extending from UDKGame, can I still use the functionality of UTGame? I'm not sure I even understand fully what I'm asking here.
Honestly I'm not sure you're missing out on much functionality, if any. UTGame is more specific to Unreal Tournament, I assume
The UDKGame class is more for a broader type of FPS without the Unreal Tournament rules. I'm not far enough into learning programming to add or change that much functionality, but footsteps are a breeze haha.
Also, random tidbit, if you add "bDelayedStart=false" to your TagGame.UC, the game should start right away without the press fire message in the beginning.
Leave a comment:
-
BirthNight repliedOriginally posted by JessieG View PostAnd just to check, try changing your taggame.uc extend off of UDKGame instead of UTGame just to see if it will make a difference, then close out of UDK and reopen it to automatically build all the scripts (have to do that everytime a single change is made. No need to use the FrontEnd)
Leave a comment:
-
BirthNight repliedHOLY!!!!!!!
DUDE, this did it. It was the UDKGame / UTGame difference. I guess I needed to extend from UDKGame! Wow... thank you SOOO much....so what does this mean for me? If I'm extending from UDKGame, can I still use the functionality of UTGame? I'm not sure I even understand fully what I'm asking here.
Leave a comment:
Leave a comment: