# Random Team

**URL:** <https://forums.unrealengine.com/t/random-team/2471425>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [April 23, 2025, 10:29am UTC](https://forums.unrealengine.com/t/random-team/2471425 "2025-04-23T10:29:03Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![OMkrouger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OMkrouger](https://forums.unrealengine.com/u/OMkrouger)\
**Post date:** [April 23, 2025, 10:29am UTC](https://forums.unrealengine.com/t/random-team/2471425/1 "2025-04-23T10:29:03Z")

</div>

People spawn on team 5  
People can select teams 1-4 with mutators (Max size is 4) (mutators disable after player counter reaches 4)  
When a timer ends →   
Put them in team 1, 2, 3 or 4  
BUT  
if a team is full, DO NOT PUT THEM THERE  
if a team has members, DO NOT PUT THEM THERE, put them in a team that has no members  
if all team has members, put them in a team that is not full

---

<div class="post-metadata">

**Author:** ![BRGJuanCruzMK](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/brgjuancruzmk/32/1036548_2.png) [@BRGJuanCruzMK](https://forums.unrealengine.com/u/BRGJuanCruzMK)\
**Post date:** [April 24, 2025, 1:37pm UTC](https://forums.unrealengine.com/t/random-team/2471425/2 "2025-04-24T13:37:01Z")

</div>

Hey OM krouger! how is it going?

Let me see if I understood your issue! You already did the part of the mutators and the timer with random assignment of teams, right?

What you need is to know how to balance the teams under the conditions you listed, is that correct?

To help you, first I need to know if you are using Creative or UEFN!

I’ll be waiting for your answer!

---

<div class="post-metadata">

**Author:** ![OMkrouger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OMkrouger](https://forums.unrealengine.com/u/OMkrouger)\
**Post date:** [April 24, 2025, 8:27pm UTC](https://forums.unrealengine.com/t/random-team/2471425/3 "2025-04-24T20:27:27Z")

</div>

Hello! I’ve written a verse code for it, now the part i need is working fine.

However, i need help with ending the game when only one team has alive players,  
meaning when theres 1 team left

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [April 24, 2025, 9:29pm UTC](https://forums.unrealengine.com/t/random-team/2471425/4 "2025-04-24T21:29:46Z")

</div>

The most simple way you could go about doing it is saving a number of how many teams are alive and update it by checking all player’s `fort_character.IsActive[]` and then when a team is empty subtract 1 from the teams alive and trigger a game end when there are less than or equal to 1 teams alive.  
Also you could try doing this with different ways like checking the agents inside a mutator zone

---

<div class="post-metadata">

**Author:** ![OMkrouger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OMkrouger](https://forums.unrealengine.com/u/OMkrouger)\
**Post date:** [April 24, 2025, 10:59pm UTC](https://forums.unrealengine.com/t/random-team/2471425/5 "2025-04-24T22:59:41Z")

</div>

Can you help me write a function for that?  
I’d really apprecaite it

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [April 24, 2025, 11:15pm UTC](https://forums.unrealengine.com/t/random-team/2471425/6 "2025-04-24T23:15:16Z")

</div>

```auto
    CheckIfFinished()<transacts>:logic=
        TeamColl:=GetPlayspace().GetTeamCollection()
        var TeamsAlive:int=0
        for(Team:TeamColl.GetTeams()):
            var IsTeamAlive:logic=false
            for(TeamMember:TeamColl.GetAgents[Team]):
                if(TeamMember.GetFortCharacter[].IsActive[]):
                    set IsTeamAlive=true
            if(IsTeamAlive?). set TeamsAlive=TeamsAlive+1
                    
        if(TeamsAlive<=1). return true
        else. return false

```

---

<div class="post-metadata">

**Author:** ![OMkrouger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OMkrouger](https://forums.unrealengine.com/u/OMkrouger)\
**Post date:** [April 25, 2025, 12:02pm UTC](https://forums.unrealengine.com/t/random-team/2471425/7 "2025-04-25T12:02:37Z")

</div>

so this function checks if there is an alive member in the team?  
which team does it check?

How should i call the function so it listens to whenever teams alive is 1 or less

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [April 25, 2025, 1:02pm UTC](https://forums.unrealengine.com/t/random-team/2471425/8 "2025-04-25T13:02:36Z")

</div>

It checks for all the teams that are in the game and if it finds only 1 team with an active fort\_charactet it returns true

---

<div class="post-metadata">

**Author:** ![OMkrouger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OMkrouger](https://forums.unrealengine.com/u/OMkrouger)\
**Post date:** [April 25, 2025, 1:14pm UTC](https://forums.unrealengine.com/t/random-team/2471425/9 "2025-04-25T13:14:31Z")

</div>

do i need to call the function every time i want to check?  
if i want it to check continously until it returns true, how can i put it in a loop?

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [April 25, 2025, 1:18pm UTC](https://forums.unrealengine.com/t/random-team/2471425/10 "2025-04-25T13:18:05Z")

</div>

loop:  
Sleep(1.0)  
If(CheckIfFinished()?):  
TeamSettings.EndRound()

---

<div class="post-metadata">

**Author:** ![OMkrouger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OMkrouger](https://forums.unrealengine.com/u/OMkrouger)\
**Post date:** [April 25, 2025, 1:21pm UTC](https://forums.unrealengine.com/t/random-team/2471425/11 "2025-04-25T13:21:03Z")

</div>

Does if(CheckIfFinished()?): means if the function returns true?

and i put the loop into OnBegin?

Also, which team’s TeamSettings & Inventory Device I call to end round?

Can you help me put this function together, where i have 4 teams, and end the round when 1 team is left?

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [April 25, 2025, 1:33pm UTC](https://forums.unrealengine.com/t/random-team/2471425/12 "2025-04-25T13:33:51Z")

</div>

I have a team settings device that’s for all teams
