Lumberyard
Getting Started Guide (Version 1.16)

Adding Lua Script Components

You add three more components, all Lua Script components, to the TimerStart entity. You then add the following scripts and make the following changes:

  • Lua Script component #1:

    • ScriptTimer.lua

    • TimerElementNameTimer

  • Lua Script component #2:

    • ScriptTriggerEvent.lua

    • EventNameTimerStart

  • Lua Script component #3:

    • ScriptTriggerEvent.lua

    • EventNameTimerStop

You then use the Move tool to adjust the TimerStart entity's position in the viewport so that it is just inside the maze entrance.

To add and configure Lua Script components

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

  2. In the Entity Inspector, click Add Component.

    Select Lua Script.

    Repeat twice more so that you have a total of three Lua Script components on the TimerStart entity.

  3. On the first Lua Script component, do the following:

    • Click Browse (...) next to the Script box. Navigate to StarterGame\Scripts\General and select Timer.lua.

    • In the TimerElementName property, enter Timer.

  4. On the second Lua Script component:

    • Click Browse (...) next to the Script box. Navigate to StarterGame\Scripts\Triggers and select TriggerEvent.lua.

    • In the EventName property, enter TimerStart.

  5. On the third Lua Script component:

    • Click Browse (...) next to the Script box. Navigate to StarterGame\Scripts\Triggers and select TriggerEvent.lua.

    • In the EventName property, enter TimerStop.

  6. In the viewport, use the Move tool to adjust the position of the TimerStart entity so that it is just inside the maze entrance. That way, the timer starts when the player enters the maze.

  7. Press Ctrl+S to save your level.

Next, you add and configure a similar set of entities and components at the maze's exit to trigger the timer to stop.

Next: Adding and Configuring the Timer's Stop Trigger