using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # This is the main structure for our island logic. # Think of this as the "Brain" of our platform system. platform_vanisher := class(creative_device): # 1. DEFINE THE VARIABLES # We need to tell Verse which devices we are controlling. # @editable means we can drag-and-drop devices from the editor into these slots. # This is safer than hard-coding names, and it's how Verse actually resolves # device references at edit time. # Here, we define the trigger zone. # trigger_device is the real Verse type for the Trigger Device in UEFN. @editable PlatformTrigger : trigger_device = trigger_device{} # Here, we define the platform itself. # creative_prop is the real Verse type for a placeable Static Prop in UEFN. @editable MyFloatingPlatform : creative_prop = creative_prop{} # 2. DEFINE THE ENTRY POINT # OnBegin runs automatically when the game session starts. # This is where we wire up our event listener so it is ready before # any player can step on the platform. OnBegin() : void = # Subscribe to the TriggeredEvent on the trigger device. # AgentTriggeredEvent fires whenever any agent (player) enters the zone. # Await blocks here until the event fires, then calls our handler. loop: MaybeAgent := PlatformTrigger.TriggeredEvent.Await() if (Agent := MaybeAgent?): OnPlayerEnteringZone(Agent) # 3. DEFINE THE EVENT HANDLER (The "Wake Up" Call) # This function runs each time a player enters the trigger zone. OnPlayerEnteringZone(Agent : agent) : void = # 4. TAKE ACTION # When this event fires, we disable the platform we stored above. # Hide() hides the prop and removes its collision, # so the player falls straight through. MyFloatingPlatform.Hide() # Print a message to the debug console to prove it worked. Print("Platform vanished! Goodbye, player.")