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
 
Clarify player appearance API behavior
Line 21: Line 21:


== Examples ==
== Examples ==
Use Milten's complete prebaked character model:
Use Milten's complete character appearance:
<syntaxhighlight lang="lua" line>
<syntaxhighlight lang="lua" line>
if not setPlayerBody(playerId, "milten") then
if not setPlayerBody(playerId, "milten") then
Line 30: Line 30:
== 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.
* A named body includes the character's original body, head and outfit or armor appearance.
* Set the head to <code>default</code> before selecting a named body. Non-default heads are valid only with <code>body = default</code>.
* Set the body to <code>default</code> before selecting an independent head or displaying separately equipped armor.
* The reliable state is replayed during relevance entry and late join.
* The reliable state is replayed during relevance entry and late join.
* This emits <code>onPlayerBodyChange</code> when accepted.
* This emits <code>onPlayerBodyChange</code> when accepted.

Revision as of 21:43, 15 August 2026

setPlayerBody

Changes a player's authoritative full-body identity preset.

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 compatible preset is accepted and replicated; otherwise returns false.

Examples

Use Milten's complete character appearance:

if not setPlayerBody(playerId, "milten") then
    outputChatBox("The body preset could not be applied.", playerId)
end

Notes

  • Available only in server-side resource scripts.
  • A named body includes the character's original body, head and outfit or armor appearance.
  • Set the body to default before selecting an independent head or displaying separately equipped armor.
  • The reliable state is replayed during relevance entry and late join.
  • This emits onPlayerBodyChange when accepted.