Jump to content

How do i create a custom cloth?


Recommended Posts

I'm making a character mod and i thought adding a custom cloth to the game would be fun.

So, i searched for the template for custom cloth. But, i couldn't find one.

Well I did actually find this one https://steamcommunity.com/sharedfiles/filedetails/?id=835602689&searchtext=api+modded but this is not exactly what i wanted.

I wanted to create something like floral shirt and garland, easily equipped without using wardrobe. But i guess i don't want them to have durability. 

Is there any template for clothes which match all of the condition?

Or is there a better option for me to do with? (like there is already an uploaded mod that gives you more clothes somehow?)

 

This is list of things that i want to make.

  • a dress. (covering torso and all of the lower body.)
  • a bonnet. (If it is complicated process, i can just switch this to big ribbon)

 

This option is necessary.

  • It should be equipped without wardrobe. (Just like floral shirt or garland)

 

This option is not that necessary...but it would be great if it is able.

  • Infinite durability. 
  • regenerating lost sanity.

 

Thanks a lot.

Link to comment
Share on other sites

I see nobody willing to help you saw this post so I can extend a helping hand.  My knowledge is limited that's why I am able to create custom torso- only item (for example something like chestplate) and some kind of headwear. Those items will take your equipment slot, just like straw hat or marble suit armor. If you are interested let me know. I will do my best to help you. Have a nice day/night of course.

 

Edited by Yakuzashi
Missclick
Link to comment
Share on other sites

Best way to add things is usually to look at existing items and try to copy them, modify things, and test. There should be a template for hat somewhere (but if i remember well, with some bugs to correct in one or two lines).

Let's say you want to do your own floral shirt. Floral shirt is hawaiianshirt.lua in script and look like this :

 

local assets =
{
    Asset("ANIM", "anim/torso_hawaiian.zip"),
}

local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_body", "torso_hawaiian", "swap_body")
end

local function onunequip(inst, owner) 
    owner.AnimState:ClearOverrideSymbol("swap_body")
end

local function create()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()

    inst.AnimState:SetBank("hawaiian_shirt")
    inst.AnimState:SetBuild("torso_hawaiian")
    inst.AnimState:PlayAnimation("anim")

    MakeInventoryPhysics(inst)

    inst:AddTag("show_spoilage")

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("inspectable")

    inst:AddComponent("inventoryitem")

    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.BODY
    inst.components.equippable.dapperness = TUNING.DAPPERNESS_MED
    inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)

    inst:AddComponent("perishable")
    inst.components.perishable:SetPerishTime(TUNING.HAWAIIANSHIRT_PERISHTIME)
    inst.components.perishable:StartPerishing()
    inst.components.perishable:SetOnPerishFn(inst.Remove)

    inst:AddComponent("insulator")
    inst.components.insulator:SetInsulation(TUNING.INSULATION_LARGE)
    inst.components.insulator:SetSummer()

    MakeHauntableLaunch(inst)

    return inst
end

return Prefab("hawaiianshirt", create, assets)

You could look at how it works, see other prefabs to see what changes, copy this file and change the prefab name to do your own version (i suggest to keep the same graphics at first so you change one thing at a time), adding a recipe (that will require no wardrobe or science machine for example, you can even make the recipe exclusive to your character). Then you can go further and remove the code related to perish so your item will have infinite durability, then make custom graphics. It's easier step by step, and if you'll probably need help for some of the step, looking at code and comparing different items is a great way to learn a lot about what is possible and how to do it.

Link to comment
Share on other sites

10 hours ago, Lumina said:

Best way to add things is usually to look at existing items and try to copy them, modify things, and test. There should be a template for hat somewhere (but if i remember well, with some bugs to correct in one or two lines).

Let's say you want to do your own floral shirt. Floral shirt is hawaiianshirt.lua in script and look like this :

 


local assets =
{
    Asset("ANIM", "anim/torso_hawaiian.zip"),
}

local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_body", "torso_hawaiian", "swap_body")
end

local function onunequip(inst, owner) 
    owner.AnimState:ClearOverrideSymbol("swap_body")
end

local function create()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()

    inst.AnimState:SetBank("hawaiian_shirt")
    inst.AnimState:SetBuild("torso_hawaiian")
    inst.AnimState:PlayAnimation("anim")

    MakeInventoryPhysics(inst)

    inst:AddTag("show_spoilage")

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("inspectable")

    inst:AddComponent("inventoryitem")

    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.BODY
    inst.components.equippable.dapperness = TUNING.DAPPERNESS_MED
    inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)

    inst:AddComponent("perishable")
    inst.components.perishable:SetPerishTime(TUNING.HAWAIIANSHIRT_PERISHTIME)
    inst.components.perishable:StartPerishing()
    inst.components.perishable:SetOnPerishFn(inst.Remove)

    inst:AddComponent("insulator")
    inst.components.insulator:SetInsulation(TUNING.INSULATION_LARGE)
    inst.components.insulator:SetSummer()

    MakeHauntableLaunch(inst)

    return inst
end

return Prefab("hawaiianshirt", create, assets)

You could look at how it works, see other prefabs to see what changes, copy this file and change the prefab name to do your own version (i suggest to keep the same graphics at first so you change one thing at a time), adding a recipe (that will require no wardrobe or science machine for example, you can even make the recipe exclusive to your character). Then you can go further and remove the code related to perish so your item will have infinite durability, then make custom graphics. It's easier step by step, and if you'll probably need help for some of the step, looking at code and comparing different items is a great way to learn a lot about what is possible and how to do it.

Thanks, then i will go find some code for the what i want and test them. And see if the error occurred. 

13 hours ago, Yakuzashi said:

I see nobody willing to help you saw this post so I can extend a helping hand.  My knowledge is limited that's why I am able to create custom torso- only item (for example something like chestplate) and some kind of headwear. Those items will take your equipment slot, just like straw hat or marble suit armor. If you are interested let me know. I will do my best to help you. Have a nice day/night of course.

 

I would appreciate your help! If you’re ok, we will see if the item can do torso and lowerbody cover. (First time, it was lacked of explainIng that i want it to have a puff shoulder...so i am pointing it out now.) Contract me if you want to join! Thanks!

Link to comment
Share on other sites

Hello. In order to modify in game appearance you have to put this folder (dress) in exported folder in your mod folder. After that you can edit images in subfolder called "swap_body".

It is not that thing you are expecting to get but it is pretty close to it.

   

dress.rar

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