# Team Instance

## Reality Team

`Reality Team` is the runtime team instance used during gameplay.

Teams are identified by a **Team Index**, and during the game an actual **Team Instance** object is created for each active team.\
This object is responsible for:

* storing team players,
* tracking team score,
* reacting to player death and spawn,
* handling team limits,
* managing feature objects and additional objects.

> Use `Reality Team` when you need to interact with a team during gameplay.

***

## Overview

| Feature                 | Description                                               |
| ----------------------- | --------------------------------------------------------- |
| Team Identity           | Each team instance is linked to a Team Index              |
| Player Tracking         | Stores and manages players currently assigned to the team |
| Score System            | Handles team score updates and score events               |
| Spawn & Death Reactions | Reacts when team players spawn or die                     |
| Team Elimination        | Detects when all players in the team are dead             |
| Player Limit            | Supports max player count per team                        |
| Feature Objects         | Can store team-related feature objects                    |
| Additional Objects      | Can register extra network objects related to the team    |

***

## Team Identity

### Functions

| Name                | Type     | Description                                           | Inputs | Outputs         |
| ------------------- | -------- | ----------------------------------------------------- | ------ | --------------- |
| Get Team Index      | Callable | Returns the Team Index assigned to this team instance | —      | Team Index      |
| Get Team Definition | Callable | Returns the Team Definition associated with this team | —      | Team Definition |

***

## Team Lifecycle

These events are used when the team instance is initialized or shut down.

### Events

| Name                  | Type  | Description                                    | Inputs |
| --------------------- | ----- | ---------------------------------------------- | ------ |
| On Team Instance Init | Event | Called when the team instance is initialized   | —      |
| On Team Instance End  | Event | Called when the team instance is deinitialized | —      |

***

## Player Management

### Player Access

| Name             | Type     | Description                                         | Inputs    | Outputs            |
| ---------------- | -------- | --------------------------------------------------- | --------- | ------------------ |
| Get Players      | Callable | Returns all players currently assigned to this team | —         | Player State Array |
| Has Player       | Callable | Checks if a character belongs to this team          | Character | Boolean            |
| Get Player Count | Callable | Returns the current number of players in the team   | —         | Integer            |

***

### Events

| Name                   | Type             | Description                             | Inputs             |
| ---------------------- | ---------------- | --------------------------------------- | ------------------ |
| On Join Player In Team | Event Dispatcher | Triggered when a player joins the team  | Team, Player State |
| On Exit Player In Team | Event Dispatcher | Triggered when a player leaves the team | Team, Player State |

***

## Team Spawn & Death Events

### Spawn Events

| Name                         | Type             | Description                                   | Inputs                               |
| ---------------------------- | ---------------- | --------------------------------------------- | ------------------------------------ |
| On Player Of Team Is Spawned | Event            | Called when a player from this team spawns    | Player State, Player Character       |
| On Player Spawned            | Event Dispatcher | Triggered when a player from this team spawns | Team, Player State, Player Character |

***

### Death Events

| Name                           | Type             | Description                                     | Inputs       |
| ------------------------------ | ---------------- | ----------------------------------------------- | ------------ |
| On Player Of Team Is Die       | Event            | Called when a player from this team dies        | Player State |
| On All Player Is Death         | Event            | Called when all players in the team are dead    | —            |
| On All Player In Team Is Death | Event Dispatcher | Triggered when all players in the team are dead | Team         |

***

### Functions

| Name      | Type     | Description                                       | Inputs | Outputs |
| --------- | -------- | ------------------------------------------------- | ------ | ------- |
| Kill Team | Callable | Kills all players currently assigned to this team | —      | —       |

***

## Score System

### Functions

| Name         | Type     | Description                           | Inputs          | Outputs |
| ------------ | -------- | ------------------------------------- | --------------- | ------- |
| Set Score    | Callable | Sets the current score of the team    | Value           | —       |
| Add Score    | Callable | Adds score to the team                | Score To Add    | —       |
| Remove Score | Callable | Removes score from the team           | Score To Remove | —       |
| Reset Score  | Event    | Resets the score of the team          | —               | —       |
| Get Score    | Callable | Returns the current score of the team | —               | Float   |
| On Score Set | Event    | Called when a new score is set        | New Value       | Float   |

***

### Event Dispatchers

| Name                 | Description                           | Outputs                    |
| -------------------- | ------------------------------------- | -------------------------- |
| On Team Score Change | Triggered when the team score changes | Team, Old Score, New Score |

***

## Player Limit

### Functions

