How do I colorize the player's skin?

Post Reply
Red_King_Cyclops
Member
Posts: 315
Joined: Sun Jun 16, 2019 20:17
Location: Earth

How do I colorize the player's skin?

by Red_King_Cyclops » Post

I'm thinking about making a mod that colorizes the player's skin. The player's skin texture would stay the same, but it would recoloured. I know how to colorize textures, but I don't know how to get the player's skin texture or set it.
My best mods: space_travel, time_travel, and rocket.

Eran
Member
Posts: 123
Joined: Fri May 03, 2019 16:46

Re: How do I colorize the player's skin?

by Eran » Post

If you're using the player_api mod you can use get_animation to get the textures for a player and set_textures to modify it. If you're using 3d armors or something else that modifies players visually, this might be different.

Code: Select all

--returns a table with model, textures and animation
local anim = player_api.get_animation(player)

--use a new table because the argument you get is a reference to a table
-- and changing it might mess things up
local modified_textures = {}
for i, t in ipairs(anim.textures) --copy each texture over and append the modifier
do
    modified_textures[i] = t .. texture_modifier
end
--set the modified textures
player_api.set_textures(player, modified_textures)
I haven't tested this so it might contain mistakes.

User avatar
AiTechEye
Member
Posts: 890
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: ¯\_(ツ)_/¯

Re: How do I colorize the player's skin?

by AiTechEye » Post

local skin = player:get_properties().textures

player:set_properties({textures=skin})

try: print(dump(player:get_properties()))

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests