using { /Fortnite.com/Devices } using { /Verse.org/Simulation } # This is our main Script Device. # Think of it as the "Brain" that controls the Audio Mixer. class StealthAudioScript is functional_game_script() # We need a reference to the Audio Mixer device. # In the editor, you'll link this to the Audio Mixer you placed. audio_mixer_device: audio_mixer_device = audio_mixer_device{} # We also need a Timer to simulate the "Prep Phase" ending. # Link this to a Timer device in the editor. timer_device: timer_device = timer_device{} # This function runs when the game starts. # It's like the "Battle Bus" dropping off players. OnBegin(): void = # First, let's make sure the footsteps are MUTED. # We do this by activating the mix we set up in the editor (Volume 0.0). # Since we unchecked "Activate on Game Start" in the editor, # we have to call this manually to set the initial state. audio_mixer_device.ActivateMix() # Print a message to the debug console so we know it worked. Print("Stealth Mode ON: Footsteps are muted!") # This function is called when the Timer finishes. # Link the Timer's "On Finish" event to this function in the editor, # OR we can handle it in code if we started the timer ourselves. # For this example, let's assume we start the timer in OnBegin. StartTimer(): void = # Start the timer for 10 seconds (the "Stealth Phase"). timer_device.Start(10.0) # Wait for the timer to finish. # means this code pauses here until the timer ends. timer_device.OnFinish() # NOW, the stealth phase is over. # Let's UNMUTE the footsteps. # NOTE: In the editor, you'd need a SECOND Audio Mixer device # set to Volume 1.0 (Unmuted) and link it to a variable like # `unmute_mixer`, then call ActivateMix() on THAT device. # # For this simple example, we'll just print that we SHOULD unmute. # In a real build, you'd swap the mixer reference or use a # second device configured for full volume. Print("Stealth Mode OFF: Footsteps are now audible!") # If you had a second mixer for unmuted state: # unmute_mixer.ActivateMix()