Verse Library verse

01 Fragment

Manages team flag carriers, base positions, and ownership logic for Capture The Flag matches.

verse-library/capture-the-flag-2-create-the-island-in-unreal-editor-for-fortnite/01-fragment.verse

# CtfLogic.verse
# This script manages the state of the Capture the Flag game.

# IMPORT: We need access to standard Verse tools for logging and basic structures.
using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/SpatialMath }

# DEFINE: Our Game State Variables
# Think of these as your scoreboard and inventory.
# 'flag_carrier' tracks which team currently holds the flag.
# 'home_base' tracks where the flag should respawn for a specific team.
var flag_carrier := Team::NoTeam
var blue_base_position := Vector{X:0, Y:0, Z:0}
var red_base_position := Vector{X:0, Y:0, Z:0}

# DEFINE: The Main Game Logic Module
# This is the "brain" of our island.
module CtfGameLogic
    # INIT: Called once when the game starts (like the bus flying over the map).
    init: func {
        # Set initial positions (In a real build, you'd link these to actual devices)
        # For this demo, we assume these are set via the editor properties.
        flag_carrier = Team::NoTeam
        Print("Game Started! Flags are at home bases.")
    }

    # EVENT: OnFlagPickedUp
    # This function is called when a player touches the flag.
    # 'player' is the person who touched it. 'flag_team' is the team that owns the flag.
    OnFlagPickedUp: func(player: Player, flag_team: Team) -> Unit {

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in