# This is the main script for our magic floor
# It lives inside the class for the Trigger Device
using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/SimpleMath }
# We define our own special device type
# It inherits behavior from a Trigger Device
trigger_device my_magic_trigger = trigger_device{}
# This is our "Recipe" (Function)
# It runs when the trigger is activated
OnPlayerTouch(ActivatingPlayer:?agent):void=
# First, we check if a player actually touched it
# The ?agent means it might be empty (null)
if ActivatingPlayer==nil:
return # Stop here if no player touched it
# Next, we find the platform we want to hide
# We look for the parent device in the scene graph
# The trigger is usually a child of the platform
platform := ActivatingPlayer.GetParentDevice()
# Now we tell the platform to hide!
# We change its visibility to false
platform.SetVisibility(false)
# This is the "Ding!" sign (Event Subscription)
# We connect the trigger's event to our recipe
my_magic_trigger.TriggeredEvent.Subscribe(OnPlayerTouch)
Verse Library
verse
01 Fragment
Hides a platform when a player activates a trigger volume.
verse-library/detecting-the-player-landing-on-the-platform/01-fragment.verse