using { /Fortnite.com/Devices } using { /Fortnite.com/Teams } using { /Fortnite.com/Players } # This is our main script class. Think of it as the "Brain" for our tiles. # We inherit from creative_device, which means we can control devices. class TileWarScript is creative_device() # VARIABLES (The State) # These are the "scores" of our game. # We create a list to hold our three tiles. # In Verse, a list is like a squad roster. var tiles := [ Tile1, # Reference the device named 'Tile1' in the editor Tile2, # Reference 'Tile2' Tile3 # Reference 'Tile3' ] # This variable tracks who owns the tile. # Team: Neutral means no one owns it yet. # Team: Red or Blue means a team has claimed it. var current_owner := Team.Neutral # EVENT: OnBegin # This runs ONCE when the match starts. # Like the bus flying over the island—only happens at the start. event OnBegin() # Let's make sure all tiles start neutral (gray/white) # We loop through our list of tiles. for tile in tiles # Set the tile's team to Neutral # This is like resetting the storm to no damage tile.SetTeam(Team.Neutral) # EVENT: OnInteract # This runs EVERY TIME a player steps on the tile. # This is the "Elimination" moment for the tile. event OnInteract(player: player, device: creative_device) # 1. Check if the player is actually a player (not a prop) # 2. Get the player's team player_team := player.GetTeam() # 3. Update our "Ownership" variable current_owner := player_team # 4. Change the tile's color to match the player's team # This is the visual feedback. Like healing yourself, the tile heals to your color. device.SetTeam(player_team) # 5. Announce the takeover in chat # We use the global chat system ChatMessage := $"{player.GetPlayerName()} just stole the tile for Team {player_team}!" SendChatMessage(ChatMessage)