# Import the necessary libraries for game logic using /Fortnite.com/Devices using /Engine/Systems/GameplayTagManager # Define our custom device type SniperLootDevice < CreativeDevice> is # The device itself Self: CreativeDevice # We need to know what Class is allowed. # In a real device, this might be a parameter you set in the editor. AllowedClass: GameplayTag = "Class.Sniper" # This function runs when a player interacts with the device OnInteract: (player: Player) -> void = # 1. Check the Phase # Get the current game phase current_phase := GetGamePhase(Self) # If the game isn't in "Gameplay" phase, stop. # Think of this as checking if the storm has started. if current_phase != GamePhase.Gameplay: return # Exit early. Player can't open it yet. # 2. Check the Team (Optional, but good practice) # Let's say only Team 1 can open it. player_team := GetPlayerTeam(player) if player_team != Team.One: return # Wrong team. Go away. # 3. Check the Class # Get the player's current class player_class := GetPlayerClass(player) # Compare the player's class to our allowed class # We use "==" to check for equality if player_class != AllowedClass: return # Wrong class. Not a sniper, no loot. # If we passed all checks, give the loot! GrantItem(player, "Item.AssaultRifle") PrintToPlayer(player, "Sniper approved. Here’s your loot.")