# RPF RealityPlayerFunction

## Reality Player Context

`Reality Player Context` is an execution context used for player-related logic.

It provides direct access to the player involved in the current execution.

> Use this context when your logic needs to interact with a specific player.

***

## Overview

| Feature           | Description                                |
| ----------------- | ------------------------------------------ |
| Player Access     | Provides access to the player controller   |
| Execution Context | Extends execution context behavior         |
| Used by Functions | Commonly used in player-related functions  |
| Simple Setup      | Can be created and passed during execution |

***

## Properties

| Name           | Type              | Description                               |
| -------------- | ----------------- | ----------------------------------------- |
| Reality Player | Player Controller | The player associated with this execution |

***

## Usage

### Typical Use Cases

| Use Case                          | Description                               |
| --------------------------------- | ----------------------------------------- |
| Apply logic to a specific player  | Access the player controller directly     |
| Handle player events              | Use during spawn, death, or join events   |
| Modify player state               | Apply gameplay changes to the player      |
| Execute player-specific functions | Pass this context into a Reality Function |

***

### Example Workflow

| Step | Description                        |
| ---- | ---------------------------------- |
| 1    | Create or receive a Player Context |
| 2    | Access the Reality Player property |
| 3    | Use it inside a Reality Function   |
| 4    | Apply logic to that player         |

***

## Notes

| Topic            | Note                                               |
| ---------------- | -------------------------------------------------- |
| Context Type     | Extends Reality Execution Context                  |
| Player Reference | Uses Player Controller as main reference           |
| Optional Usage   | Only required when player-specific logic is needed |

***

## Reality Player Function

`Reality Player Function` is a specialized function designed for player-related execution.

It is a simplified version of `Reality Function` with predefined behavior:

* Always executes on the server
* Cannot change network execution mode

> Use this class when creating gameplay logic that targets players and must run on the server.

***

## Overview

| Feature           | Description                            |
| ----------------- | -------------------------------------- |
| Player-Focused    | Designed for player-specific logic     |
| Server Only       | Always executes on the server          |
| Simplified Setup  | No need to configure network execution |
| Inherits Function | Extends Reality Function               |

***

## Execution Rules

| Rule                  | Description                                            |
| --------------------- | ------------------------------------------------------ |
| Network Execution     | Always Server                                          |
| Editable Network Mode | Disabled                                               |
| Context Support       | Supports execution contexts (including Player Context) |

***

## Usage

### Typical Use Cases

| Use Case                    | Recommended Setup                       |
| --------------------------- | --------------------------------------- |
| Modify player stats         | Use Player Function with Player Context |
| Handle player death logic   | Execute from player event               |
| Apply server-side effects   | Use Player Function (server only)       |
| Assign rewards or penalties | Run logic targeting a player            |
| Handle respawn logic        | Use Player Context to access the player |

***

### Workflow

| Step | Description                                         |
| ---- | --------------------------------------------------- |
| 1    | Create a Blueprint based on Reality Player Function |
| 2    | Implement Execute                                   |
| 3    | Use Player Context to access the player             |
| 4    | Add the function to a phase or event system         |

***

## Best Practices

| Recommendation          | Description                                            |
| ----------------------- | ------------------------------------------------------ |
| Use Player Context      | Always access the player through context               |
| Keep logic server-side  | This class is designed for authoritative logic         |
| Avoid client-only logic | Use standard Reality Function for client-side behavior |
| Keep functions modular  | One function = one responsibility                      |

***

## Notes

| Topic                 | Note                                         |
| --------------------- | -------------------------------------------- |
| Server Authority      | Ensures gameplay consistency                 |
| Simplified Usage      | No need to manage network execution manually |
| Designed for Gameplay | Ideal for player state changes               |

***

## Related Pages

| Page                      | Description                                |
| ------------------------- | ------------------------------------------ |
| Reality Function          | Base execution class                       |
| Reality Context           | Base context system                        |
| Reality Execution Context | Execution result handling                  |
| Reality Game Phase        | Can execute player functions               |
| Reality Team              | Can be used with team-related player logic |

***

## Summary

| Item                    | Description                                            |
| ----------------------- | ------------------------------------------------------ |
| Reality Player Context  | Provides access to a specific player during execution  |
| Reality Player Function | Server-only function for player-related gameplay logic |
| Main Use                | Player-specific actions and gameplay logic             |
| Network Behavior        | Always server-side                                     |


---

# 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/rpf-realityplayerfunction.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.
