You can now show or hide any vehicle inheriting from ππππ_πππππππ in Verse! ππππ_πππππππ now implements the ππππ ππππ interface, allowing you to set the variable ππππ :πππππ on them to show or hide.
Hereβs a quick script to demonstrate the behavior:
using { /Fortnite.com/Devices }
using { /Fortnite.com/Vehicles }
using { /Verse.org/Simulation }
using { /Verse.org/Simulation/Tags }
using { /UnrealEngine.com/Temporary/Diagnostics }
# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.
# Quick ol' tag class
vehicle_spawner_tag := class(tag){}
# A Verse-authored creative device that can be placed in a level
vehicle_hider_device := class(creative_device):
@editable
var<public> ShowButton:button_device = button_device{}
@editable
var<public> HideButton:button_device = button_device{}
# Grab these by tag OnBegin()
var Spawners: []vehicle_spawner_device = array{}
# Runs when the device is started in a running game
OnBegin<override>()<suspends> : void =
FindTaggedSpawners()
ShowButton.InteractedWithEvent.Subscribe(ShowVehicles)
HideButton.InteractedWithEvent.Subscribe(HideVehicles)
# Grabbed our tagged objects, check to ensure they're a spawner, then cache 'em off.
FindTaggedSpawners() : void =
TaggedObjects := GetCreativeObjectsWithTag(vehicle_spawner_tag{})
for (Objects : TaggedObjects):
# Confirm we're looking at a vehicle spawner
if (Spawner := vehicle_spawner_device[Objects]):
set Spawners = Spawners + array{Spawner}
ShowVehicles(Agent:agent) : void =
for (Spawner : Spawners):
# Grab the vehicle instance created by the spawner (if any)
if (MyVehicle := Spawner.Vehicle?):
# Show the vehicle (if any)
set MyVehicle.Show = true
HideVehicles(Agent:agent) : void =
for (Spawner : Spawners):
# Grab the vehicle instance created by the spawner (if any)
if (MyVehicle := Spawner.Vehicle?):
# Hide the vehicle (if any)
set MyVehicle.Show = false