# This is the start of our script using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # We create our game manager class # A class holds all our code in one place spy_trap_manager := class(creative_device): # We connect to a Disguise Device placed in the island # Tag this device in the editor by selecting it and setting its Tag @editable MyDisguise : disguise_device = disguise_device{} # We connect to a Trigger Device so we know when a player steps on it # Place a Trigger Device in the island and link it here in the editor @editable MyTrigger : trigger_device = trigger_device{} # OnBegin runs automatically when the island starts OnBegin() : void = # Subscribe to the trigger so we know when a player enters MyTrigger.TriggeredEvent.Subscribe(OnPlayerEnter) # Subscribe to the disguise device's broken event # This fires when the disguise is removed for any reason MyDisguise.BreakDisguiseEvent.Subscribe(OnDisguiseRemoved) # When a player steps on the trigger, apply the disguise # This is the main action! OnPlayerEnter(Agent : ?agent) : void = if (ActualPlayer : player = player[Agent?]): MyDisguise.ApplyDisguise(ActualPlayer) Print("You are now a spy!") # When the disguise is removed, let the player know # The BreakDisguiseEvent fires when the disguise breaks, # including when the player takes damage (set Break On Damage # to true in the Disguise Device's properties in the editor) OnDisguiseRemoved(Info : tuple(player, ?agent)) : void = Print("Spy mode off!")