using { /Fortnite.com/Devices }
using { /Unreal.com/Engine }
module TankSpawnerTutorial
# Define our Tank Spawner device.
# We will reference this in the editor.
var TankSpawnerDevice := TankSpawnerDevice{}
# Function: Spawn the tank when called.
# 'void' means it doesn't return any data, it just *does* something.
SpawnTank := function (): void =>
# Spawn() creates the tank at the spawner's location.
# It returns the spawned tank entity, but we don't need to store it here.
TankSpawnerDevice.Spawn()
# Event: OnBeginPlay.
# This runs once when the game starts.
# We use this to 'bind' our function to the button's event.
OnBeginPlay := function (): void =>
# 'Bind' connects the button's 'OnActivated' event to our SpawnTank function.
# Now, every time the button is pressed, SpawnTank runs.
GetRevengeButton.OnActivated.Bind(SpawnTank)
# We need to define the button variable to bind to it.
# In UEFN, you usually drag the device into the Verse component's properties.
var GetRevengeButton := ButtonDevice{}
Verse Library
verse
02 Fragment
Spawns a tank entity when a designated button device is activated by players.
verse-library/using-tank-spawner-devices-in-fortnite-creative/02-fragment.verse