Stop Dragging Devices: Build Your Own "From Creative" Logic
Tutorial beginner compiles

Stop Dragging Devices: Build Your Own "From Creative" Logic

Updated beginner Code verified

Stop Dragging Devices: Build Your Own "From Creative" Logic

Forget the clunky grid of default devices clogging your Content Browser. You know how frustrating it is to hunt for a specific trigger when your island is a mess of wires? It's like trying to find a specific piece of loot in a storm circle when you're already low on health.

In this tutorial, we're going to stop acting like we're just placing props and start acting like we're the Game Designer. We're going to write a custom device in Verse that doesn't exist in the default list. We'll call it RevengeTrap. When a player steps on it, it doesn't just make a noise—it calculates damage, finds the player, and blasts them back. You'll learn how to create your own tools, manage the Scene Graph (the family tree of your island), and handle events without a single wire.

What You'll Learn

  • The Scene Graph: How Verse sees your island as a hierarchy of objects (parents and children).
  • Custom Devices: How to write code that creates a new tool in your Content Browser.
  • Events & Triggers: How to listen for player actions (like stepping on a button) without wires.
  • State & Interaction: How to make your device "remember" things and interact with players.

How It Works

The Scene Graph: It's Not Just a List, It's a Family Tree

In UEFN, everything you place is part of the Scene Graph. Think of this like your inventory menu, but instead of items, it's every single object in your island. There's a hierarchy. The Island is the parent. Rooms are children of the Island. Walls are children of the Room.

When you write Verse, you aren't just writing code in a void. You are writing code that lives inside a specific object in that tree. This object is called an Entity (or in UEFN terms, a Device).

From Creative vs. Custom Verse

When you use "From Creative" devices, you are playing Tetris with logic. You place a Trigger, you place a Prop Mover, you wire them together. It's visual, but it's messy.

When you write a Custom Device in Verse, you are building the Tetris block itself. You define what the block is and how it behaves.

  1. Class: This is the blueprint. It's like the design sheet for a new weapon.
  2. Instance: This is the actual weapon you hold in your hand. You can have 50 instances of the same blueprint scattered across your map.

The "RevengeTrap" Concept

We are going to build a device that:

  1. Sits on the floor.
  2. Waits for a player to step on it (Event).
  3. Deals damage to that player.
  4. Launches them into the air.

We don't need a Trigger device. We don't need a Damage Dealer device. We are the device.

Let's Build It

Open UEFN. Go to the Verse tab. Create a new file. Let's call it RevengeTrap.verse.

Here is the complete code. Don't panic—each part maps to something you already know.

# 1. IMPORTS
# Think of this like opening your backpack. 
# We need access to the basic Fortnite tools.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }
using { /Verse.org/SpatialMath }
using { /UnrealEngine.com/Temporary/Diagnostics }

# 2. THE BLUEPRINT (CLASS)
# This defines what our custom device IS.
# It inherits from creative_device, which means 
# "I am a thing that can be placed in the world."
RevengeTrap := class(creative_device):

    # 3. CONFIGURABLE STATS
    # These are like the stats on a weapon you can tweak.
    # DamageAmount: How much hurt?
    # LaunchForce: How hard do they fly?
    @editable
    DamageAmount<public>: float = 10.0

    @editable
    LaunchForce<public>: float = 2000.0

    # We wire a trigger_device in the UEFN editor so the device
    # can detect when a player steps on it.
    # Select this device in the Properties panel and point it
    # at a Trigger you have placed on the floor.
    @editable
    Trigger<public>: trigger_device = trigger_device{}

    # 4. THE "BEGIN" FUNCTION
    # This runs ONCE when the game starts.
    # Think of it as the "Loadout" phase. You set up your gear here.
    OnBegin<override>()<suspends>: void =
        # We want to listen for when a player steps on the Trigger.
        # Subscribe is like setting a tripwire:
        # "If the Trigger fires, call OnPlayerStep."
        Trigger.TriggeredEvent.Subscribe(OnPlayerStep)

    # 5. THE EVENT HANDLER
    # This is the logic that runs when the event happens.
    # agent? is the optional agent (player) that activated the Trigger.
    OnPlayerStep<private>(Agent: ?agent): void =
        # Unwrap the optional agent. If no agent triggered it, stop here.
        if (ValidAgent := Agent?):
            # Cast the agent to a fort_character so we can
            # apply damage and impulse through its interface.
            if (Character := ValidAgent.GetFortCharacter[]):
                # Deal damage (like a shotgun blast).
                # note: Damage() is the real fort_character damage method.
                Character.Damage(DamageAmount)

                # Launch them! We create a force vector pointing straight UP.
                # vector3 uses Forward/Left/Up; Up is the up/down axis.
                LaunchVector := vector3{Forward := 0.0, Left := 0.0, Up := LaunchForce}
                Character.ApplyLinearImpulse(LaunchVector)

                # Optional: Play a sound or change color here!
                # But for now, let's just let the physics do the work.```

