using /Fortnite.com/Devices using /Engine/Systems using /Fortnite.com/Devices/DLauncher using /Fortnite.com/Devices/ItemGranter # This is our main script. It's like the brain of our trap. LaunchPadTrap = script: # VARIABLES: These are our sticky notes. # 'launched_player' is a variable that holds a reference to a player. # We start with 'None' because no one has been launched yet. launched_player := None # This function runs when the game starts. OnBegin(): void = print("Launch Pad is ready!") # This function is called when a player touches the D-Launcher. # 'player' is the person who touched it. OnPlayerEntered(player: Player): void = # Check if a player is already being launched. # If 'launched_player' is not None, someone is already in the air. if (launched_player != None): print("Someone is already in the air! Wait for them to land.") return # Set the sticky note: This player is now 'launched_player'. launched_player = player # Find the D-Launcher device in our scene. # We assume the launcher is named "MyDLauncher" in the editor. launcher := GetDevice("MyDLauncher") as DLauncherDevice if (launcher != None): # Launch the player! # 'Launch' is a function that takes the player and pushes them. launcher.Launch(player) print("Player launched!") # This function runs when the player lands (or stops moving). # We use a timer to check when they land. OnTimer(timer: Timer): void = # If we have a player stored in our variable... if (launched_player != None): # Check if the player is still in the air (simplified check) # In a real game, you'd check velocity or height. # For now, let's assume they land after 3 seconds. Wait(3.0) # Wait 3 seconds # Now, give them loot! # Find the Item Granter device named "MyItemGranter" granter := GetDevice("MyItemGranter") as ItemGranterDevice if (granter != None): # Grant a weapon (e.g., an Assault Rifle) granter.Grant(launched_player, "AssaultRifle") print("Player got a gun!") # Reset the sticky note so we can launch someone else. launched_player = None # This function sets up the timer loop. OnBegin(): void = # Create a timer that checks every 0.5 seconds. timer := CreateTimer(0.5) # Start the loop. while (true): Wait(0.5) # We could add more logic here, like checking if the player is grounded. # For simplicity, we rely on the OnPlayerEntered logic above.