Jump to content

What makes pigmen wear hats?


Recommended Posts

What causes pigmen to wear hats that you give to them? Looking in the prefab file I have determined:

  1. When Pigman is created his "hat" AnimState is hidden
  2. Pigman has an inventory component
  3. When an item that is equippable on the head is handed to the Pigman, he equips said hat in the head slot of his inventory
  4. After the hat is equiped, his "hat" AnimState is shown.

What I can't figure out is what the "hat" animstate even is. I tried using Krane to decompile the pigman anim into a spriter project and i see nothing in at all called "hat" and I can't find anything in the prefab file or anywhere else that would determine where the hat gets drawn. Like how does it know where the pig's head is and to draw the hat on top of that? I'm lost.

Edited by HomShaBom
Link to comment
Share on other sites

On 6/10/2016 at 10:06 PM, HomShaBom said:

What causes pigmen to wear hats that you give to them? Looking in the prefab file I have determined:

  1. When Pigman is created his "hat" AnimState is hidden
  2. Pigman has an inventory component
  3. When an item that is equippable on the head is handed to the Pigman, he equips said hat in the head slot of his inventory
  4. After the hat is equiped, his "hat" AnimState is shown.

What I can't figure out is what the "hat" animstate even is. I tried using Krane to decompile the pigman anim into a spriter project and i see nothing in at all called "hat" and I can't find anything in the prefab file or anywhere else that would determine where the hat gets drawn. Like how does it know where the pig's head is and to draw the hat on top of that? I'm lost.

are you trying to make a hat using pigmen animation files? or are you just trying to make a hat, or just trying to understand the code?

Edited by mf99k
Link to comment
Share on other sites

@HomShaBom "HAT" is a symbol. When you make the spriter project, you'll see that next to the project file it has several folders for images-- the symbol names come from these folders. These may not generate when decompiling because it doesn't have an image to put there, as the symbol will need to have another build's symbol (the hat's build) overridden into it. As for how to create it... I think you could get away with starting out with a hat image, doing an animation with that image, and then replacing the image file it with a blank/completely transparent image of the same size. The project should still reference it and include it in its animations, and then you can override other hats into the symbol for it. This might take some iteration as I'm not sure there's a good way to get the size/location of the hat images in their own builds.

That being said... this is kind of beyond my expertise, as I mostly stick to code. But hopefully that gets you on a path to learn more about it yourself. You might also want to check the single-player mod forums, they have a much larger collection of threads/guides about doing art, since it hasn't really changed in DST, such as this one.

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