| Name                        | Type     | Description                                        | Inputs  | Outputs |
| --------------------------- | -------- | -------------------------------------------------- | ------- | ------- |
| Override Max Player In Team | Callable | Overrides the maximum allowed players in this team | New Max | —       |
| Get Max Player In Team      | Callable | Returns the max allowed players in this team       | —       | Integer |
| Get Team Have Player Limit  | Callable | Returns whether the team has a player limit        | —       | Boolean |

### Event Dispatchers

| Name                 | Description                                 | Outputs                    |
| -------------------- | ------------------------------------------- | -------------------------- |
| On Max Player Change | Triggered when the max player limit changes | Team, Old Value, New Value |

***

## Additional Objects

A team can store extra objects related to its runtime state.

### Functions

| Name                     | Type     | Description                                    | Inputs     | Outputs |
| ------------------------ | -------- | ---------------------------------------------- | ---------- | ------- |
| Add Additional Object    | Callable | Adds an extra object to this team              | Net Object | —       |
| Remove Additional Object | Callable | Removes an extra object from this team         | Net Object | —       |
| Clear Additional Object  | Callable | Clears all extra objects attached to this team | —          | —       |

***

## Feature Objects

Feature Objects are team-specific runtime objects attached to the team.

### Functions

| Name                      | Type     | Description                                         | Inputs        | Outputs        |
| ------------------------- | -------- | --------------------------------------------------- | ------------- | -------------- |
| Get Feature Object Exists | Callable | Checks whether a feature object exists on this team | Feature Class | Boolean        |
| Get Feature Object        | Callable | Returns a feature object from this team             | Feature Class | Feature Object |

### Event Dispatchers

| Name                      | Description                                         |
| ------------------------- | --------------------------------------------------- |
| On Feature Object Updated | Triggered when the team feature object list changes |

***

## Registry

### Properties

| Name             | Type               | Description                                                       |
| ---------------- | ------------------ | ----------------------------------------------------------------- |
| Generic Registry | Registry Container | Server-side generic registry for storing custom runtime team data |

> This registry can be used to store team-related runtime information.

***

## Blueprint Events Summary

| Name                         | Description                                  |
| ---------------------------- | -------------------------------------------- |
| On Team Instance Init        | Called when the team is initialized          |
| On Team Instance End         | Called when the team is deinitialized        |
| On Player Of Team Is Die     | Called when one player in the team dies      |
| On All Player Is Death       | Called when all players in the team are dead |
| On Player Of Team Is Spawned | Called when one player in the team spawns    |
| On Score Set                 | Called when a new score is set               |
| Reset Score                  | Resets the team score                        |

***

## Event Dispatchers Summary

| Name                           | Description                                |
| ------------------------------ | ------------------------------------------ |
| On Join Player In Team         | Triggered when a player joins the team     |
| On Exit Player In Team         | Triggered when a player leaves the team    |
| On Team Score Change           | Triggered when team score changes          |
| On Max Player Change           | Triggered when max player count changes    |
| On All Player In Team Is Death | Triggered when the whole team is dead      |
| On Player Spawned              | Triggered when a team player spawns        |
| On Feature Object Updated      | Triggered when feature objects are updated |

***

## Typical Use Cases

| Use Case                              | Recommended Nodes                                       |
| ------------------------------------- | ------------------------------------------------------- |
| Get all players in a team             | Get Players, Get Player Count                           |
| Check if a player belongs to a team   | Has Player                                              |
| Update score during gameplay          | Set Score, Add Score, Remove Score, Reset Score         |
| React to player deaths inside a team  | On Player Of Team Is Die, On All Player Is Death        |
| Detect full team elimination          | On All Player In Team Is Death                          |
| Limit the number of players in a team | Override Max Player In Team, Get Team Have Player Limit |
| Attach extra team-specific objects    | Add Additional Object, Remove Additional Object         |
| Use modular team features             | Get Feature Object Exists, Get Feature Object           |

***

## Notes

| Topic            | Note                                                                      |
| ---------------- | ------------------------------------------------------------------------- |
| Team Index       | Each team instance is linked to a Team Index                              |
| Runtime Instance | This object represents the active in-game version of a team               |
| Team Definition  | A team can reference a Team Definition, but that is documented separately |
| Main Usage       | Use this object whenever you need to interact with a team during gameplay |

***

## Related Pages

| Page                    | Description                                            |
| ----------------------- | ------------------------------------------------------ |
| Reality GameMode        | Main GameMode used to create and manage team instances |
| Reality GameMode Base   | Base gameplay flow and player lifecycle systems        |
| Reality Team Definition | Data used to configure team behavior                   |
| Reality Game Phase      | Phase object used for phase-based progression          |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://beyond-sandbox.gitbook.io/realitysdk/documentation/gamemode/teams-system/team-instance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
