# This is a simple Verse script. # It changes a prop's color when you touch it. using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /UnrealEngine.com/Temporary/SpatialMath } using { /UnrealEngine.com/Temporary/Diagnostics } using { /Verse.org/Simulation } # We define a device called "GlowingProp". # This device holds our prop and its material. GlowingProp := class(creative_device): # This is the prop we want to change. # Wire this to a creative_prop in the editor. @editable Prop : creative_prop = creative_prop{} # This is the trigger we use to detect a player touching the prop. # Place a trigger device around the prop in the editor and wire it here. # note: Verse has no direct per-prop touch API; a trigger_device is the # standard way to detect a player entering a prop's area. @editable TouchTrigger : trigger_device = trigger_device{} # OnBegin runs when the game starts. OnBegin() : void = # Subscribe to the trigger's Triggered event. # When a player walks into the trigger, OnPropTouched fires. TouchTrigger.TriggeredEvent.Subscribe(OnPropTouched) # This function runs when a player touches the prop area. OnPropTouched(Agent : ?agent) : void = # Swap the prop's mesh to the glowing green variant by hiding # and showing it, or drive a param on a Conditional Button. # note: creative_prop exposes no runtime material-parameter API in # public UEFN Verse. The standard approach is to pre-author # two prop assets (default and glowing) and swap visibility. Prop.Hide() # The glowing version of the prop should be a second creative_prop # placed in the same spot and wired to GlowingPropVariant below. GlowingPropVariant.Show() # This is the pre-lit glowing green version of the same prop. # Wire this to a creative_prop that already has Glowing_Cube_Mat applied. @editable GlowingPropVariant : creative_prop = creative_prop{}