# Base RPF Function

## Reality Player Functions

`Reality Player Functions` are ready-to-use player actions built on top of the Reality execution system.

They are designed to work with:

* `Reality Player Context`
* `Reality Player Function`
* player-related gameplay events
* game phases and execution containers

These functions make it easy to trigger common gameplay actions such as:

* spawning a player,
* forcing spectate,
* killing a player,
* assigning character data,
* assigning character skins,
* assigning teams,
* updating player stats.

> Use these functions when you want reusable player gameplay actions in Blueprint.

***

## Overview

| Feature         | Description                                          |
| --------------- | ---------------------------------------------------- |
| Player Actions  | Execute common gameplay actions on a player          |
| Context Based   | Works with `Reality Player Context`                  |
| Server Oriented | Built for authoritative player logic                 |
| Reusable        | Can be plugged into phases and gameplay events       |
| Ready To Use    | Includes built-in functions for common gameplay flow |

***

## Reality Target Character Data

This enum defines where character data or skin data should be selected from.

### Available Values

| Name                 | Description                                              |
| -------------------- | -------------------------------------------------------- |
| From Data Collection | Selects from the GameMode Settings collection            |
| From Team Definition | Selects from the player's assigned team definition       |
| Direct               | Selects from the array provided directly on the function |

***

## Character Data Source Rules

| Source               | Description                                                                 |
| -------------------- | --------------------------------------------------------------------------- |
| From Data Collection | Uses the character or skin collection from `Reality GameMode Settings Data` |
| From Team Definition | Uses the character or skin list from the player's assigned team definition  |
| Direct               | Uses the list configured directly in the function instance                  |

***

## Reality GameMode Player Function Library

This library provides Blueprint-callable helper actions for player-related gameplay.

### Functions

| Name                                        | Type     | Description                              | Inputs                                             | Outputs |
| ------------------------------------------- | -------- | ---------------------------------------- | -------------------------------------------------- | ------- |
| RealityGame Set Player To Spectating        | Callable | Sets a player to spectator mode          | Player                                             | —       |
| RealityGame Spawn Player                    | Callable | Spawns or respawns a player              | Player, Spawn Type, Start Point Type, As Spectator | —       |
| RealityGame Kill Player                     | Callable | Kills a player                           | Player                                             | —       |
| RealityGame Set Pending Respawn             | Callable | Adds a delayed respawn to a player       | Player, Respawn Delay                              | —       |
| RealityGame Assign Character Data To Player | Callable | Assigns character data to a player       | Player, Data Type, Character Data Array            | —       |
| RealityGame Assign Character Skin To Player | Callable | Assigns a character skin to a player     | Player, Data Type, Character Skin Array            | —       |
| RealityGame Auto Assign Team To Player      | Callable | Automatically assigns a team to a player | Player                                             | —       |

***

## Built-In Reality Player Functions

These are ready-to-use `Reality Player Function` classes built for common player actions.

***

## Spectating

### Set Spectating

| Name           | Type            | Description                              | Context Required |
| -------------- | --------------- | ---------------------------------------- | ---------------- |
| Set Spectating | Player Function | Sets the target player to spectator mode | Player Context   |

***

## Spawn

### Spawn

| Name  | Type            | Description                          | Context Required |
| ----- | --------------- | ------------------------------------ | ---------------- |
| Spawn | Player Function | Spawns or respawns the target player | Player Context   |

### Properties

| Name             | Type    | Description                                             |
| ---------------- | ------- | ------------------------------------------------------- |
| Spawn Type       | Enum    | Defines how the spawn location is selected              |
| Start Point Type | Enum    | Defines which type of start point can be used           |
| As Spectator     | Boolean | Spawns the player as spectator instead of normal player |

***

## Kill

### Kill

| Name | Type            | Description             | Context Required |
| ---- | --------------- | ----------------------- | ---------------- |
| Kill | Player Function | Kills the target player | Player Context   |

***

## Respawn

### Pending Respawn

| Name            | Type            | Description                               | Context Required |
| --------------- | --------------- | ----------------------------------------- | ---------------- |
| Pending Respawn | Player Function | Adds a respawn delay to the target player | Player Context   |

### Properties

| Name          | Type  | Description                         |
| ------------- | ----- | ----------------------------------- |
| Respawn Delay | Float | Delay before the player can respawn |

***

## Character Assignment

### Assigned Character Data

| Name                    | Type            | Description                                 | Context Required |
| ----------------------- | --------------- | ------------------------------------------- | ---------------- |
| Assigned Character Data | Player Function | Assigns character data to the target player | Player Context   |

### Properties

| Name           | Type  | Description                                                       |
| -------------- | ----- | ----------------------------------------------------------------- |
| Data Type      | Enum  | Defines where the character data is selected from                 |
| Character Data | Array | Direct character data list used if `Data Type` is set to `Direct` |

***

### Assigned Character Skin