### Walkthrough: What Just Happened?

1.  **`using { ... }`**: This is your loot pool. You're telling Verse, "I need access to Player logic and Device logic." Without this, you're trying to build a shield wall with no materials.
2.  **`RevengeTrap := class<...>`**: This is your blueprint. By inheriting from `creative_device_base`, you are telling UEFN: "Hey, put this in my Content Browser so I can drag it into the world."
3.  **`DamageAmount` & `LaunchForce`**: These are **Public Variables**. The `@editable` attribute makes them show up in the Properties panel when you place the device. You can tweak the damage from 10 to 100 without rewriting code. It's like adjusting the recoil on your sniper.
4.  **`OnBegin`**: This is the **Game Start** moment. Just like when the bus flies over the island, this function runs once. We use `Subscribe` here. `Subscribe` is like setting a tripwire. We are telling the device: "Watch the Trigger. If it fires, call `OnPlayerStep`."
5.  **`OnPlayerStep`**: This is your **Elimination Screen**. It only runs when the event fires.
    *   `Character.Damage(DamageAmount)`: Simple. The player loses HP.
    *   `Character.ApplyImpulse(...)`: This is the physics kick. We apply a force vector. Since we want them to fly up, we give it a high Z-value (up/down axis).

### How to Use It in UEFN

1.  Save the file.
2.  Go to the **Verse** tab and click **Compile**. (If there are errors, check your brackets `{}`. One missing bracket is like a broken edit piece—it ruins the whole structure).
3.  Once it compiles, go to the **Content Browser** (the asset library).
4.  Look for a folder named `Verse` or `Generated`. You should see `RevengeTrap`.
5.  Drag `RevengeTrap` into your scene. Place it on the floor.
6.  Also drag a **Trigger** device from the Content Browser and place it on the floor at the same spot.
7.  Select your `RevengeTrap` in the Outliner, find the **Trigger** property in the Details panel, and point it at the Trigger device you just placed.
8.  Play your island. Step on it. You should take damage and fly into the stratosphere.

## Try It Yourself

You've built a basic Revenge Trap. Now, let's make it smarter.

**Challenge:** Modify the `RevengeTrap` class so that it only triggers **once**. If a player steps on it, they get launched. If they (or a friend) step on it again, nothing happens.

**Hint:** You need a **Boolean** (a true/false switch). In Fortnite terms, think of it like a **Deployable Shield** that can only be placed once per round. You'll need a variable inside your class that starts as `true`, and inside `OnPlayerStep`, you check if it's `true`. If it is, run the damage logic and set it to `false`.

Here's what that looks like:

```verse
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }

RevengeTrap := class<concrete>(creative_device_base):

    @editable
    DamageAmount<public>: float = 10.0

    @editable
    LaunchForce<public>: float = 2000.0

    @editable
    Trigger<public>: trigger_device = trigger_device{}

    # This is our "already used" switch.
    # var means it can be changed after the game starts.
    # It starts as true: the trap is armed.
    var IsArmed<private>: logic = true

    OnBegin<override>()<suspends>: void =
        Trigger.TriggeredEvent.Subscribe(OnPlayerStep)

    OnPlayerStep<private>(Agent: ?agent): void =
        # Check the switch. If IsArmed is false, do nothing.
        if (IsArmed?):
            # Disarm FIRST so a second player can't trigger it
            # while we're still running this code.
            set IsArmed = false
            if (ValidAgent := Agent?):
                if (Character := ValidAgent.GetFortCharacter[]):
                    Character.Damage(DamageAmount)
                    LaunchVector := vector3{X := 0.0, Y := 0.0, Z := LaunchForce}
                    Character.ApplyImpulse(LaunchVector)

Recap

  • Scene Graph: Your island is a hierarchy. Verse lets you create new nodes in that hierarchy.
  • Custom Devices: Instead of wiring devices together, you write code that is the device.
  • Events: OnBegin sets up the trap. OnPlayerStep is the trap snapping shut.
  • @editable: Use this attribute to expose variables to the UEFN Properties panel so you can tune values without touching code.

You just wrote your first custom Verse device. You're no longer just placing props; you're designing mechanics. Now go make some chaos.

References

  • https://dev.epicgames.com/documentation/en-us/fortnite/fortnite-glossary
  • https://dev.epicgames.com/documentation/en-us/fortnite/fortnite-creative-glossary
  • https://dev.epicgames.com/community/snippets/9VQ/fortnite-digests-release-24-20-cl-24939793
  • https://github.com/vz-creates/uefn
  • https://dev.epicgames.com/documentation/en-us/uefn/verse-api/fortnitedotcom/devices/creative_device

Verse source files

Turn this into a guided course

Add From Creative 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