change skin||doc135505

September 20, 2022

Format

 Entity:changeSkin(skinData) 
  • The class to which the function belongs:Entity

Description

Changes to the character skin of an entity object are automatically synced to all clients visible to the entity object.


Parameters

Variable name type Description
skinData SkinData skin data


Code Samples

On the server side of the entity objectmount script, when adding registered entities when wearing equipmentCallback, changing the appearance of the skin

Trigger.addHandler(this:cfg(), "WEAR_EQUIPMEN", function(context)
    local entity = context.obj1
    local skinData = {
        armor_chest = 'diamond'
    }
    entity:changeSkin(skinData)
end)