# Import necessary modules using { /Fortnite.com/Devices } # Gives us access to devices like trigger_device using { /Verse.org/Simulation } # Gives us access to game simulation logic using { /Fortnite.com/Characters } # Gives us access to fort_character for agent casting using { /Verse.org/Colors } # Gives us access to color types (unused here, safe to remove) using { /Fortnite.com/UI } # Gives us access to fort_hud_controller and hud_element_identifier types using { /Fortnite.com/Game } # Gives us access to fort_playspace and GetHUDController # Define the device class # This is like building a new custom device in the Creative UI StealthModeTrigger := class(creative_device): # 1. Define the Trigger device we'll place in the editor # We expose this so you can drag-and-drop a trigger_device into this device's slot @editable TriggerVolume : trigger_device = trigger_device{} # 2. Define the HUD Controller # We expose this so you can link the HUD Controller device here @editable HudController : hud_controller_device = hud_controller_device{} # 3. The "On Begin" function # This runs once when the game starts OnBegin() : void = # Subscribe to the trigger's TriggeredEvent for every agent who enters. # trigger_device exposes TriggeredEvent, which fires with the triggering agent (optional). TriggerVolume.TriggeredEvent.Subscribe(OnAgentTriggered) # Called automatically by TriggeredEvent each time a player triggers the trigger OnAgentTriggered(EnteredAgent : ?agent) : void = # Unwrap the optional agent, then cast to player; fails silently if NPC or no agent if (TheAgent := EnteredAgent?): if (EnteredPlayer : player = player[TheAgent]): HideHUD(EnteredPlayer) # The function that actually hides the UI HideHUD(TargetPlayer : player) : void = # Hide multiple HUD elements for the specific player using the real API. # fort_hud_controller.HideElementsForPlayer takes a player and an array of hud_element_identifier. # We get the fort_hud_controller from the playspace. Playspace := GetPlayspace() HUDController := Playspace.GetHUDController() HUDController.HideElementsForPlayer(TargetPlayer, array: creative_hud_identifier_minimap{}, creative_hud_identifier_shields{}, creative_hud_identifier_ammo{}, creative_hud_identifier_score{})