IMIsle Modkit
Pages in this area

Skins

There are two kinds of custom skins.

  • Color skins change the ten color zones of a dinosaur on the server. Every player sees them.
  • Texture skins replace the pattern texture of the body material. Only players with the launcher see them.

The ready-made skins resource

Type new skins in the runner console. You get resources\skins\ with these commands.

/skins                        list the skins
/skin neon_rex                wear a skin, it is applied again after every respawn
/skinreset                    back to the normal look
/giveskin <steamId> <name>    admins only

Define skins in resources\skins\skins.lua.

Skins = {
  neon_rex = {
    species = "Tyrannosaurus",
    body = { 0.0, 4.0, 4.0 },
    markings = { 6.0, 0.0, 6.0 },
  },
  blood = {
    body = "#5A0A0A",
    flank = "#7A1010",
    underbelly = "#2A0505",
    markings = "#C41E1E",
    display = "#FF2020",
  },
  striped = {
    species = "Tyrannosaurus",
    texture = "textures/test_stripes.png",
    body = "#6C3729",
  },
}

The Server Tool has an editor for this file. See the server owner guide.

The template saves who wears which skin with io.open("resources/skins/data.json"). That is a relative path, and the working directory of the game server is not the server root. The file most likely never gets written. If skins are lost after a server restart, change the template to modkit.resources.save and modkit.resources.file. The persistence guide shows the pattern.

Color skins in your own script

modkit.commands.add("red", function(player)
  if not player.hasDino then player:message("Spawn first.") return end
  local ok = player:setSkin({ body = "#FF0000", markings = { 4.0, 0.0, 0.0 }, pattern = 2 })
  player:message(ok and "Done." or "Could not apply the skin.")
end)

Zones

body, flank, underbelly, markings, display, teeth, mouth, claws, detail, eyes. A zone you leave out keeps the player's color.

Color formats

Format Meaning
"#RRGGBB" sRGB like the in-game skin code. Converted to linear light for you.
{ r, g, b } or { r = , g = , b = } Linear light. Values above 1.0 glow.

The server raises every channel to at least 0.01.

Other fields

Field Type Meaning
pattern integer pattern slot
theme integer theme slot
variation number skin variation
female boolean the female flag of the customizer data. It is unclear if this changes more than the look.
code string skin code string stored in the customizer data

The server plugin turns off the game's color check (ValidateAndSanitizeColors) at startup, so that colors outside the game's normal range are kept.

player:getSkin() returns the current values. Colors come back as "#RRGGBB", so values above 1.0 are clipped in the result.

Texture skins

A texture skin is a PNG in your resource, listed in files. The server tells the clients who wears which texture. The client script loads the PNG and sets it on the body material.

local PARAMS = { "Adult_Base_ColorOverlay", "Juvenile_Base_ColorOverlay", "Hatchling_Base_ColorOverlay" }

for _, char in ipairs(modkit.game.characters()) do
  if char.name == "SomePlayer" then
    for _, param in ipairs(PARAMS) do
      modkit.game.setMaterialTexture(char, 0, param, "textures/test_stripes.png")
    end
  end
end

The overlay textures are zone maps. Pure red, green, blue, cyan, magenta and yellow pixels select the six color layers of the master material M_MasterSkin_Dinosaur. The zone colors still come from the color skin. Dino Studio in the Server Tool paints these maps on the real model.

The example uses material slot 0 for the body. The skins template does not rely on a fixed slot and searches all slots for the master material with modkit.game.materialParams. Copy that function if you write your own.

Reference: player natives, game natives.