Jump to content

[Modded Skins API Tutorial] Creating Custom Skins for Mods


Hornete
 Share

Recommended Posts

Hello! I hope it's appropriate to post this here - if it seems slightly off-topic it's because it is, I wasn't sure where to go and report this bug I'm having right after updating the mod (twice, hehe - so I made sure it's updated!).

First of all, I'm very grateful for the work you've put in and you have still been putting in! What an amazing human/genius*!

It's a very small bug - to me, at least, so I don't need nor want it fixed right away - not at all, just reporting. It seems the mod doesn't recognize whether you own an heirloom skin of the corresponding skin. I used to own the 'classic' skin, but I unraveled it because it didn't make sense to me to keep two of the same. Maybe other people did the same thing too.

Here's 2 screenshots I took just now, if it's needed or helpful. 

Again, thank you so much for the effort thus far and if this helps or is just spam, take it as you will. Maybe others have reported this already too, in which case I'll be more than glad to edit this comment here or remove it ^^ 

 

*yes, a Brooklyn 99 reference... why not, haha. Sorry 

  • Thanks 1
Link to comment
Share on other sites

Posted (edited)
1 hour ago, gooeydelight said:

[snip]

Thank you for the report! This will be fixed soon.

For future reference: Feel free to visit the Bug Report discussion on the mod page to report issues.

Edited by Hornete
  • Health 1
Link to comment
Share on other sites

On 4/22/2023 at 10:41 PM, Hornete said:

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!)

I added ExcludeClothingSymbolForModCharacter( "charactername", "swap_face" ) to my modmain and his items are still broken the exact same way as before (glasses are hidden, but symbol is cleared) as of version 2.5.4. The Estemplate dummy build I sent last year has the same issue.

Have I not implemented it correctly on my end, or is it just not working?

Link to comment
Share on other sites

5 minutes ago, Chesed said:

I added ExcludeClothingSymbolForModCharacter( "charactername", "swap_face" ) to my modmain and his items are still broken the exact same way as before (glasses are hidden, but symbol is cleared) as of version 2.5.4. The Estemplate dummy build I sent last year has the same issue.

Have I not implemented it correctly on my end, or is it just not working?

I had tested and everything! Admittedly the tests were quite a while ago, I am so sorry for the inconveniences over this.

I will conduct some re-tests once I return home and I'll come back to you, thank you for putting up with this!

Link to comment
Share on other sites

On 1/10/2024 at 12:19 PM, Chesed said:

I added ExcludeClothingSymbolForModCharacter( "charactername", "swap_face" ) to my modmain and his items are still broken the exact same way as before (glasses are hidden, but symbol is cleared) as of version 2.5.4. The Estemplate dummy build I sent last year has the same issue.

Have I not implemented it correctly on my end, or is it just not working?

I have pushed a patch earlier today, I missed a single edge case but it should all be good now. :pray:

  • Thanks 1
Link to comment
Share on other sites

14 hours ago, Hornete said:

I have pushed a patch earlier today, I missed a single edge case but it should all be good now. :pray:

THE PROPHECY IS REAL... NO MORE BALD MASKS. I've tested him out and it looks like his swap_face is staying put properly now!

Thank you very much for fixing him! I actually started working on his mod again after a hiatus only a few days before you updated the API, so this gives me a lot of motivation to keep chipping away at his skins. (Redrawing the faces and heads of 15+ character builds is... no joke, as it turns out.)

If a future update breaks him again somehow, I'll let know.

  • Like 1
Link to comment
Share on other sites

53 minutes ago, Chesed said:

THE PROPHECY IS REAL... NO MORE BALD MASKS. I've tested him out and it looks like his swap_face is staying put properly now!

Thank you very much for fixing him! I actually started working on his mod again after a hiatus only a few days before you updated the API, so this gives me a lot of motivation to keep chipping away at his skins. (Redrawing the faces and heads of 15+ character builds is... no joke, as it turns out.)

If a future update breaks him again somehow, I'll let know.

YIPPIE! Thank you for dealing with me, haha. It had taken a while since I hadn't the motivation for a bit to do anything (til I got the push/energy to produce the new update this past winter break).

Happy modding!

  • Like 2
Link to comment
Share on other sites

Hi! I am having trouble with setting skin of an item placer. Basically what I am doing is that I am adding my own fence prefab and it's own skins. I can manage to add skins to the fence itself, and when i link a placer to the fence and use that in the recipe, the game uses the skin for the placer.  the problem arises when i try to generate items to place the fence, just like normal fences. the normal skin works just fine, but when i try to place a modded skin one, the placer is looking for the skin name without the "ms_" in the beginning. Hence, it doesn't exist and falls back to the default skin.
I've tried overriding the init and clear function for the placer, but it didn't work. can you help me with solving this issue?
Thanks so much

