SetPlayerIdentity: Difference between revisions
Document Protocol 23 voice and player presentation APIs |
Release 0.1.9 / BUILD264 / Protocol42: availability and download setup; preserve experimental limits |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
= setPlayerIdentity = | = setPlayerIdentity = | ||
<div style="background:#fff5f5; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#111111; padding:0.85rem 1rem; margin:0.75rem 0 1rem;"> | |||
<div style="color:#111111; font-weight:bold; letter-spacing:0.04em;">IMPROVED FROM UPDATE 0.1.3</div> | |||
<div style="color:#111111; margin-top:0.25rem;">This function is available in earlier releases and has corrected or expanded behavior in G1R:MP 0.1.3 and later. The contract below describes the updated behavior.</div> | |||
</div> | |||
Selects a named identity while preserving equipped armor and independent cosmetic overrides. See [[Female identities]] for the expanded female body/outfit presentation from 0.1.9. | |||
== Syntax == | == Syntax == | ||
| Line 18: | Line 22: | ||
== Returns == | == Returns == | ||
Returns <code>true</code> when the validated identity | Returns <code>true</code> when the server accepts the validated identity state; returns <code>false</code> for an unavailable player, invalid key or rejected change. Success is not confirmation that every client has finished rendering it. | ||
== Examples == | == Examples == | ||
Select Milten's head/face without equipping armor or changing the body: | |||
<syntaxhighlight lang="lua" line> | <syntaxhighlight lang="lua" line> | ||
if not setPlayerIdentity(playerId, "milten") then | if not setPlayerIdentity(playerId, "milten") then | ||
| Line 30: | Line 34: | ||
== Notes == | == Notes == | ||
* Available only in server-side resource scripts. | * Available only in server-side resource scripts. | ||
* This is the | * This existing API has improved behavior in 0.1.3; it was not introduced in that release. Use a key from <code>getPlayerIdentityNames</code>, including <code>default</code> to select the default identity. | ||
* The | * In 0.1.8, the client applies a head-only identity layer with supported face/hair/beard geometry. From 0.1.9, the five [[Female identities|supported female identities]] also display their full authored outfit when no armor is equipped and body/head selections match. With armor equipped, the corrected female head is shown with the native armor. This is not a general body-shape or arbitrary model replacement API. | ||
* Equipped armor remains controlled | * The identity layers are committed together in server state. Native asset loading and visual reconstruction are asynchronous, so a successful call does not promise an immediately complete image on every client. | ||
* | * Equipped armor remains controlled independently by <code>setPlayerArmor</code>. This call does not equip or remove items, change HP/progression, or reset <code>setPlayerSkinColor</code>/<code>setPlayerTattoo</code> overrides. | ||
* | * Test the identities, armor, exposed skin, materials and LODs used by your resource on local and remote clients; not every authored combination or material permutation is guaranteed to render identically. | ||
* Accepted changes emit the | * Reliable server-owned state is replayed on relevance entry and late join. Resources must perform their own authorization before exposing this setter to player requests. | ||
* Accepted changes emit existing compatibility events for the layers that changed: <code>onPlayerFaceChange</code> and <code>onPlayerBodyChange</code> for the legacy face/body state, and <code>onPlayerHeadChange</code> for the head state. These are state-change events, not notifications that visual reconstruction has finished; the female outfit presentation from 0.1.9 does not add a new event. | |||
* See [[Player customization]], [[Player identity catalog]] and [[Player tattoo catalog]] for the independent appearance layers and supported catalogs. | |||
[[Category:Lua Functions]] | [[Category:Lua Functions]] | ||
| Line 41: | Line 47: | ||
[[Category:Player Functions]] | [[Category:Player Functions]] | ||
[[Category:Appearance Functions]] | [[Category:Appearance Functions]] | ||
<!-- female019:start --> | |||
== Female presentation improved from 0.1.9 == | |||
'''Improved from 0.1.9.''' | |||
<code>setPlayerIdentity(playerId, "syra")</code> selects the matched identity; the same applies to <code>velaya</code>, <code>seraphia</code>, <code>chani</code> and <code>natalia</code>. Identity selection remains an existing API. See [[Female identities]] for full-outfit/armor behavior, neutral facial expression and supported customization. The call does not remove armor, change protection or clear tint/tattoos. | |||
<!-- female019:end --> | |||
Latest revision as of 13:29, 20 October 2026
setPlayerIdentity
Selects a named identity while preserving equipped armor and independent cosmetic overrides. See Female identities for the expanded female body/outfit presentation from 0.1.9.
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 server accepts the validated identity state; returns false for an unavailable player, invalid key or rejected change. Success is not confirmation that every client has finished rendering it.
Examples
Select Milten's head/face without equipping armor or changing the body:
if not setPlayerIdentity(playerId, "milten") then
outputChatBox("The identity could not be applied.", playerId)
end
Notes
- Available only in server-side resource scripts.
- This existing API has improved behavior in 0.1.3; it was not introduced in that release. Use a key from
getPlayerIdentityNames, includingdefaultto select the default identity. - In 0.1.8, the client applies a head-only identity layer with supported face/hair/beard geometry. From 0.1.9, the five supported female identities also display their full authored outfit when no armor is equipped and body/head selections match. With armor equipped, the corrected female head is shown with the native armor. This is not a general body-shape or arbitrary model replacement API.
- The identity layers are committed together in server state. Native asset loading and visual reconstruction are asynchronous, so a successful call does not promise an immediately complete image on every client.
- Equipped armor remains controlled independently by
setPlayerArmor. This call does not equip or remove items, change HP/progression, or resetsetPlayerSkinColor/setPlayerTattoooverrides. - Test the identities, armor, exposed skin, materials and LODs used by your resource on local and remote clients; not every authored combination or material permutation is guaranteed to render identically.
- Reliable server-owned state is replayed on relevance entry and late join. Resources must perform their own authorization before exposing this setter to player requests.
- Accepted changes emit existing compatibility events for the layers that changed:
onPlayerFaceChangeandonPlayerBodyChangefor the legacy face/body state, andonPlayerHeadChangefor the head state. These are state-change events, not notifications that visual reconstruction has finished; the female outfit presentation from 0.1.9 does not add a new event. - See Player customization, Player identity catalog and Player tattoo catalog for the independent appearance layers and supported catalogs.
Female presentation improved from 0.1.9
Improved from 0.1.9.
setPlayerIdentity(playerId, "syra") selects the matched identity; the same applies to velaya, seraphia, chani and natalia. Identity selection remains an existing API. See Female identities for full-outfit/armor behavior, neutral facial expression and supported customization. The call does not remove armor, change protection or clear tint/tattoos.