Changing the default player sounds

The default player sounds, such as grunts, footsteps and impacts, are set up in UTPawnSoundGroup.UC (and by extension UTPawnSoundGroup_Liandri.UC since the UDK generic Bot is from the Liandri family).

In UTPawn.UC, line 5497: SoundGroupClass=class'UTGame.UTPawnSoundGroup' we get the definition for the file that sounds will be established in. This is found in the file's DefaultProperties. Further down, we get additional SoundCues given for ArmorHitSound=, SpawnSound=, TeleportSound=, and FallImpactSound=, all of which can be overridden in your MyPawn.UC file's DefaultProperties. We also have some control over the audible distance with MaxFootstepDistSq, and MaxJumpSoundDistSq.

In this recipe we won't be considering changes to the weapon sounds for the default player, but these are, similarly, set in the DefaultProperties of the appropriate weapon class.

Getting ready

In ConTEXT you can open multiple files, so open up the C:UDK~DevelopmentSrcUTGameClassesUTPawnSoundGroup.UC first, then open up in another tab C:UDK~DevelopmentSrcUTGameClassesUTPawn.UC and look for line 5535, mentioned above using Ctrl + G. Since MyPawn.UC that we created in C:UDK~DevelopmentSrcMyGameClasses extends UTPawn.UC, if you have a line in the derived file which is the same as the base file, MyPawn.UC will act as an override. You can edit either UTPawn.UC or MyPawn.UC as you see fit, depending on what you have already provisioned in MyGame. Besides the two files from UTGame, also open up C:UDK~DevelopmentSrcMyGameClassesMyGame.UC.

How to do it...

  1. So that changes we make to our pawn class work, if you haven't already done so, in the last few lines of MyGame.UC set in the DefaultProperties:
    DefaultProperties
    {
    PlayerControllerClass=class'MyGame.MyPlayerController'
    DefaultPawnClass=class'MyGame.MyPawn'
    }
  2. In the DefaultProperties, also insert the following above the end curly brace }:
    SoundGroupClass=class'MyGame.MyPawnSoundGroup'
  3. Make a copy of UTPawnSoundGroup.UC, renaming the copy to C:UDK~DevelopmentSrcMyGameClassesMyPawnSoundGroup.UC and also change the first line of your new MyPawnSoundGroup.UC to read class MyPawnSoundGroup extends UTPawnSoundGroup.
  4. Delete everything between the class declaration and the DefaultProperties section. Leaving it there would just double up what's already in the class we're deriving from.
  5. In the DefaultProperties for this class you will see there are a lot of SoundCue entries. Replace all the SoundCue paths as follows: PacktWavs.Cue.Name, where Name refers to the action you are setting the sound for: DrownSound=SoundCue'PacktWavs.Cue.Drown_Cue'.

    Tip

    Any lines which you don't have a sound for you can be commented out with \ and it will use the entry already established in UTPawnSoundGroup.UC. If you don't want to hear the Epic Games sounds, instead of a SoundCue name you could enter none, for instance: DrownSound=none.

  6. There's a selection of SoundCues provided in the PacktWavs package and their names reflect the entries in the DefaultProperties. Later you can change these to whatever sounds you've sourced. After setting your SoundCue list, compile, then load a scene and set its View | World Properties | GameType | Game Type for PIE to MyGame and PIE to see what you get for your player sounds now.
  7. The next screenshot is of the adjusted code for the MyPawnSoundGroup.UC file discussed here. There's a copy in the downloadable content provided for this book. Note that when you set it, you may be disconcerted by some of the regular UDK sounds like spawning and jumping sounding rather different. Notice that the footstep sounds listed here are all the same asset; but they are there to allow variety like walking in mud, walking in snow, walking in high heels ... if you have alternatives.

See Also

Chapter 3, It Lives! discussed footsteps assigned in the sequence properties of an AnimSet to create footstep sounds timed to the keyframed steps of the character. Check out the recipe Sounds for non-Matinee controlled animation.

See Also
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.4.221