# Party Player Actors

The party system has the ability to spawn a `KronosPartyPlayerActor` for each party member in the party. This allows you to spawn a character for each player visually in the game world.

{% hint style="info" %}
The [**Example Content**](/kronos-matchmaking/examples/example-content.md) that is shipped with the plugin showcases how this feature works. The example blueprints also contain additional information.
{% endhint %}

## Creating The Player Actor

Create a new blueprint from the `KronosPartyPlayerActor` class.

<figure><img src="/files/qOoCLIapnEPWSztPY0gZ" alt=""><figcaption></figcaption></figure>

By default the actor doesn't have a mesh, so I'm going to add a `SkeletalMeshComponent` to it.

<figure><img src="/files/IeYMXYOhS4LpEJWRXczB" alt=""><figcaption></figcaption></figure>

The `KronosPartyPlayerActor` class has a built-in feature that renders a widget above the character. Inside the "Details" panel simply select the "Player Widget Class" that should be rendered above the actor. I'm going to use the example party player widget from the [**Example Content**](/kronos-matchmaking/examples/example-content.md) of the plugin. Then use the "Player Widget Draw Size" to set the canvas size for the widget.

<figure><img src="/files/9OrlNBJbtrX5yGXmm16L" alt=""><figcaption></figcaption></figure>

## Spawning Player Actors

### 1. Selecting The Player Actor Class

The spawning of player actors are handled automatically by the `KronosPartyState` class. In order to select which `KronosPartyPlayerActor` class to use, you will first have to create a new blueprint from the `KronosPartyState` class.

<figure><img src="/files/2BPeb2Oor64Q2m8S6ctQ" alt=""><figcaption></figcaption></figure>

Now inside the "Details" panel simply select the "PartyPlayerActorClass" that should be spawned for players when they join the party.

<figure><img src="/files/BREEP0Eqb0pN9v2MtJkg" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Don't forget to go into **Project Settings -> Kronos Matchmaking** and set the "Party State Class" to your custom blueprint that you just created.
{% endhint %}

### 2. Define Player Actor Spawn Locations

To define where these player actors should be spawned, we need to place `KronosPartyPlayerStart` actors into the level. You can find this actor in the "Place Actors" tab on of the engine. The amount of player starts required is based on the party size.&#x20;

<figure><img src="/files/6Tl7GfTTGNjPAqlsWnQk" alt=""><figcaption></figcaption></figure>

After placing these into the level, one of them should be marked as the local player start. The local player's `KronosPartyPlayerActor` will be spawned on this player start.

<figure><img src="/files/km0GsGFtiLpm34jaXvyb" alt=""><figcaption></figcaption></figure>

## Updating Player Actors

You may want to update your player actors based on for example which character is selected by the player. In order to do this, there is one important thing to understand.

Party player actors are **not replicated**. They are always spawned locally. Each party player actor is tied to a player's `KronosPartyPlayerState`. The idea is that all replicated variables should be stored in the player state, and the player actor should just "visualize" the state of these variables (e.g. change skeletal mesh based on selected character id).

**From party player actor:** Use the `GetOwningPartyPlayerState` function to access the player state of the party client that this actor represents .

**From party player state:** Use the `GetPlayerActor` function to access the party player actor of this player state.


---

# 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://horizongames.gitbook.io/kronos-matchmaking/usage/party/party-player-actors.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.
