How do I colorize the player's skin?

Red_King_Cyclops
Member
 
Posts: 267
Joined: Sun Jun 16, 2019 20:17
Location: Earth

How do I colorize the player's skin?

by Red_King_Cyclops » Sat Aug 17, 2019 13:22

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: 86
Joined: Fri May 03, 2019 16:46

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

by Eran » Sat Aug 17, 2019 14:03

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: 745
Joined: Fri May 29, 2015 21:14
Location: Unknown
GitHub: AiTechEye

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

by AiTechEye » Sun Aug 18, 2019 18:57

local skin = player:get_properties().textures

player:set_properties({textures=skin})

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


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 7 guests