Jump to content

[Modded Skins API Tutorial] Creating Custom Skins for Mods


Hornete
 Share

Recommended Posts

Hello! Sorry to bother you but I’ve encountered a problem when moving my character over from the old version of the skin API to this one.

My character equips masks to change the appearance of his head and face. I do this with AnimState:AddOverrideBuild.

Some of my masks use the “swap_face” symbol.

My character worked fine with the old version of the API, but since using this one… changing his clothes while wearing a mask causes the “swap_face” layer to disappear, I'm guessing because of the glasses layer. Glasses also override the swap_face, but even if I don’t equip them his swap_face gets cleared every time he uses the wardrobe. It’s literally only happening with swap_face – every other symbol, the mask has priority.

Is there anything I can do to prevent this from happening? I wouldn’t mind if the solution stopped him from wearing glasses completely. I tried using “ExcludeClothingSymbolForModCharacter” and while that hides the glasses, his swap_face still disappears. :/

I’m not able to upload my mod character, but if it helps, I’ve used the Extended Character Template to very quickly recreate the issue I’m having.

swapface test mod.zip

Very sorry if this is a dumb question or an extremely niche issue. If it can't be helped, it's okay.

Edited by Chesed
formatting
  • Like 1
Link to comment
Share on other sites

1 hour ago, Chesed said:

[snip]

