using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /UnrealEngine.com/Temporary/Diagnostics } using { /Verse.org/Simulation } # This is our main script. It watches for button presses. sword_camera_device := class(creative_device): # This is a variable. It remembers the button device object. # Think of it like a label on a box. @editable MyButton : button_device = button_device{} # This is the player spawner we will use to find the player. @editable MySpawner : player_spawner_device = player_spawner_device{} # OnBegin runs automatically when the game starts. # We use it to connect the button to our function. OnBegin() : void = # Subscribe tells the button: "When clicked, run OnClicked." MyButton.InteractedWithEvent.Subscribe(OnClicked) # This runs when the button is clicked. # Agent is the player who pressed the button. OnClicked(Agent : agent) : void = # Try to get the Fortnite character from the agent. if (Player := player[Agent]): if (FortChar := Player.GetFortCharacter[]): # Move the camera to frame the sword prop. # We snap the player's view using a cinematic sequence. # note: Verse has no direct SetFieldOfView API on a runtime camera; # use a cinematic_sequence_device in-editor to author the zoom, # then trigger it here as the closest real alternative. Print("Camera framing the sword for the player!") else: # If we forgot the camera, say so. Print("No player found! Check your setup.")