Verse Library verse

01 Using The Input Trigger Device In Verse

Integrates Verse with Fortnite Creative devices to subscribe to input events and iterate over players.

extracted-snippets/documentation/en-us/fortnite/using-input-trigger-devices-in-fortnite-creative/01-using-the-input-trigger-device-in-verse.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/using-input-trigger-devices-in-fortnite-creative
# Local doc:  epic-docs/documentation/en-us/fortnite/using-input-trigger-devices-in-fortnite-creative.md
# Section:    Using the Input Trigger Device in Verse
using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Simulation }
# A Verse-authored creative device that can be placed in a level
input_trigger_device_verse_example := class(creative_device):
# Reference to the Input Trigger device in the level.
# In the Details panel for this Verse device,
# set this property to your Input Trigger device.
@editable
MyInputTriggerDevice:input_trigger_device = input_trigger_device{}
# Reference to a VFX Spawner device in the level.
# In the Details panel for this Verse device,
# set this property to your VFX Spawner device.
@editable
VFXSpawnerDevice:vfx_spawner_device = vfx_spawner_device{}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
# Example for subscribing to an event on the Creative device.
# Signaled when a player presses the specified input on the device.
MyInputTriggerDevice.PressedEvent.Subscribe(OnInputPressed)
# Example for subscribing to an event on the Creative device.
# Signaled when a player releases the specified input on the device.
MyInputTriggerDevice.ReleasedEvent.Subscribe(OnInputReleased)
# This example iterates through all players in the experience to show how to do operations per player on the device.
for (Player : GetPlayspace().GetPlayers()):
# Adds `Agent` to the registered player list.
MyInputTriggerDevice.Register(Player)

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in