Thanks! In my implementation I made the mistake of assuming that swap_face would only be used in a skin setting, and didn't consider that mods might be using it for their custom hats. I'll get a fix in for it in the next patch (And I'll give precedence to swap_face's overrid in other contexts before skin swap_face's take effect,  I imagine most modders would rather have their own gameplay/visuals take priority over what skins the player has from another mod)

  • Thanks 1
Link to comment
Share on other sites

@Hornete Hello, need u help, if I use 

Asset( "ANIM", "anim/ms_spear_wathgrithr_aloy.zip"), 

i have error
Modded Skins WILL NOT skin official entities unprotected!
if I use 

Asset( "DYNAMIC_ANIM", "anim/ms_spear_wathgrithr_aloy.zip"), 

the game starts but when i try to equip item i get an error

AnimationFile::LoadDynamicTextures Failed to open ../mods/skiiins/anim/ms_spear_wathgrithr_aloy.dyn

I don't have a dyn file and I don't know how to make one.

I will be very grateful for an explanation of how to create a dyn file

Edited by GodIess
Link to comment
Share on other sites

On 4/4/2023 at 6:02 PM, GodIess said:

[snip]

Hiya! Sorry for the late response, was a bit busy these past few days. I'd be happy to help you though I saw your other thread and it seems you were able what you wanted to do. If you still need something however or something goes awry with your implementation, you're free to reach me again.

Link to comment
Share on other sites

Hello again! Just wanted to report that unfortunately the last patch did not fix my issue.

I understand you guys are super busy, so I won't bother you about it again. I was just worried it might have been missed while stuff was being changed.

Unrelated, but thank you so much to you and your team for making this stuff possible - and so easy to use! As an artist who can't code to save their life, it's really awesome getting to have this opportunity to do stuff like this for my characters.

Edited by Chesed
Link to comment
Share on other sites

On 4/17/2023 at 4:23 PM, Chesed said:

Hello again! Just wanted to report that unfortunately the last patch did not fix my issue.

I understand you guys are super busy, so I won't bother you about it again. I was just worried it might have been missed while stuff was being changed.

Unrelated, but thank you so much to you and your team for making this stuff possible - and so easy to use! As an artist who can't code to save their life, it's really awesome getting to have this opportunity to do stuff like this for my characters.

Hiya. It's no worry and you are right it was missed.

Unfortunately I encountered complications when designing so I had opted to just have the 'ExcludeClothingSymbolForModCharacter' function you mentioned work properly and have glasses not function at all. Hope that's alright.

It'll be in the next patch soonish(for real this time!)

  • Health 1
Link to comment
Share on other sites

On 4/23/2023 at 4:26 PM, GodIess said:

in scripts/prefabs/prefabskin.lua:

It looks like the init_fn's here come with extra parameters. The vanilla game is able to assign init_fns by each skin prefab and the game passes true for this extra parameter to allow for open top hats though in the API we just search for the init and clear fn's using the prefab name, I would like to change this.

For now I'm sure you can hook into the existing fn's and check for the build name to set opentop to true.

if build_name == "WhateverYourCustomSkinBuildIs" then
	opentop = true
end

 

Link to comment
Share on other sites

22 hours ago, Hornete said:

It looks like the init_fn's here come with extra parameters. The vanilla game is able to assign init_fns by each skin prefab and the game passes true for this extra parameter to allow for open top hats though in the API we just search for the init and clear fn's using the prefab name, I would like to change this.

For now I'm sure you can hook into the existing fn's and check for the build name to set opentop to true.

if build_name == "WhateverYourCustomSkinBuildIs" then
	opentop = true
end

 

Thx

Link to comment
Share on other sites

Hi

My character has 1 + 3 skins (including _none) and everything works perfectly. 

If I attempt to add a fourth (fifth) skin, the game crashes on the wardrobe screen. 

image.thumb.jpeg.6045f8b7551f20c3fbf3ae27da908771.jpeg

I add the new skin the exact same way I did the others and even tried duplicating an older anim to make sure the .zip wasn't the issue. The game just refuses to add a 5th entry. What's going on?
@Hornete

Edited by Well-met
Link to comment
Share on other sites

11 hours ago, Hornete said:

You are not using the API from what I can observe from your mods list.

Oh actually it's directly in my character modmain

-- Skin
local _G = GLOBAL
local PREFAB_SKINS = _G.PREFAB_SKINS
local PREFAB_SKINS_IDS = _G.PREFAB_SKINS_IDS
local SKIN_AFFINITY_INFO = GLOBAL.require("skin_affinity_info")

modimport("skins_api")

SKIN_AFFINITY_INFO.melium = {
	"melium_shadow",
	"melium_nature",
	"melium_formal",
}

PREFAB_SKINS["melium"] = {
	"melium_none", 
	"melium_shadow",
	"melium_nature",
	"melium_formal",
}

PREFAB_SKINS_IDS = {}
for prefab,skins in pairs(PREFAB_SKINS) do
    PREFAB_SKINS_IDS[prefab] = {}
    for k,v in pairs(skins) do
      	  PREFAB_SKINS_IDS[prefab][v] = k
    end
end

AddSkinnableCharacter("melium")

 

Link to comment
Share on other sites

8 hours ago, Haruhi Kawaii said:

If you use this API, you can't choose rarity, here's the reason
image.png.b915b77a5174a906de707f2041af9cc8.png

I wish we could get a sortkey system or something to sort our skins more easily, like how the old crafting system sorted recipes.

Link to comment
Share on other sites

Think it's possible to make a character who's gimmick is changing traits and stats based on what skin is equipped?

Like, if the character is in a knight skin or something, they take reduced damage. But less than any armor and they can't wear anything in the torso slot. But if they switch to a wizard skin, they take normal damage and can use armor again. But then do more damage with weapons found in the Magic tab.

Link to comment
Share on other sites

On 9/18/2023 at 2:30 PM, icantevenname said:

Think it's possible to make a character who's gimmick is changing traits and stats based on what skin is equipped?

Like, if the character is in a knight skin or something, they take reduced damage. But less than any armor and they can't wear anything in the torso slot. But if they switch to a wizard skin, they take normal damage and can use armor again. But then do more damage with weapons found in the Magic tab.

Definitely, but I think that's easier to do that with transformations.

Link to comment
Share on other sites

Hello, I'm facing a problem involving hand items specifically, as they often have 2 anim files, in my case I have a weapon that has defaultanim and defaultanim_ground for when the item is dropped on the ground, and I could not get the _ground one to work.

OnEquip works fine as intended, the skin gets applied, but when dropping the item it becomes invisible because I presume I have to tell the game to also use the _ground anim, but the API tutorial doesn't cover items that have multiple anim files.

What can I do about defaultanim_ground?

depthsword.lua

Edited by ArcAngela
added file
Link to comment
Share on other sites

On 9/13/2023 at 11:14 AM, hilber_angers said:

The log showed that a skin for offical item needed a protected file, but Ido not know how to make a dyn file

On 8/2/2023 at 3:03 PM, Cliffford W. said:

Is it forbidden to add skins for loading backgrounds or something ?

Hiya! Sorry for taking a while, I had a vacation and entered Uni back-to-back. I've dm'ed you regarding this topic :)

