using { /Engine/Engine } using { /Verse.org/Simulation } using { /Verse.org/Simulation } using { /Fortnite.com/Devices } using { /Fortnite.com/Devices } using { /Fortnite.com/Devices } using { /Engine/SceneGraph } # This is our main script. It runs on the island. # Think of it as the game director controlling the lights. mood_lighting := class(creative_object): # We need to reference the button and the two lights. # These are "variables" that hold pointers to our actors. MoodButton: button_device = ? InterrogatorLight: creative_object = ? VibesLight: creative_object = ? # This function runs when the island starts. # It's like loading the map. OnBegin(): void = # First, we check if we actually have the button and lights. # If not, we stop and yell at the user (in logs). if MoodButton == ? or InterrogatorLight == ? or VibesLight == ? print("Error: Missing Button or Lights! Check your names.") return # Now, we tell the Button: "When you are pressed, run this code." # This is called "binding an event." MoodButton.OnButtonPressed.Bind( func (pressed_button: button_device): void = ToggleLights() ) # This is the function that does the actual work. ToggleLights(): void = # We need to get the actual light components from the creative objects. # A creative_object is just a container. The light is inside it. # We use 'GetComponents' to find the rect_light_component. # Get the Interrogator's light component interrogator_light_comp := InterrogatorLight.GetComponents() # Get the Vibes light component vibes_light_comp := VibesLight.GetComponents() # If we couldn't find the components, stop. if interrogator_light_comp == [] or vibes_light_comp == [] print("Error: Could not find RectLight components!") return # Get the first (and only) light component from the list interrogator_light := interrogator_light_comp[0] vibes_light := vibes_light_comp[0] # Now, let's check the current state. # We'll use a simple boolean flag to track if we are in "Interrogation" mode. # For simplicity, we'll just toggle based on a static variable. # Note: In a real complex game, you might store this state in a class variable. # Let's assume we start in Interrogation mode. # We will toggle by swapping intensities. # Get current intensity of Interrogator current_interrogator_intensity := interrogator_light.GetIntensity() # If Interrogator is bright, turn it off and turn Vibes on. # If Interrogator is dim, turn it on and turn Vibes off. if current_interrogator_intensity > 500 # Switch to Vibes Mode interrogator_light.SetIntensity(0.0) vibes_light.SetIntensity(500.0) print("Switched to Vibes Mode") else # Switch to Interrogation Mode interrogator_light.SetIntensity(1000.0) vibes_light.SetIntensity(0.0) print("Switched to Interrogation Mode")