Menu
Lumberyard
Getting Started Guide (Version 1.11)

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.

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

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

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

    • EventName – Type OpenEntryDoor

    • Sounds – Type Play_AMZ_sfx_spfx_ship_door_open

    • TriggerOnce – Clear the check box

  4. In the second Lua Script component, click Browse (...) next to the Script box.

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

  5. 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

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.

  3. Click Add Component again. Under Audio, select Audio Trigger.

    Your two Lua Script components and your two audio components should look like the following.

  4. Press Ctrl+S to save your level.

  5. 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