On 9/18/2023 at 2:30 PM, icantevenname said:

Think it's possible to make a character who's gimmick is changing traits and stats based on what skin is equipped?

Like, if the character is in a knight skin or something, they take reduced damage. But less than any armor and they can't wear anything in the torso slot. But if they switch to a wizard skin, they take normal damage and can use armor again. But then do more damage with weapons found in the Magic tab.

Yup! All necesacary skin information is found in the 'skinner' component.

You can hook into the `skinner:SetSkinName` method and apply your changes depending on the new skin (and possibly any reverts depending on the old skin, in case you must clear something)

On 9/27/2023 at 5:48 PM, ArcAngela said:

Hello, I'm facing a problem involving hand items specifically, as they often have 2 anim files, in my case I have a weapon that has defaultanim and defaultanim_ground for when the item is dropped on the ground, and I could not get the _ground one to work.

OnEquip works fine as intended, the skin gets applied, but when dropping the item it becomes invisible because I presume I have to tell the game to also use the _ground anim, but the API tutorial doesn't cover items that have multiple anim files.

What can I do about defaultanim_ground?

depthsword.lua 4.1 kB · 1 download

We follow closely to Klei's implementation and in Klei's case they only really have support for having one animation file cover everything from ground sprites to swap sprites and more. But you can implement a little hack if you do not want to do this.

In your init function, you can apply the _ground builds properly after you (I assume) run basic_init_fn

--(H): I am making an assumption on what your init_fn may look like, the important like is the AnimState:SetSkin call
depthsword_init_fn = function(inst, build_name)
	basic_init_fn( inst, build_name, "depthsword_ground" )

	inst.AnimState:SetSkin(build_name.."_ground", "depthsword_ground") --Skin name with _ground concactenated for the proper anim file. Default build is 2nd parameter
end

 

  • Like 1
Link to comment
Share on other sites

Hello! This is my first time ever looking into DST mods and this modded skins API looks amazingly made :love_heart:

I was wondering if someone can help me figure one thing out:
I'm trying to make a simple mod that adds a vignette of my own.

I've copied someone else's homework and got my personal art to show up on a loading screen so far!preview.thumb.png.35a72caa8bc49fb011788bfcd831521d.png

What I'm having problem is the icon for the vgnette in the curio cabinet..2023-10-08172550.thumb.png.8e0a3006b2eadaff791948bf3afce71b.png
(I used some other animation's zip and dyn file in order for the game to not crash for this screenshot; It shows up as empty as names and what-nots arn't matching I'm assuming)

I think I can properly make my Spriter project for it to export as zip. But this one mod and the another one I'm referencing, both requires the dynamic animation files, which I have no idea how to make one.

ModdedCurios = {
	ms_kaity_bananamilk_sar = {
		type = "loading",
		skin_tags = {"LOADING"},
		rarity = "ModMade",
		assets = {
			Asset("ATLAS", "images/bg_loading_ms_kaity_bananamilk_sar.xml"),
			Asset("IMAGE", "images/bg_loading_ms_kaity_bananamilk_sar.tex"),
			
			-- These I don't know how to make one of my art
			Asset("DYNAMIC_ANIM", "anim/dynamic/ms_kaity_bananamilk_sar.zip"),
			Asset("PKGREF", "anim/dynamic/ms_kaity_bananamilk_sar.dyn"),
		},
	}
}

 

How can I go around making the zip and the dyn file for the icon?
Or are there ways I can achieve this using just regular animation zip file, not dynamic ones?
Or should I be asking this question somewhere else, like the "[API] Mods In Menu"?

First time posting anything; Feel free to point thigns out for me :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...