Link to comment
Share on other sites

On 3/31/2024 at 3:09 AM, kk.orbit said:

Hi! I am having trouble with setting skin of an item placer. Basically what I am doing is that I am adding my own fence prefab and it's own skins. I can manage to add skins to the fence itself, and when i link a placer to the fence and use that in the recipe, the game uses the skin for the placer.  the problem arises when i try to generate items to place the fence, just like normal fences. the normal skin works just fine, but when i try to place a modded skin one, the placer is looking for the skin name without the "ms_" in the beginning. Hence, it doesn't exist and falls back to the default skin.
I've tried overriding the init and clear function for the placer, but it didn't work. can you help me with solving this issue?
Thanks so much

Hiya!

If i'm understanding and remembering correctly, It might relate to this hack done in the Vanilla game's `playercontroller.lua` component

local placer_skin = placer_item.AnimState:GetSkinBuild() --hack that relies on the build name to match the linked skinname

Can I ask if your skin name, (skin) build name and linked skinname differentiate in any way?

Happy Modding!

Link to comment
Share on other sites

local prefs = {}

local function MakeFenceSkin(build_name)
    table.insert(prefs, MakePlacer(build_name, build_name, build_name, "idle"))
    table.insert(prefs, CreatePrefabSkin("ms_"..build_name,
        {
            assets = {
                Asset("ANIM", "anim/" .. build_name .. ".zip")
            },
            base_prefab = "ec_fence",
            type = "item",
            build_name_override = build_name,
            rarity = "ModMade",
            skin_tags = {"MUSHLIGHT", "CRAFTABLE"}
        }
    ))
    table.insert(prefs, CreatePrefabSkin(
        "ms_" .. build_name .. "_item",
        {
            assets = {
                Asset("ANIM", "anim/" .. build_name .. ".zip")
            },
            base_prefab = "ec_fence_item",
            type = "item",
            build_name_override = build_name,
            rarity = "ModMade",
            skin_tags = {"MUSHLIGHT", "CRAFTABLE"}
        }
    ))
end

MakeFenceSkin("ec_fence_1")

return unpack(prefs)

This is the actual code that I am using to make my fence skins. The ec_fence and ec_fence_item prefabs are literal copies of the DST fence.lua

That line of code you mentioned is precisely as far as i could go, but I couldn't change that skin builder name.
To answer your question, yes, the build and skin name are different because of the ms_ that is added to the beginning. I didn't think to set my build to that. but the linked skin name and the skin name are the same, because i had to do it so that the placer places the fence with the skin i wanted. here is the override that i use: (copied the vanilla one from prefabskin.lua and modified it)

 

GLOBAL.ec_fence_item_init_fn = function(inst, build_name)
    if build_name then
        build_name = "ms_"..build_name
    end
    inst.linked_skinname = build_name --hack that relies on the build name to match the linked skinname
    inst.AnimState:SetSkin(build_name, "ec_fence") --same hack is used here by the deployable code in player controller
    inst.AnimState:PlayAnimation("inventory")
    inst.components.inventoryitem:ChangeImageName(inst:GetSkinName())
end
GLOBAL.ec_fence_item_clear_fn = function(inst)
    inst.linked_skinname = nil
    inst.AnimState:SetBuild("ec_fence")
    inst.components.inventoryitem:ChangeImageName()
end
GLOBAL.ec_fence_init_fn = function(inst, build_name)
    if inst.components.placer == nil and not GLOBAL.TheWorld.ismastersim then
        return
    end
    inst.AnimState:SetSkin(build_name, "ec_fence")
end
GLOBAL.ec_fence_clear_fn = function(inst)
    inst.AnimState:SetBuild("ec_fence")
end

 

I just finished testing, compiled my anim file for the fence once more with "ms_" in the beginning of the build name. loaded it into the game assets and I still see the default skin as the placer, i should mention that the override of the init function fixed the final fence's skin, so the placed item has no problem

Link to comment
Share on other sites

34 minutes ago, kk.orbit said:

[snip]

Hmmm, if you are comfortable with sharing may you send your mod over either here or in private messages? Otherwise I'll be happy to scrounge up some debug prints/let me think about what the issue may be and we'll figure the issue in due time.

Thanks and apologies for any inconveniences

Link to comment
Share on other sites

That sounds good to me! Since the texture im working on right now is a recolor of an official fence skin, I will send it to you via DM after cleaning things up, leaving the barebone so you dont have to scavenge through the whole thing. The base art doesn't belong to me, so I cant make it public.

  • Big Ups 1
Link to comment
Share on other sites

On 10/8/2023 at 5:43 PM, LowFatBananamil said:

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 :)

can i bump my question like this? :>

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...