# Import the core Verse libraries we need using { /Fortnite.com/Devices } using { /Verse.org/Simulation } # Define our script component CinematicTriggerDevice := class(creative_device): # This is the camera device we dragged into the editor # note: gameplay_camera_fixed_angle_device is the real Verse type for a Fixed Angle Camera device @editable MyCamera : gameplay_camera_fixed_angle_device = gameplay_camera_fixed_angle_device{} # This is the trigger volume device we dragged into the editor @editable MyTrigger : trigger_device = trigger_device{} # This is the time the camera lock lasts (in seconds) LockDuration : float = 5.0 # This function runs when the game starts OnBegin() : void = # Subscribe to the trigger's overlap event so we know when a player enters MyTrigger.TriggeredEvent.Subscribe(OnTriggered) # Optional: Log a message to the console to debug Print("Cinematic Trap Armed!") # This function runs when something enters the trigger # trigger_device fires TriggeredEvent with the Agent that activated it OnTriggered(Agent : ?agent) : void = # Spawn a concurrent task so the Wait() does not block the event callback if (A := Agent?): spawn{ RunCinematic(A) } # Async helper that locks and then releases the camera for one agent RunCinematic(Agent : agent) : void = # 1. ADD THE CAMERA # We are pushing 'MyCamera' onto 'Agent's' camera stack. # This makes MyCamera the active view. MyCamera.AddTo(Agent) # 2. WAIT # We pause the script for 5 seconds. The player is now stuck looking through our camera. Sleep(LockDuration) # 3. REMOVE THE CAMERA # We pop the camera off the stack. The player returns to normal view. MyCamera.RemoveFrom(Agent) Print("Player released from cinematic view!")