Wiki

Clone wiki

NuclearThroneTogether / Scripting / Mods / skin.gml

Nuclear Throne Together' versions starting from 9893 and above allow you to define custom skins for preexisting characters (both default and custom ones).

This is done by creating a your-skin-name.skin.gml file in game's main or appdata directory and loading it via /loadskin your-skin-name. To avoid name clashes, it is recommended that you name your skin files distinctively and/or include the related race' name in the file name. The file can #define the following scripts to be called by the game:

skin_race

Must return the race ID that the skin is for. Can be either a numeric ID for built-in races or a string ID for custom ones.

game_start

Executed from each player instance of the matching skin after everyone picked characters and the game is starting. This is where you initialize player-specific global variables.

create

Executed from each player instance of the matching skin upon creation. This is where you you set sprites, sounds, and character-specific properties. For example,

#!cpp
#define create
spr_idle = sprSpookyBanditIdle;
spr_walk = sprSpookyBanditWalk;
spr_hurt = sprSpookyBanditHurt;
spr_dead = sprSpookyBanditDead;
Keep in mind that this also executes when a player is revived;

See Player' variables for a complete list of built-in variables that you can mess with.

skin_name

May return a snippet of text to display when mouseovering the skin button.

Receives the fact of availability as argument0.

skin_portrait

May return the large portrait art for loadout/pause menu. Receives player index as argument0.

skin_avail

May return whether the skin is currently available (true) or locked (false).

In other words, check the unlock condition(s) here.

skin_button

Will be called on skin selection button and should set sprite/etc. Receives availability (true/false) as argument0.

skin_mapicon

Gets the player index as argument0 and should return the map icon sprite.

skin_sprite

If defined, serves as a "remapper" for sprites - that is, it receives a sprite index as argument0, and may return a sprite index that should be used instead. Currently it is called for race/skin-specific sprites such as character sprites, Crystal's shield, Eyes' indicator, Horror' projectiles, etc.

It would usually be just a switch-block full of return statements,

#!cpp
#define init
// ...
global.spr_shield = sprite_add("tree-shield.png", 6, 32, 42);
global.spr_shield_disappear = sprite_add("tree-shield-disappear.png", 5, 32, 42);

#define skin_sprite
switch (argument0) {
    case sprShield: return global.spr_shield;
    case sprShieldDisappear: return global.spr_shield_disappear;
    // ...
}

skin_ttip

May return a tip for display on the loading screen.

If the result is valid (array of strings or a string), overrides the race-specific tip.

Examples

Updated