// ChaosSystem.verse // This script listens for a Rocket Boost pickup and triggers a chaos alarm. // 1. Define the Script Structure // Think of this as the "Brain" of your island. It holds all the logic. ChaosSystem := script() { // 2. Declare the Devices (The "Nodes" in our Scene Graph) // We tell Verse to find these specific devices by name. // If the name in Verse doesn't match the editor, it won't work! ChaosBoost := object:RocketBoostPowerUpDevice ChaosLights := object:PropMoverDevice AlarmLights := object:PropMoverDevice // 3. Define the "On Start" Function // This runs once when the island starts. On Start () -> void { // We don't need to do much here, but we could set initial states. // For now, let's just log that we're alive. Print ("Chaos System Activated. Watch out!") } // 4. The Event Listener: "On Boost Picked Up" // This is the core magic. We subscribe to the Boost's event. // When the player picks up the boost, this function runs. On RocketBoostPickedUp () -> void { // A. Trigger the Alarm Lights immediately // We use the PropMover's "Set Color" function. // Imagine this as flipping a switch to turn the lights red. AlarmLights.Set Color (Color { R: 1.0, G: 0.0, B: 0.0 }) // Red! // B. Wait for 5 seconds // This pauses the script for 5 seconds so the chaos doesn't end instantly. Wait (5.0) // C. Reset the lights // Turn them back to normal (White) AlarmLights.Set Color (Color { R: 1.0, G: 1.0, B: 1.0 }) // D. Optional: Play a sound or spawn particles here! Print ("Chaos Mode Over. Phew.") } // 5. Hooking it up: Connect the Event to the Function // We tell the ChaosBoost device: "When you get picked up, run On RocketBoostPickedUp." // This is how we link the Transmitter (Boost) to our Logic (Script). ChaosBoost.On Picked Up += On RocketBoostPickedUp }