# Source URL: https://dev.epicgames.com/community/snippets/oYjD/fortnite-make-comparable-device
# Local doc: epic-docs/community/snippets/oYjD/fortnite-make-comparable-device.md
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Random }
using { /UnrealEngine.com/Temporary/SpatialMath }
MakeUniqueDevice<constructor>(Device:device_type where device_type:subtype(creative_device_base))<transacts> := unique_device(device_type):
Device := Device
unique_device<public>(DeviceType:subtype(creative_device_base)) := class<unique>:
Device<public> : DeviceType
ConvertArray(Devices:[]device_type where device_type:subtype(creative_device_base)):[]unique_device(device_type)=
for(Device : Devices):
MakeUniqueDevice(Device)
Expand code Copy full snippet(14 lines long)
* ```
test_device := class(creative_device):
@editable
Triggers : []trigger_device = array{}
var ConvertedTriggers : []unique_device(trigger_device) = array{}
OnBegin<override>()<suspends>:void=
set ConvertedTriggers = ConvertArray(Triggers)
if:
TargetTrigger := ConvertedTriggers[GetRandomInt(0, ConvertedTriggers.Length)]
Index := ConvertedTriggers.Find[TargetTrigger]
NewElements := ConvertedTriggers.RemoveElement[Index]
set ConvertedTriggers = NewElements
Verse Library
verse
01 Snippet
Wraps triggers uniquely and randomly selects, removes, and activates one per cycle.
extracted-snippets/community/snippets/oYjD/fortnite-make-comparable-device/01-snippet.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.