Jump to content

I need help with a custom clothing item


Recommended Posts

I am currently thinking to add a character who has a certain clothing item he can't take off.

The clothing item in question is a hoodie that:

  • Provides some insulation
  • can't be taken off (the player should spawn/respawn with it, too)
  • gives some dapperness (not much though)
  • adds some extra slots to the player's inventory (about 5)
  • can be upgraded with another item so it has 10 slots extra instead and slightly changes what the item looks like
  • allows you to put on the hood (it will fill the head slot with a "hood" item that gives extra rain protection and maybe some overheating protection)

Now, I know pretty much nothing of programming, so I use templates... but I couldn't find custom clothing items.

I don't really know where to start, other than that I'll have to create a custom prefab, that's all.:wilson_dilemma:
The items necessary to upgrade it should be a craftable item with tier 1 science (science machine) that needs to be "used" (like with Spider Glands) which will add the extra slots to the clothing item.

Also my custom character should be the only one capable of crafting the upgrade item.

Now I know the item may sound a bit overpowered, but I might have to nerf it. I think it'll be quite a handicap actually, because the vests are no longer wearable and the character is never able to be completely capable of stopping rain without an umbrella or an eyebrella.

On top of that, summer might be annoying because of the insulation and not being able to wear floral shirts.

Thanks for whoever decides to give me a hand with this, I'm extremely thankfull. :wilson_love:

Have fun and...

Don't starve... :wilson_wink:

Link to comment
Share on other sites

Well met!

Insulation and dapperness are so-called components, which means that you only need to copy a few lines from another item (for instance: data/scripts/prefabs/sweatervest.lua)

The extra slots you can probably just copy from the backpack, but be mindful that DST and DS base handle this very differently.

For the upgrade, you could make a different prefab (item type) or let the existing prefab remember if it's upgraded using OnSave and OnLoad functions. If you want to detect or test for the hoodie's upgrade state, making a new prefab is better, if you want to detect or test for the hoodie in general, the latter option is recommendable.

Oh, and the actual upgrade could be done like with chester upgrades, how about that?

About not being able to take it off... Maybe the hoodie could simply force-reequip itself when unequipped, but that could cause problems with other things that do this.

For being able to put the hood on, use the "useableitem" component. The bushhat demonstrates this, although in a rather different way.

This is probably not detailed enough, but hopefully it will get you going. You can mention people using @name if needed.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...