| Name                    | Type            | Description                                   | Context Required |
| ----------------------- | --------------- | --------------------------------------------- | ---------------- |
| Assigned Character Skin | Player Function | Assigns a character skin to the target player | Player Context   |

### Properties

| Name           | Type  | Description                                             |
| -------------- | ----- | ------------------------------------------------------- |
| Data Type      | Enum  | Defines where the character skin is selected from       |
| Character Skin | Array | Direct skin list used if `Data Type` is set to `Direct` |

***

## Team Assignment

### Auto Assign Team To Player

| Name                       | Type            | Description                                       | Context Required |
| -------------------------- | --------------- | ------------------------------------------------- | ---------------- |
| Auto Assign Team To Player | Player Function | Automatically assigns a team to the target player | Player Context   |

***

## Player Stats

### Add Kill Stat

| Name          | Type            | Description                         | Context Required |
| ------------- | --------------- | ----------------------------------- | ---------------- |
| Add Kill Stat | Player Function | Adds one kill to the player's stats | Player Context   |

***

### Add Death Stat

| Name           | Type            | Description                          | Context Required |
| -------------- | --------------- | ------------------------------------ | ---------------- |
| Add Death Stat | Player Function | Adds one death to the player's stats | Player Context   |

***

### Reset KDA

| Name      | Type            | Description                    | Context Required |
| --------- | --------------- | ------------------------------ | ---------------- |
| Reset KDA | Player Function | Resets the player's KDA values | Player Context   |

***

## Common Blueprint Workflows

### Respawn Flow

| Step | Action                   |
| ---- | ------------------------ |
| 1    | Kill player              |
| 2    | Add Pending Respawn      |
| 3    | Spawn player after delay |

***

### Team-Based Character Assignment

| Step | Action                                                  |
| ---- | ------------------------------------------------------- |
| 1    | Assign or auto-assign the player's team                 |
| 2    | Use Assigned Character Data with `From Team Definition` |
| 3    | Use Assigned Character Skin with `From Team Definition` |
| 4    | Spawn player                                            |

***

### Spectator Flow

| Step | Action                                     |
| ---- | ------------------------------------------ |
| 1    | Set player to spectating                   |
| 2    | Wait for respawn request or game condition |
| 3    | Spawn back as player or spectator          |

***

## Typical Use Cases

| Use Case                            | Recommended Function                                |
| ----------------------------------- | --------------------------------------------------- |
| Force a player into spectator mode  | Set Spectating                                      |
| Respawn a player                    | Spawn                                               |
| Kill a player immediately           | Kill                                                |
| Add a delayed respawn               | Pending Respawn                                     |
| Assign a random class from settings | Assigned Character Data with `From Data Collection` |
| Assign a team-specific class        | Assigned Character Data with `From Team Definition` |
| Assign a direct list of skins       | Assigned Character Skin with `Direct`               |
| Auto-balance teams                  | Auto Assign Team To Player                          |
| Update scoreboard stats             | Add Kill Stat / Add Death Stat                      |
| Reset player round stats            | Reset KDA                                           |

***

## Best Practices

| Recommendation                                    | Description                                                        |
| ------------------------------------------------- | ------------------------------------------------------------------ |
| Use Player Context                                | These functions are designed to run with a target player           |
| Assign team before team-based character selection | `From Team Definition` depends on the player already having a team |
| Use Data Collection for global loadouts           | Good for shared character pools                                    |
| Use Direct mode for custom one-off logic          | Useful for event-specific or phase-specific assignments            |
| Use built-in functions for common gameplay flow   | Keeps your Blueprint logic cleaner and reusable                    |

***

## Notes

| Topic            | Note                                                                            |
| ---------------- | ------------------------------------------------------------------------------- |
| Execution Type   | These functions are intended for player-related execution                       |
| Server Logic     | Best suited for authoritative gameplay actions                                  |
| Random Selection | Character data and skins are selected randomly from the chosen source           |
| Team Dependency  | Team-based selection requires the player to already be assigned to a valid team |

***

## Related Pages

| Page                           | Description                                                |
| ------------------------------ | ---------------------------------------------------------- |
| Reality Player Context         | Context used to target a specific player                   |
| Reality Player Function        | Base class for player-specific functions                   |
| Reality GameMode               | Handles spawning, killing, spectating, and team assignment |
| Reality GameMode Settings Data | Provides character and skin collections                    |
| Reality Team Definition        | Can provide team-based character and skin selection        |

***

## Summary

| Item                     | Description                                                                 |
| ------------------------ | --------------------------------------------------------------------------- |
| What it is               | Built-in reusable player gameplay functions                                 |
| Used with                | Player Context and Player Function                                          |
| Main actions             | Spawn, kill, spectate, respawn, assign team, assign character, update stats |
| Character source options | Data Collection, Team Definition, or Direct                                 |


---

# 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/reality-function/base-rpf-function.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.
