# What is the relationship between teams & devices?

**URL:** <https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955>\
**Category:** Verse\
**Tags:** team, unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [September 16, 2023, 4:14pm UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955 "2023-09-16T16:14:01Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheDadXI](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/thedadxi/32/768546_2.png) [@TheDadXI](https://forums.unrealengine.com/u/TheDadXI)\
**Post date:** [September 16, 2023, 4:14pm UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/1 "2023-09-16T16:14:01Z")

</div>

I have a custom class with 2 [team\_settings\_and\_inventory\_device] editables & then in the main device code I call GetPlayspace().GetTeamCollection() … How do I determine which item in the collection relates to my device?

Sample Code ( assign 1 player to first team & then ALL other players to second team)

```auto

    AssignTeams():void={
        #randomly select 1 player at the beginning 
        AllPlayers := GetPlayspace().GetPlayers()
        PlayerIndex := GetRandomInt(0,AllPlayers.Length-1)
        if(SelectedPlayer := AllPlayers[PlayerIndex]){
            #(move player to first team & apply the class)
            
        }

        var curIndex : int = 0
        Teams := GetPlayspace().GetTeamCollection()
        for(CustomPlayer : AllPlayers){
            if(curIndex <> PlayerIndex){
                #Move ALL other player to other Team
                
            }
            set curIndex += 1
        }
    }

```

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [September 16, 2023, 6:45pm UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/2 "2023-09-16T18:45:16Z")

</div>

So the `GetTeamCollection()` does not return a `team_settings_and_inventory_device` device, it’s a pure Verse class that allows you to access team related functions.

If you want a specific team (let’s say team 1), you’ll do :

```auto
if(TeamOne := GetPlayspace().GetTeamCollection().GetTeams()[0]):
    # TeamOne is a instance of the class 'team'

```

`TeamOne` can then be used in other functions that require any `team` type variable. I’m not sure what you’re trying to do exactly so I might need more intel on the best solution to provide here 🤷

---

<div class="post-metadata">

**Author:** ![TheDadXI](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/thedadxi/32/768546_2.png) [@TheDadXI](https://forums.unrealengine.com/u/TheDadXI)\
**Post date:** [September 16, 2023, 6:53pm UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/3 "2023-09-16T18:53:18Z")

</div>

As denoted in my sample code, I want to assign 1 random player to a specific team on game start… as said player eliminates others, they are then also moved to that team (an infection style game).

If the team\_settings\_and\_inventory\_device is not the route I should take then I am lost. I need to be able to know the team a player is on and then move said player to another team. I don’t think assuming team 1 (team index 0) is a good idea, but maybe that is how I should approach this.

Thoughts?

---

<div class="post-metadata">

**Author:** ![TheDadXI](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/thedadxi/32/768546_2.png) [@TheDadXI](https://forums.unrealengine.com/u/TheDadXI)\
**Post date:** [September 16, 2023, 6:55pm UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/4 "2023-09-16T18:55:00Z")

</div>

Additionally, I need to add custom code to events from `team_settings_and_inventory_device`

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [September 16, 2023, 6:56pm UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/5 "2023-09-16T18:56:17Z")

</div>

Sorry for not reading your comments properly, if you want to do an infection game, you could just use the following Island Settings ?  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/a/6/fa6b749cd8245759964a0273299e8b6b09f6fdad.png)

“Teams” / “Spawn Limit” / “After Last Spawn Go To”

Then in you Team settings and inventory for team 2, override the spawn limit and set it to 0? or 999?

---

<div class="post-metadata">

**Author:** ![TheDadXI](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/thedadxi/32/768546_2.png) [@TheDadXI](https://forums.unrealengine.com/u/TheDadXI)\
**Post date:** [September 16, 2023, 7:23pm UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/6 "2023-09-16T19:23:51Z")

</div>

Well, I really do need to read up on existing device functionality 😅

Even so, if those weren’t settings I had available, within Verse, how would I associate a Team object to a device? … or maybe that isn’t even a reasonable idea… I really don’t know yet. Regardless, thanks for the continued support. I’ll keep digging & learning.

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [September 16, 2023, 7:27pm UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/7 "2023-09-16T19:27:26Z")

</div>

So, I think I’d do :

```auto
@editable
TeamOneSettingsDevice : team_settings_and_inventory_device = team_settings_and_inventory_device {}

@editable
TeamTwoSettingsDevice : team_settings_and_inventory_device = team_settings_and_inventory_device {}

```

or maybe :

```auto
@editable
TeamsSettingsDevice : []team_settings_and_inventory_device = array{}

```

And then use the array index to compare to the player’s team index, but I’m not sure you’re looking for this answer either ?

---

<div class="post-metadata">

**Author:** ![TheDadXI](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/thedadxi/32/768546_2.png) [@TheDadXI](https://forums.unrealengine.com/u/TheDadXI)\
**Post date:** [September 16, 2023, 7:52pm UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/8 "2023-09-16T19:52:37Z")

</div>

Ok, I figured out how to force a team to use the indexes… but in verse, when a player respawns, I need to check their team and call specific code…

```auto
                #Check Team... use Infected Or Human 
                AllTeams := GetPlayspace().GetTeamCollection()
                if(AssignedTeam := AllTeams.GetTeam[Agent]){
                    #Infected Team is index 2 (or 1 if it is zero based ???)
                    *if player is on Infected team then custom code here.*
                }

```

---

<div class="post-metadata">

**Author:** ![TheDadXI](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/thedadxi/32/768546_2.png) [@TheDadXI](https://forums.unrealengine.com/u/TheDadXI)\
**Post date:** [September 16, 2023, 8:00pm UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/9 "2023-09-16T20:00:29Z")

</div>

I think I got it…

```auto
AllTeams := GetPlayspace().GetTeamCollection()
                if(AssignedTeam := AllTeams.GetTeam[Agent], 
                    TargetTeam := AllTeams.GetTeams()[1],
                    AssignedTeam = TargetTeam
                ){ custom code here }

```

Does that look legit?

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [September 16, 2023, 8:57pm UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/10 "2023-09-16T20:57:27Z")

</div>

This is exactly what you should do 👍

---

<div class="post-metadata">

**Author:** ![TheDadXI](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/thedadxi/32/768546_2.png) [@TheDadXI](https://forums.unrealengine.com/u/TheDadXI)\
**Post date:** [September 17, 2023, 5:59pm UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/11 "2023-09-17T17:59:40Z")

</div>

Ok, I am certainly progressing and I am trying to move forward… I have my code in a fresh project ( I was in a test project where I have a bunch of other test code ).

When my map starts, it is only finding 1 team when I call `GetPlayspace().GetTeamCollection().GetTeams().Length` even though I have 2 team designers created.

So, my previous code is no longer working as index 1 does not exist…

```auto
AllTeams := GetPlayspace().GetTeamCollection()
                if(AssignedTeam := AllTeams.GetTeam[Agent], 
                    TargetTeam := AllTeams.GetTeams()[1] <-- Fails

```

 ![Team Settings 20230917](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/1/6/61609d136c760aed0adf7702c3c7ff745351a1ca.jpeg)

Team 1 is default & Team 2 (red) is the team I am targeting in the above code.

What am I missing?

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [September 17, 2023, 9:12pm UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/12 "2023-09-17T21:12:15Z")

</div>

Even though you can define any team settings with the `team settings and inventory device`, the count of existing team is defined by your `IslandSettings`, by both those parameters :  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/9/d/19d1eac1b8cd013913443ffa234c83a491ebb85a.png)

In my exemple it’s FFA so I guess there’s like 100 available teams, but if you choose `Team Index`, you can choose the number of teams with the number on the right.

---

<div class="post-metadata">

**Author:** ![2GHSamburskoy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@2GHSamburskoy](https://forums.unrealengine.com/u/2GHSamburskoy)\
**Post date:** [September 23, 2023, 6:36am UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/13 "2023-09-23T06:36:32Z")

</div>

1. Get the team of the player who eliminating.
2. Transfer the player who eliminated  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/1/b/c1bac7dfe685a8b9a1e2d1216d89ea6bc98c5113.png)  
to the player’s team

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [October 23, 2023, 6:36am UTC](https://forums.unrealengine.com/t/what-is-the-relationship-between-teams-devices/1298955/14 "2023-10-23T06:36:35Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
