SetPlayerBody: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Document player skin, body and head appearance API
 
Document 0.1a Lua API, identities, moderation and synchronized spells
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<!-- This page is generated automatically from the function definition: setPlayerBody. -->
= setPlayerBody =
= setPlayerBody =
Changes a player's authoritative full-body identity preset.
Deprecated compatibility API retained for legacy resources. It is unsupported for player appearance selection in G1R:MP 0.1.


== Syntax ==
== Syntax ==
Line 18: Line 17:


== Returns ==
== Returns ==
Returns <code>true</code> when the compatible preset is accepted and replicated; otherwise returns <code>false</code>.
Returns <code>true</code> when the server accepts the legacy state; this does not guarantee a supported visual result in G1R:MP 0.1. Returns <code>false</code> when validation fails.


== Examples ==
== Examples ==
Use Milten's complete prebaked character model:
Migrate a legacy body call to the supported identity setter:
<syntaxhighlight lang="lua" line>
<syntaxhighlight lang="lua" line>
if not setPlayerBody(playerId, "milten") then
-- Deprecated: setPlayerBody(playerId, "milten")
    outputChatBox("The body preset could not be applied.", playerId)
setPlayerIdentity(playerId, "milten")
end
</syntaxhighlight>
</syntaxhighlight>


== Notes ==
== Notes ==
* Available only in server-side resource scripts.
* Available only in server-side resource scripts.
* A named body contains its original head because G1R does not export those NPC meshes as independently composable body parts.
* Deprecated and unsupported for appearance selection in G1R:MP 0.1. Use <code>setPlayerIdentity</code>; it is the only supported complete identity setter.
* Set the head to <code>default</code> before selecting a named body. Non-default heads are valid only with <code>body = default</code>.
* Do not migrate to <code>setPlayerFace</code>, which is also deprecated and unsupported in 0.1.
* The reliable state is replayed during relevance entry and late join.
* This is a compatibility alias for <code>setPlayerFace</code>.
* This emits <code>onPlayerBodyChange</code> when accepted.
* The server may retain and replay the legacy state for protocol compatibility, but resources must not rely on a visible face/body-only change.
* This emits both <code>onPlayerBodyChange</code> and <code>onPlayerFaceChange</code> when accepted.


[[Category:Lua Functions]]
[[Category:Lua Functions]]
Line 39: Line 38:
[[Category:Player Functions]]
[[Category:Player Functions]]
[[Category:Appearance Functions]]
[[Category:Appearance Functions]]
[[Category:Deprecated Lua API]]

Latest revision as of 11:36, 27 August 2026

setPlayerBody

Deprecated compatibility API retained for legacy resources. It is unsupported for player appearance selection in G1R:MP 0.1.

Syntax

bool setPlayerBody(int playerId, string bodyKey)

Parameters

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

Returns

Returns true when the server accepts the legacy state; this does not guarantee a supported visual result in G1R:MP 0.1. Returns false when validation fails.

Examples

Migrate a legacy body call to the supported identity setter:

-- Deprecated: setPlayerBody(playerId, "milten")
setPlayerIdentity(playerId, "milten")

Notes

  • Available only in server-side resource scripts.
  • Deprecated and unsupported for appearance selection in G1R:MP 0.1. Use setPlayerIdentity; it is the only supported complete identity setter.
  • Do not migrate to setPlayerFace, which is also deprecated and unsupported in 0.1.
  • This is a compatibility alias for setPlayerFace.
  • The server may retain and replay the legacy state for protocol compatibility, but resources must not rely on a visible face/body-only change.
  • This emits both onPlayerBodyChange and onPlayerFaceChange when accepted.