SetPlayerIdentity: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Document Protocol 23 voice and player presentation APIs
 
Document 0.1a Lua API, identities, moderation and synchronized spells
Line 1: Line 1:
<!-- This page is generated automatically from the function definition: setPlayerIdentity. -->
= setPlayerIdentity =
= setPlayerIdentity =
Atomically changes a player's complete recognizable appearance without changing armor.
Atomically changes a player's complete recognizable appearance without changing armor.
Line 30: Line 29:
== Notes ==
== Notes ==
* Available only in server-side resource scripts.
* Available only in server-side resource scripts.
* This is the recommended appearance setter for normal resources.
* In G1R:MP 0.1 this is the only supported setter for a complete player identity. The test command <code>/identity &lt;key&gt;</code> uses this API.
* The face profile and identity surface/hair layer are committed in one authoritative update, so clients never observe a half-applied identity.
* The face profile and identity surface/hair layer are committed in one authoritative update, so clients never observe a half-applied identity.
* Equipped armor remains controlled exclusively by <code>setPlayerArmor</code>.
* Equipped armor remains controlled by <code>setPlayerArmor</code>; selecting an identity does not equip armor.
* Some identity profiles still have compatibility issues with specific armor assets. Test intended identity and armor combinations before deployment.
* Gothic Remake character models and variants are authored with different armor support. Not every identity/armor combination exists or renders correctly, so test every combination used by a resource.
* The reliable state is replayed during relevance entry and late join.
* The reliable state is replayed during relevance entry and late join.
* Accepted changes emit the existing <code>onPlayerFaceChange</code>, <code>onPlayerBodyChange</code> and <code>onPlayerHeadChange</code> events for compatibility.
* Accepted changes emit the existing compatibility events for the layers that changed: <code>onPlayerFaceChange</code> and <code>onPlayerBodyChange</code> for the face/body layer, and <code>onPlayerHeadChange</code> for the head layer.


[[Category:Lua Functions]]
[[Category:Lua Functions]]

Revision as of 11:36, 27 August 2026

setPlayerIdentity

Atomically changes a player's complete recognizable appearance without changing armor.

Syntax

bool setPlayerIdentity(int playerId, string identityKey)

Parameters

Name Type Required Description
playerId int yes The connected player identifier.
identityKey string yes A stable key returned by getPlayerIdentityNames.

Returns

Returns true when the validated identity is accepted and replicated; otherwise returns false.

Examples

Apply Milten's armor-free identity:

if not setPlayerIdentity(playerId, "milten") then
    outputChatBox("The identity could not be applied.", playerId)
end

Notes

  • Available only in server-side resource scripts.
  • In G1R:MP 0.1 this is the only supported setter for a complete player identity. The test command /identity <key> uses this API.
  • The face profile and identity surface/hair layer are committed in one authoritative update, so clients never observe a half-applied identity.
  • Equipped armor remains controlled by setPlayerArmor; selecting an identity does not equip armor.
  • Gothic Remake character models and variants are authored with different armor support. Not every identity/armor combination exists or renders correctly, so test every combination used by a resource.
  • The reliable state is replayed during relevance entry and late join.
  • Accepted changes emit the existing compatibility events for the layers that changed: onPlayerFaceChange and onPlayerBodyChange for the face/body layer, and onPlayerHeadChange for the head layer.