Device Events and Subscribe: Joining the Crowd
Tutorial beginner compiles

Device Events and Subscribe: Joining the Crowd

Updated beginner Events Code verified

Device Events and Subscribe: Joining the Crowd

In the last lesson you learned an event is an announcement: something broadcasts, listeners receive. The easiest events to start with are the ones Fortnite devices broadcast for free. This lesson teaches you to listen to them.

Devices are always announcing

<!-- section-art:devices-are-always-announcing --> Device Events and Subscribe: Joining the Crowd: Devices are always announcing

Device Announcer

Every device is a little announcer. A Button announces "I was interacted with!" A Trigger announces "someone walked into me!" A Timer announces "I finished!" These announcements are the device's events, and they have names:

  • button_device broadcasts InteractedWithEvent.
  • trigger_device broadcasts TriggeredEvent.
  • timer_device broadcasts SuccessEvent.

You do not make these happen — the device does, during play. Your job is to listen and react.

The shape of listening: Subscribe

To listen, you call Subscribe on the event and hand it the verb you want run:

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

door_opener := class(creative_device):

    @editable
    EntryTrigger : trigger_device = trigger_device{}

    OnBegin<override>()<suspends> : void =
        # "When the entry trigger fires, run OnPlayerEntered."
        EntryTrigger.TriggeredEvent.Subscribe(OnPlayerEntered)

Read the key line as a sentence: "EntryTrigger's triggered event → Subscribe → run OnPlayerEntered." Three parts:

  • EntryTrigger.TriggeredEvent — the announcement you care about.
  • .Subscribe(...)"add me to the listeners."
  • OnPlayerEntered — the verb to run each time it is announced.

Notice there are no parentheses after OnPlayerEntered here. You are handing over the verb itself to be run later — not running it now. Saying OnPlayerEntered() would run it once, immediately, which is not what you want.

Where to subscribe: in OnBegin

Subscribing belongs in OnBegin, the starting whistle from the Devices series. You set up all your listening once, when the island starts, so everything is wired before a player can do anything:

OnBegin<override>()<suspends> : void =
        EntryTrigger.TriggeredEvent.Subscribe(OnPlayerEntered)

Subscribe once. From then on, every time the trigger fires, your verb runs. You do not re-subscribe each time.

The handler verb (and its free gift)

The verb you subscribe is called a handler — it handles the event. Here is the part that surprises people: most device events hand your handler a value describing what happened. For player-related events, that value is the agent — the player involved.

# The trigger hands us the player who walked in, as an agent.
    OnPlayerEntered(Agent : agent) : void =
        Print("A player entered the area!")

The trigger fired because a player walked in, so it hands that player to your handler for free. You did not have to go find them. This is the payload of the event — the information that rides along with the announcement.

The handler's shape must match what the event carries. A trigger's event carries an agent, so the handler takes (Agent : agent). If you look an event up in the docs and it says it carries an agent, your handler takes an agent. Match the shape and it works.

Putting it together

<!-- section-art:putting-it-together --> Device Events and Subscribe: Joining the Crowd: Putting it together

Event Loop

A complete, working "walk in, do something" device: verse OnBegin<override>()<suspends> : void = StartButton.InteractedWithEvent.Subscribe(OnButtonPressed)

OnButtonPressed(Agent : agent) : void =
    Print("Button pressed!")

Once you know the shape, every device event is the same three moves: find the event name, `Subscribe` a handler, give the handler a parameter that matches the payload.

## Why this helps you direct an AI

You can now ask for behavior with full precision: *"Subscribe a handler to the entry trigger's `TriggeredEvent`; in it, grant the entering agent an item."* That names the event, the listening, the handler, and the payload — a complete, buildable instruction with nothing left to guess.

## Quick recap

- Devices broadcast named events: `InteractedWithEvent`, `TriggeredEvent`, `SuccessEvent`, …
- **`Event.Subscribe(Handler)`** starts listening; hand over the verb with **no `()`**.
- Subscribe **once**, in `OnBegin`.
- The **handler** runs each time the event fires.
- Most events carry a **payload** — often the `agent` (player) involved — handed to your handler for free.
- Match the handler's parameter to the event's payload.

Next: [Make Your Own Event](/guides/verse-events-custom) — broadcasting your own announcements.

## References

- [Using Events in Verse](https://dev.epicgames.com/documentation/en-us/uefn/using-events-in-verse)
- [Devices in Verse — API Reference](https://dev.epicgames.com/documentation/en-us/fortnite/devices-in-verse)
- Part of the **Events & Subscribables** series. Pairs with [Three Devices, End to End](/guides/verse-devices-common-devices).

Get the complete code — free

You've read the full walkthrough. The complete, copy-paste-ready Verse solution is free for members — sign in to unlock it.

Free with your BrainDead.TV / BrainDeadGuild Discord account. The walkthrough above is always free.

Verse source files

Check your understanding

Test yourself with an interactive quiz and track your progress + earn XP — free for members.

Up next · Events & Subscribables Make Your Own Event: Announce Victory With a HUD Widget Continue →

Turn this into a guided course

Add Events in Verse — device events, Subscribe, handlers, payloads to your free study plan — we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.

Original tutorial generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.

Comments

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