# This is a comment. It explains the code. # We are making a script for our game. using { /Fortnite.com/Devices } using { /Verse.org/Simulation } # This is our main class. It holds our game logic. MyGameScript := class(creative_device): # Wire up your shooting_range_target_devices in the UEFN Details panel, # one entry per dummy you place on the island. @editable Targets : []shooting_range_target_device = array{} # This function runs when the game starts. OnBegin() : void = # We tell the system to wait a little bit. # This helps everything load properly. Sleep(2.0) # Now we start the game loop. StartGameLoop() # This function runs over and over again. StartGameLoop() : void = loop: # Wait for one second. Sleep(1.0) # Check each target. # shooting_range_target_device exposes Enable/Disable but not GetHealth. # We use the TargetDefeatedEvent to react when a dummy is hit, # then call Enable() to bring it back. Here we simply Enable() # every dummy each second so any defeated dummy is restored. # note: shooting_range_target_device.Enable() re-enables a defeated dummy. for (Target : Targets): Target.Enable()