// We are defining a script that runs on an object (like the Trigger) script class LightTrapScript: // 1. VARIABLES: These are like your inventory slots. // We need to connect to the device named "MainLight" in the editor. // 'MainLight' must match the Name field in UEFN exactly. MainLight: CustomizableLightDevice = CustomizableLightDevice(MainLight) // 2. FUNCTIONS: This is our "Combo Move." // It takes a 'Color' as input and changes the light. // Think of 'Color' as the ammo you feed into the function. func SetLightTo(color: Color) -> void: // This line sends a signal to the device to change its color. // It's like pressing the 'Change Color' button on the remote. MainLight.SetColor(color) // Optional: Log a message to the debug console to prove it worked. #print(f"Light changed to {color}") #event OnBegin(): #print("Trap armed! Waiting for players...") #event OnStart(): #print("Script started.") // 3. EVENTS: These are triggered by game actions. // OnTriggered fires when someone walks into our Trigger Volume. #event OnTriggered(Other: Actor): // Check if the thing that triggered it is a Player. if (Other.IsPlayer()): #print(f"{Other.GetDisplayName()} triggered the trap!") // Call our function and pass in the color RED. // In Verse, we use the built-in Color struct. SetLightTo(Color(255, 0, 0, 255)) // Note: Color is (R, G, B, Alpha). 255,0,0 is pure red. // Bonus: Let's make it reset if the player leaves? // For now, let's just make it toggle if you want to get fancy later.