# Import the basic Verse libraries we need
using /Fortnite.com/Devices
using /Engine/Systems/Engine
# 1. Define our Tag
# Think of this as writing the sticky note name in our code so Verse knows what we're looking for.
Tag: PuzzleLight = Tag("PuzzleLight")
# 2. Create our Device Script
# This script will control the lights. It's like the brain of the puzzle.
@editable
LightController: Device = Device()
# This function runs once when the game starts.
# It's like the referee blowing the whistle to start the match.
OnBegin<override>()<suspends>: void =
# We need a place to store our found lights.
# A "List" is just an ordered collection, like a loot bag.
found_lights: List<CustomizableLight> = List<CustomizableLight>()
# 3. Find the Lights
# This is the magic line. We ask the World to find all entities
# that have our specific Tag.
# It's like shouting "Team Red!" and everyone raises their hand.
for light_entity := World.FindEntitiesWithTag(Tag) do
# We only want CustomizableLights, not other stuff that might have the tag.
# We check if the entity *is* a CustomizableLight.
if (light := light_entity.As<CustomizableLight>()) then
# If it is, we add it to our loot bag (list).
found_lights.Add(light)
Verse Library
verse
01 Fragment
Queries the world for tagged light entities and controls their state programmatically.
verse-library/tagged-lights-2-setting-up-the-level-in-verse/01-fragment.verse
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.