Producing sounds through Kismet

In this recipe we'll introduce actions that allow you to accompany events with sounds when an actor picks up objects in the scene.

Getting ready

Open Packt_04_PlaySound_Start.UDK or continue from where you were in the last recipe if you completed it. In this map the Bot handling is already set up, from previous recipes.

How to do it...

  1. In the map are four glowing white spheres. At present when you pick them up they just vanish. Let's provide some feedback to the player in the form of a sound too. Locate in the Kismet the event called Trigger_0 Touch. In some clear space that's near, hold D and click to add a Delay. Hook the Touched nub of the Trigger_0 Touch event to the Start nub of the Delay. Set the Delay action's Duration to 0.25.
  2. In the Content Browser, locate PacktWavs.Cue.one_Cue. This is a SoundCue asset that uses an imported .WAV file. Press Space to preview it. With this highlighted, in Kismet hold S and click to add a Play Sound node. In the node's properties, in the Play Sound field press the Use selected object in browser icon [ How to do it... ].
  3. For the Target nub of the Play Sound action set a Player Variable (hold P and click). From the Finished nub of the Play Sound action, extend a wire to a Log (hold L and click). In the Log action's Obj Comment field, type 1 of 4. This will display on screen after the sound plays.
    How to do it...
  4. Repeat this set up for the Trigger_1 Touch event using the Sound Cue PacktWavs.Cue.two_Cue and entering the Obj Comment 2 of 4 in the Log following the Play Sound action. Since the name of the assets in the Play Sound property are much the same, you can just type the name change by replacing one with two in the field entry.
  5. You can select and copy the Delay, the Play Sound, its Player Variable, and the Log, and paste them below, then re-assign PacktWavs.Cue.three_Cue to the Play Sound property, and 3 of 4 to the Obj Comment of the Log. The same pattern would go for 4 of 4 and PackWavs.Cue.four_Cue in another pasted set. Make sure each set is assigned to the respective Trigger Touch event.
  6. It would also be good to add a sound which is more of a special effect, to accompany the collection event. This can be a single Play Sound node that is fed by all the Trigger Touch events.
    How to do it...
  7. Hold S and click to add the Play Sound action and in its property Play Sound, and assign from the Content Browser A_Pickups.Health.Cue.A_Pickups_Health_Small_Cue_Modulated. Don't be misled by the name of the asset; it's the sound itself that counts. Feed its Play nub to the Touched nub of the Trigger_0 Touch event, the Trigger_1 Touch event, the Trigger_2 Touch event, and the Trigger_3 Touch event.
  8. PIE to check that when you pick up the orbs you get a voice chiming in 1, 2, 3, 4. A demonstration is in the map Packt_04_PlaySound_DEMO.UDK. Look in the commented section Collect Orb Sounds.
..................Content has been hidden....................

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