The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall

Legacy:Shoot One, Shoot Two, Shoot Three

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Summary

This tutorial demonstrates how to create an object that makes a different sound each time it is shot by a player.

In brief: we will encase a cube with a Trigger of type "TT_Shoot". Then we’ll add a RoundRobin that monitors the Trigger and controls three SpecialEvent actors. Each SpecialEvent plays a different sound, "One," "Two," "Three!"

Instructions

  1. Create a room
  2. Add a 64x64 cube somewhere on the floor in the room.

Add a Trigger to the map (see Actor Overview), and place it dead-center inside the cube from Step 2. Set the following properties for the Trigger:

Trigger Properties

Name Value
Events -> Event shot
Trigger -> TriggerType TT_Shoot


Add a SpecialEvent anywhere in the map. Edit the following properties of the SpecialEvent:

SpecialEvent #1 Properties

Name Value
Events -> Tag one
Object -> InitialState PlayersPlaySoundEffect
SpecialEvent -> Sound Sound'Announcer.(All).cd1'


Add another SpecialEvent anywhere in the map. Edit the following properties of the new SpecialEvent:

SpecialEvent #2 Properties

Name Value
Events -> Tag two
Object -> InitialState PlayersPlaySoundEffect
SpecialEvent -> Sound Sound'Announcer.(All).cd2'


Add one more SpecialEvent anywhere in the map. Edit the following properties of this final SpecialEvent:

SpecialEvent #3 Properties

Name Value
Events -> Tag three
Object -> InitialState PlayersPlaySoundEffect
SpecialEvent -> Sound Sound'Announcer.(All).cd3'


Finally, add a RoundRobin anywhere in the map. Edit the following properties of the RoundRobin.

RoundRobin Properties

Name Value
Events -> Tag shot
RoundRobin -> bLoop True
RoundRobin -> OutEvents -> [0] one
RoundRobin -> OutEvents -> [1] two
RoundRobin -> OutEvents -> [2] three


Now, launch the map, point your gun at the cube and fire away!

Extra: If you want to, say, have a message at one shot, three shots, and seven shots, you can for example assign the SpecialEvents the tags 'one', 'three' and 'seven'.

Then you assign Roundrobin as follows:

RoundRobin -> Outevents -> [0] one
RoundRobin -> Outevents -> [1] X
RoundRobin -> Outevents -> [2] three
RoundRobin -> Outevents -> [3] X
RoundRobin -> Outevents -> [4] X
RoundRobin -> Outevents -> [5] X
RoundRobin -> Outevents -> [6] seven

Here, X stands for any Eventname you care to use, it doesn't matter what name, but the Outevents between the events you really care about HAVE to have a name, otherwise it won't work.


xX)(Xx: Nice! Good, well thought out and easy to understand tutorial, hope you write more, just like a tutorial should be :)

Related Topics