# This script makes players spawn on the bike automatically. using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # We define our Dirt Bike Spawner here. # Think of this as naming our magic box. dirt_bike_race_manager := class(creative_device): # Drag your Dirt Bike Spawner device onto this property # in the UEFN details panel. @editable var BikeSpawner : vehicle_spawner_dirtbike_device = vehicle_spawner_dirtbike_device{} # This function runs when the game starts. OnBegin(): void = # Subscribe to the spawned event so we act # as soon as the vehicle exists in the world. BikeSpawner.SpawnedEvent.Subscribe(OnBikeSpawned) # This function is called each time the spawner # creates a new vehicle. # note: vehicle_spawner_device.SpawnedEvent passes the # fort_vehicle that was spawned. OnBikeSpawned(Vehicle : fort_vehicle): void = # Get all agents currently associated with the spawner # and attempt to add them to the vehicle. # note: There is no direct EnterVehicle() on # vehicle_spawner_device; AddAgent on fort_vehicle is the # supported way to seat a player via Verse. if (Agent := BikeSpawner.Vehicle?): Vehicle.AddAgent[Agent]