using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
# This is our main device. It is the brain of our house.
SmartLightDevice := class(creative_device):
# This is the light we want to control.
# We will connect it later in the editor.
@editable
my_light: customizable_light_device = customizable_light_device{}
# This is the trigger mat.
# We will connect it later in the editor.
@editable
entry_trigger: trigger_device = trigger_device{}
# This function runs when the game starts.
OnBegin<override>()<suspends>: void =
# We tell the trigger: "Listen for players!"
entry_trigger.TriggeredEvent.Subscribe(
# When a player steps on the mat...
OnEntryTriggered
)
# This helper function receives the agent who stepped on the mat.
OnEntryTriggered(Agent: ?agent): void =
# ...turn the light on!
my_light.TurnOn()
Verse Library
verse
01 Device
Turns on a customizable light when a player steps on a trigger mat.
verse-library/build-lego-home-builder-in-fortnite/01-device.verse