Verse Library verse

04 Setting Up Teams

Calculates hunter count, shuffles players, and splits them into starting roles for a prop hunt round.

extracted-snippets/documentation/en-us/fortnite/prop-hunt-05-game-loop-and-round-management-in-unreal-editor-for-fortnite/04-setting-up-teams.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/prop-hunt-05-game-loop-and-round-management-in-unreal-editor-for-fortnite
# Local doc:  epic-docs/documentation/en-us/fortnite/prop-hunt-05-game-loop-and-round-management-in-unreal-editor-for-fortnite.md
# Section:    Setting Up Teams
# Calculate the number of starting hunter agents for the game based on the player count and the number of hunter agents per number of players.
NumberOfPlayers:float = 1.0 * Players.Length # Converts Players.Length to a float so it can be used in the next Ceil function.
if (NumberOfStartingHunters:int = Ceil[NumberOfPlayers / Max(1.1, HunterTeam.HunterAgentPerNumberOfPlayers)]):
# Shuffle the players and then slice the array to get the starting hunter agents. The remaining players are the starting prop agents.
var RandomizedPlayers:[]agent = Shuffle(Players)

Comments

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