using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/SpatialMath } # This is our main script for the Taxi Spawner. # It runs when the game starts. taxi_driver_script := class(creative_device): # We connect this property to our Taxi Spawner device # in the UEFN editor by selecting it in the Details panel. @editable TaxiSpawner : vehicle_spawner_taxi_device = vehicle_spawner_taxi_device{} # This function runs automatically when the game begins. OnBegin(): void = # Step 1: Spawn the taxi at this spawner's location. # We use 'Activate()' to make the taxi appear. TaxiSpawner.Activate() # Step 2: Find the player who is closest to the taxi. # We assume there is one player for this simple example. AllPlayers := GetPlayspace().GetPlayers() if (AllPlayers.Length > 0): Player := AllPlayers[0] # Step 3: Move the player into the taxi. # We use 'TeleportTo()' on the fort_character to jump the player into the car. # note: EnterVehicle is not yet exposed; teleporting to the spawner's # transform places the player at the taxi's location as a close approximation. if (Character := Player.GetFortCharacter[]): SpawnerTransform := TaxiSpawner.GetTransform() Character.TeleportTo[SpawnerTransform.Translation, SpawnerTransform.Rotation] # Step 4: Let the player drive! # We print a message to the screen to say we are ready. Print("Taxi is ready. Drive safely!")