Version:

Adding Door Sounds

Adding Door Sounds

You add two Lua Script components and two audio components to the EntryDoor_Trigger entity to trigger sounds of a door opening and closing.

To add the Lua Script component for door sounds

  1. In the Entity Outliner, select EntryDoor_Trigger.

In the Entity Inspector, click Add Component, and then add the Lua Script component. Repeat this step to add a second Lua Script component.
[Image NOT FOUND]

  1. In the first Lua Script component, click Browse (...) next to the Script box.

    Navigate to StarterGame\Scripts\Triggers and select TriggerEventAudioReceiver.lua. Click OK.

  2. In the properties that appear, set the following values:

  • EventName – Type OpenEntryDoor
  • Sound – Type Play_AMZ_sfx_spfx_ship_door_open
  • TriggerOnce – Clear the check box
    [Image NOT FOUND]
  1. In the second Lua Script component, click Browse (...) next to the Script box.

    Navigate to StarterGame\Scripts\Triggers and select TriggerEventAudioReceiver.lua. Click OK.

  2. In the properties that appear, set the following values:

  • EventName – Type CloseEntryDoor
  • Sounds – Type Play_AMZ_sfx_spfx_ship_door_close
  • TriggerOnce – Clear the check box
    [Image NOT FOUND]

Now you add two audio components: Audio Proxy and Audio Trigger. The Audio Proxy component is required on any entity that uses audio. The Audio Trigger component triggers the audio.

To add the audio components

  1. In the Entity Outliner, select the EntryDoor_Trigger entity.

  2. In the Entity Inspector, click Add Component. Under Audio, select Audio Proxy.
    [Image NOT FOUND]

  3. Click Add Component again. Under Audio, select Audio Trigger.
    [Image NOT FOUND]

Your two Lua Script components and your two audio components should look like the following.
[Image NOT FOUND]

  1. Press Ctrl+S to save your level.

  2. Press Ctrl+G to play your level. When you approach the door, you should hear the door opening and closing in concert with those actions.

    Press Esc to quit.

Next: Adding the Exit Door