Party Player Actors
Last updated
Last updated
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.
The Example Content that is shipped with the plugin showcases how this feature works. The example blueprints also contain additional information.
Create a new blueprint from the KronosPartyPlayerActor
class.
By default the actor doesn't have a mesh, so I'm going to add a SkeletalMeshComponent
to it.
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 of the plugin. Then use the "Player Widget Draw Size" to set the canvas size for the widget.
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.
Now inside the "Details" panel simply select the "PartyPlayerActorClass" that should be spawned for players when they join the party.
Don't forget to go into Project Settings -> Kronos Matchmaking and set the "Party State Class" to your custom blueprint that you just created.
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.
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.
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 contained in the party player state, and party player actor should just "visualize" the state of these variables inside the party player state (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.