using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # This is our script. It lives on the cave device. CaveScript := class(creative_device): # Wire the trigger device in the UEFN editor. @editable CaveTrigger : trigger_device = trigger_device{} # Wire the campfire device in the UEFN editor. # note: campfire_device is the real Verse type for the Campfire Device. @editable Campfire : campfire_device = campfire_device{} # This variable is our sticky note. # It starts as false (0). The fire is off. var IsFireLit : logic = false # OnBegin runs once when the game starts. # We use it to connect the doorbell to the recipe. OnBegin() : void = # This binds the function to the trigger. # It means: "When the trigger is entered, run OnPlayerEnter." CaveTrigger.TriggeredEvent.Subscribe(OnPlayerEnter) # This function is the recipe. # It runs when a player enters the trigger zone. OnPlayerEnter(MaybeAgent : ?agent) : void = # Check if the fire is already lit. if (IsFireLit = false): # Turn the fire on! # We set our sticky note to true (1). set IsFireLit = true # This line lights the fire in the game. Campfire.Enable() # Tell the player something cool happened. Print("You found the secret campfire!")