Sound Trigger Tutorial
From C4 Engine Wiki
(Redirected from Sound Trigger)
Contents |
Creating the elements
- Create a box (in the top view) using the Geometries page
- Create a box trigger around the box using the Trigger page
- Create an omnidirectional source (sound effect) using the Sources page and clicking and dragging in the view until the sphere encloses the trigger (so that it can be heard while you are touching the trigger)
Connecting the trigger to the source
- Change to "connect nodes" mode (hotkey "5")
- Go to the Connectors tab in the Node Info window, and click "New" and create a Connector named SND1 and click OK
- Select the box trigger then select "SND1"
- Select the omnidirectional source
- In the menu go to "Node" then "Connect Node" (or use the hotkey Ctrl-L)
Setting up a script in the the trigger
- Go back to the trigger's "Node Info" window, switch to the "Controller" tab and change the controller type to script and go to "Edit Script"
- In the Script Editor, select "Play Sound Source" and click in the empty area.
- To edit the method, switch to "select" or "move" mode (hotkey 1 or 2) or use the Ctrl-I hotkey
- Double-click on the method you added and change the target node to "Connector SRC1"
- Press OK to the method info and OK to the Script Editor and OK to the Node Info
Setting up the sound
- Select the omnidirectional source and use Ctrl-I to get info
- Unselect "sound is initially playing" and "sound is looping"
- Go to the "Controller" tab and make sure the type is set to "<generic>"
Adding a counter display
The trigger can be edited so that when triggered a panel shows the number of times the trigger has been activated. See the Incrementing Number Trigger Tutorial

