using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # This is our main script block. # Think of it as the container for our game rules. # In UEFN, we declare devices as editable properties so the # editor can wire up the correct objects from the World Outliner. reset_game_script := class(creative_device): # We need to tell Verse which tiles to reset. # Select this device in the editor and assign your # Color Changing Tiles in the Details panel. @editable Tile1 : color_changing_tiles_device = color_changing_tiles_device{} @editable Tile2 : color_changing_tiles_device = color_changing_tiles_device{} # We also need the button that triggers the reset. # Assign your Conditional Button in the Details panel. @editable Button : button_device = button_device{} # OnBegin runs once when the island starts. # It waits for the button to be pressed. OnBegin() : void = # We connect the button's "InteractedWithEvent" to our handler. # When the button is clicked, ResetGameScript runs. Button.InteractedWithEvent.Subscribe(ResetGameScript) # This is our reset handler function. # It is called every time the button is pressed. ResetGameScript(Agent : agent) : void = # This is the magic line! # It tells each tile to go back to its start color. Tile1.Reset() # Reset the second tile too. Tile2.Reset()