Tag Utilities
Tag Utilities
Convenience wrappers around gameplay tags: find tagged objects, find by any of several tags, and cast results to buttons / lights.
Original, compile-verified Verse by Bizanator (Biloxi Studios). Clean-room sample you can drop into a UEFN project and adapt.
# Tag Utilities — Biloxi Studios Inc.
#
# Convenience wrappers around Verse gameplay tags for finding placed objects and
# devices at runtime, plus casting helpers. Gameplay tags let you decouple your
# logic from hard device references — tag the actors in the editor, then discover
# them in code.
#
# Teaches: FindCreativeObjectsWithTag, looping over multiple tags, the failable
# device cast `customizable_light_device[Object]`, and collecting cast results
# with a `for` comprehension.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Simulation/Tags }
tag_utils<public> := module:
# Return every creative object carrying SearchTag. A reusable creative_device
# is needed to perform the lookup; pass one in to avoid allocating per call.
# FindCreativeObjectsWithTag yields a generator, so a `for` collects it into
# an array.
FindWithTag<public>(Finder:creative_device, SearchTag:tag):[]creative_object_interface =
for (Object : Finder.FindCreativeObjectsWithTag(SearchTag)):
Object
# Return every creative object carrying ANY of the given tags (union, in tag
# order). Duplicates are possible if an object has more than one of the tags.
FindWithAnyTag<public>(Finder:creative_device, SearchTags:[]tag):[]creative_object_interface =
var Found:[]creative_object_interface = array{}
for (SearchTag : SearchTags):
set Found += FindWithTag(Finder, SearchTag)
Found
# Find objects with a tag and cast each to a button_device, dropping any that
# aren't buttons. Mirror this pattern for any device type you tag.
FindButtons<public>(Finder:creative_device, SearchTag:tag):[]button_device =
for:
Object : Finder.FindCreativeObjectsWithTag(SearchTag)
Button := button_device[Object]
do:
Button
# Find objects with a tag and cast each to a customizable_light_device.
FindLights<public>(Finder:creative_device, SearchTag:tag):[]customizable_light_device =
for:
Object : Finder.FindCreativeObjectsWithTag(SearchTag)
Light := customizable_light_device[Object]
do:
Light