Jump to content

Hat AnimState, how is it made?


Somnei

Recommended Posts

I want to make an animation so that my custom prefab may wear hats, and looking through pig mens' spriter projects don't really give any clue on how to do this.

I'm thinking that it might be possible to simply add an animation to the existing spriter project of my prefab using any hat, and making the hat transparent before compiling it - would that work? And in that case, what would I name that animation? Just Hat?

I really don't understand what's what when it comes to compiling the animation zips, so any help is appreciated!

Thanks!

Link to comment
Share on other sites

@SophieTheDog, what you need to do is create a folder called "swap_hat" inside your scml project folder. Use a picture inside there and add it to the animation. I did this for the first time so I don't know how exactly you should handle it as far as aspect ratio, pivots, etc. goes. So you will have to play around with it a bit yourself. What you will also need to find out is how to properly deal with Two- or FourSided prefabs. But you know the basics now.

 

I uploaded a sample mod here. Good luck!

Link to comment
Share on other sites

@SophieTheDog, what you need to do is create a folder called "swap_hat" inside your scml project folder. Use a picture inside there and add it to the animation. I did this for the first time so I don't know how exactly you should handle it as far as aspect ratio, pivots, etc. goes. So you will have to play around with it a bit yourself. What you will also need to find out is how to properly deal with Two- or FourSided prefabs. But you know the basics now.

I uploaded a sample mod here. Good luck!

Wow, thank you Malacath, this made my day! ;;___;; <3

Link to comment
Share on other sites

@SophieTheDog, what you need to do is create a folder called "swap_hat" inside your scml project folder. Use a picture inside there and add it to the animation. I did this for the first time so I don't know how exactly you should handle it as far as aspect ratio, pivots, etc. goes. So you will have to play around with it a bit yourself. What you will also need to find out is how to properly deal with Two- or FourSided prefabs. But you know the basics now.

 

I uploaded a sample mod here. Good luck!

Toyed around a bit with this now, and it totally works! I've encountered some errors, though. I moved the hat with every frame on the atk_down animation of my prefab, but in-game the hat doesn't move at all - like it's frozen on the first frame or something.

And the atk_side hat doesn't show up at all, despite having the hat on every single frame.

Not really sure why this happens x:

Edit: Might have solved it, I really hope I have...

Link to comment
Share on other sites

@Malacath, alright, since I'm super new to Spriter I'm getting a "bug" where all the hats in my animation sort of stay for the whole duration of it, sort of making it look like that old windows xp lag glitch where your window would make a trail of lag all over your screen if you moved it. I'm guessing it has something to do with my skill at Spriter, but not really sure what I've done.

Right now I am dragging my swap_hat.png from the palette onto the sprite on each frame, is there another way?

Edit: And yeah, atk_side still doesn't work even though I redid it from scratch x:

spider_build.zip

Link to comment
Share on other sites

@SophieTheDog, yes, of course you shouldn't drag the image there every frame. You put the image in the first frame and then move it each frame. If you do the animation with an already completely transparent image then that is difficult since you can't select it in Spriter. Then you need to select the image on the left and change the coordinates manually, which is just hell if you ask me..

 

You can create a completely black image though, do all the animation and when you're done you simply change the png to be completely transparent before converting the project.

Link to comment
Share on other sites

@Malacath,

Yeah, but if I place the image only on the first frame I cannot move it on the other frames because it's not there. s: So what do I do then?

Still, that's not the main issue. I got the same error as before, everything is invisible again xx:

Not sure what's going on, the compiler clearly zips the files properly and everything. And even when it works, it's not displaying the atk_side and some other animations.

Link to comment
Share on other sites

Yeah, but if I place the image only on the first frame I cannot move it on the other frames because it's not there. s: So what do I do then?

I literally just explained what to do about this.

 

Still, that's not the main issue. I got the same error as before, everything is invisible again xx: Not sure what's going on, the compiler clearly zips the files properly and everything. And even when it works, it's not displaying the atk_side and some other animations.

And I can't help you with this unless you upload your project, I do not have the time myself to create a nice test case.

Link to comment
Share on other sites

@Malacath,

And I explained why that didn't work, you told me to place it on the first frame and then move it each frame. I understand how this works, it's just like animating anything else. What I said was that if I place it on the first frame, it is only visible on this frame. If I press the next frame, the entity is not there. Which means the only thing I can do is drag a new one into that frame, unless there is another solution which I don't know about (which is why I asked). Sorry for explaining poorly ;;___;;

Also uploaded it, but I'll upload it again, this time with the one that doesn't work at all. Thank you, and sorry for wasting your time!

spiderchan_build.zip

Link to comment
Share on other sites

@SophieTheDog, if you went with the solution I gave earlier then the "swap_hat" image is completely transparent. If it isn't then we are misunderstanding each other here. If it is then most likely it's not gone the next frame, you simply can't select it since, naturally, you can't click on something invisible. Thus you should make the image completely black, do the animation and then make the image transparent. That is also what I wrote two posts earlier.

 

EDIT:

Also having the bin is making it complicated for me since I first need to decompile it and even setup the prefab and a mod-folder and etc...

It's easier to have the whole mod from you, otherwise I get pretty discouraged to help you since I need to invest a lot of time.
Anyway I checked the anim and I see that for the animations there is a swap_hat_1 image that stays for all frames, so nothing disappears. When I have the time I can try to check if I get the side animations working.

 

Link to comment
Share on other sites

it is then most likely it's not gone the next frame, you simply can't select it since, naturally, you can't click on something invisible. Thus you sho

It is not transparent, I just didn't mention it because I thought you'd assume I had read your message. The swap_hat has a black dot so that I can see it. It's just not appearing in the hierarchy/z-order to the left, nor on the actual panel after I switch frames.

Link to comment
Share on other sites

It is not transparent, I just didn't mention it because I thought you'd assume I had read your message. The swap_hat has a black dot so that I can see it. It's just not appearing in the hierarchy/z-order to the left, nor on the actual panel after I switch frames.

 

See my edited post above.

Link to comment
Share on other sites

@SophieTheDog, if you went with the solution I gave earlier then the "swap_hat" image is completely transparent. If it isn't then we are misunderstanding each other here. If it is then most likely it's not gone the next frame, you simply can't select it since, naturally, you can't click on something invisible. Thus you should make the image completely black, do the animation and then make the image transparent. That is also what I wrote two posts earlier.

 

EDIT:

Also having the bin is making it complicated for me since I first need to decompile it and even setup the prefab and a mod-folder and etc...

It's easier to have the whole mod from you, otherwise I get pretty discouraged to help you since I need to invest a lot of time.

Anyway I checked the anim and I see that for the animations there is a swap_hat_1 image that stays for all frames, so nothing disappears. When I have the time I can try to check if I get the side animations working.

Sorry, mate.

Here: http://forums.kleientertainment.com/files/file/1045-for-malacath/

Not sure why it works for you but not for me x: Probably something in my code then? My prefab is taking files from two different zips, maybe that's the cause?

Link to comment
Share on other sites

Sorry, mate.

Here: http://forums.kleientertainment.com/files/file/1045-for-malacath/

Not sure why it works for you but not for me x: Probably something in my code then? My prefab is taking files from two different zips, maybe that's the cause?

Nice  :D

But you can just upload the file to any free file host like DropBox instead of here, or just attach it as a zip to the post you make. Possibly it could be confusing for others when they see it  ;P

I will take a look hopefully after dinner, else I'll check it tomorrow. But if you wanna remove that mod you can do, I downloaded it.

Link to comment
Share on other sites

Nice   :grin:

But you can just upload the file to any free file host like DropBox instead of here, or just attach it as a zip to the post you make. Possibly it could be confusing for others when they see it  ;P

I will take a look hopefully after dinner, else I'll check it tomorrow. But if you wanna remove that mod you can do, I downloaded it.

Haha, yeah. Thank you! I might try solving it until then, but I've already worked several hours non-stop so I'm pretty sure whatever error I'm making will go unnoticed by me ;D

Link to comment
Share on other sites

I just don't get it. I know the compiler is working, because it clearly outputs a zip-file and encounters no errors. I know my animations work, because I see them all properly inside Spriter. I know my mod is working, because if it didn't find the .zip it would crash (it has happened before), so I don't know why it's not displaying properly and it's making me so sad ;;___;;

I renamed the .scml-file and therefore changed the build-name to what the new zipfiles name was. I figured it not displaying properly might be because it used the original .zip from the data folder of the game, but it's just not working ss:

Edit: Had a friend recompile it for me, which resulted in the same thing I had before - the hats show up, but some animations do not display the hat such as the taunt animation (and cower, and eat). Plus the fact that I have five million hats showing during the course of an animation haha

Link to comment
Share on other sites

@SophieTheDog, I thought you meant that the swap_hat image disappears after one frame. What it does is disappear at the next keyframe. This is because for some reason when dragging in the image it will only create a reference to that image up to the most recent keyframe. You can see this by opening the .scml in a text editor and see lines like this 

<entity id="0" name="spider">        <animation id="0" name="atk_down" length="1100" interval="100">            <mainline>                <key id="0">                    <object_ref id="0" timeline="13" key="0" z_index="0"/>                    <object_ref id="1" timeline="12" key="0" z_index="1"/>                    <object_ref id="2" timeline="11" key="0" z_index="2"/>                    <object_ref id="3" timeline="10" key="0" z_index="3"/>                    <object_ref id="4" timeline="9" key="0" z_index="4"/>                    <object_ref id="5" timeline="8" key="0" z_index="5"/>                    <object_ref id="6" timeline="7" key="0" z_index="6"/>                    <object_ref id="7" timeline="6" key="0" z_index="7"/>                    <object_ref id="8" timeline="5" key="0" z_index="8"/>                    <object_ref id="9" timeline="4" key="0" z_index="9"/>                    <object_ref id="10" timeline="3" key="0" z_index="10"/>                    <object_ref id="11" timeline="2" key="0" z_index="11"/>                    <object_ref id="12" timeline="1" key="0" z_index="12"/>                    <object_ref id="13" timeline="0" key="0" z_index="13"/>                    <object_ref id="14" timeline="14" key="0" z_index="14"/>                </key>                <key id="1" time="34">                    <object_ref id="0" timeline="13" key="1" z_index="0"/>                    <object_ref id="1" timeline="12" key="1" z_index="1"/>                    <object_ref id="2" timeline="11" key="1" z_index="2"/>                    <object_ref id="3" timeline="10" key="1" z_index="3"/>                    <object_ref id="4" timeline="9" key="1" z_index="4"/>                    <object_ref id="5" timeline="8" key="1" z_index="5"/>                    <object_ref id="6" timeline="7" key="1" z_index="6"/>                    <object_ref id="7" timeline="6" key="1" z_index="7"/>                    <object_ref id="8" timeline="5" key="1" z_index="8"/>                    <object_ref id="9" timeline="4" key="1" z_index="9"/>                    <object_ref id="10" timeline="3" key="1" z_index="10"/>                    <object_ref id="11" timeline="2" key="1" z_index="11"/>                    <object_ref id="12" timeline="1" key="1" z_index="12"/>                    <object_ref id="13" timeline="0" key="1" z_index="13"/>                </key>

The opject with id="14" is the swap_hat image I inserted in frame 1. You see that on the next keyframe its reference is missing. So what you can do is copy the line that creates the reference to object "14" into each other keyframe. This is extremely tedious though and I wish there was another way. Since I'm not an animator I have next to no experience with Spriter though, so maybe there is a workaround to it.

You see this trail of hats in Don't Starve because, I suppose, the compiler does not care about the references to each keyframe. So while the image is blended out in Spriter it still has information of it's position and rotation stored which the compiler uses and simply carries over to the coming frames. Something like that at least...  I'm sorry I can't help you more here  : /

 

@Irontaco, do you know what is the deal here? You can download the attached file to see for yourself. When dragging any image in on any frame it will only be persistent until the next keyframe and I have no clue why Spriter does this. Is there a way to avoid it, other than editing the .scml in a text editor?

Link to comment
Share on other sites

@SophieTheDog, I thought you meant that the swap_hat image disappears after one frame. What it does is disappear at the next keyframe. This is because for some reason when dragging in the image it will only create a reference to that image up to the most recent keyframe. You can see this by opening the .scml in a text editor and see lines like this 

<entity id="0" name="spider">        <animation id="0" name="atk_down" length="1100" interval="100">            <mainline>                <key id="0">                    <object_ref id="0" timeline="13" key="0" z_index="0"/>                    <object_ref id="1" timeline="12" key="0" z_index="1"/>                    <object_ref id="2" timeline="11" key="0" z_index="2"/>                    <object_ref id="3" timeline="10" key="0" z_index="3"/>                    <object_ref id="4" timeline="9" key="0" z_index="4"/>                    <object_ref id="5" timeline="8" key="0" z_index="5"/>                    <object_ref id="6" timeline="7" key="0" z_index="6"/>                    <object_ref id="7" timeline="6" key="0" z_index="7"/>                    <object_ref id="8" timeline="5" key="0" z_index="8"/>                    <object_ref id="9" timeline="4" key="0" z_index="9"/>                    <object_ref id="10" timeline="3" key="0" z_index="10"/>                    <object_ref id="11" timeline="2" key="0" z_index="11"/>                    <object_ref id="12" timeline="1" key="0" z_index="12"/>                    <object_ref id="13" timeline="0" key="0" z_index="13"/>                    <object_ref id="14" timeline="14" key="0" z_index="14"/>                </key>                <key id="1" time="34">                    <object_ref id="0" timeline="13" key="1" z_index="0"/>                    <object_ref id="1" timeline="12" key="1" z_index="1"/>                    <object_ref id="2" timeline="11" key="1" z_index="2"/>                    <object_ref id="3" timeline="10" key="1" z_index="3"/>                    <object_ref id="4" timeline="9" key="1" z_index="4"/>                    <object_ref id="5" timeline="8" key="1" z_index="5"/>                    <object_ref id="6" timeline="7" key="1" z_index="6"/>                    <object_ref id="7" timeline="6" key="1" z_index="7"/>                    <object_ref id="8" timeline="5" key="1" z_index="8"/>                    <object_ref id="9" timeline="4" key="1" z_index="9"/>                    <object_ref id="10" timeline="3" key="1" z_index="10"/>                    <object_ref id="11" timeline="2" key="1" z_index="11"/>                    <object_ref id="12" timeline="1" key="1" z_index="12"/>                    <object_ref id="13" timeline="0" key="1" z_index="13"/>                </key>

The opject with id="14" is the swap_hat image I inserted in frame 1. You see that on the next keyframe its reference is missing. So what you can do is copy the line that creates the reference to object "14" into each other keyframe. This is extremely tedious though and I wish there was another way. Since I'm not an animator I have next to no experience with Spriter though, so maybe there is a workaround to it.

You see this trail of hats in Don't Starve because, I suppose, the compiler does not care about the references to each keyframe. So while the image is blended out in Spriter it still has information of it's position and rotation stored which the compiler uses and simply carries over to the coming frames. Something like that at least...  I'm sorry I can't help you more here  : /

 

@Irontaco, do you know what is the deal here? You can download the attached file to see for yourself. When dragging any image in on any frame it will only be persistent until the next keyframe and I have no clue why Spriter does this. Is there a way to avoid it, other than editing the .scml in a text editor?

 

It's alright, thank you for trying! I would be really happy if this was my biggest problem, though. Right now it works (although with the duplicated images on each frame) if I get a friend to compile it for me - but as soon as I've run the game a couple of times it stops working. I've not had this issue with any other custom .zip so I'm really clueless as to why this happens now. Recompiling it myself and replacing the original zip does nothing to help, as proven yesterday.

Also, some animation are still not visible despite doing the exact same thing in the spriter .scml to them as any other animation. Yesterday, when my friend compiled it, atk_side showed up for the first time, but taunt or eat did not. And it stopped displaying after half an hour or so, after creating a new game or reloading my old one.

 

Edit: If I replace my existing zip with the one he compiled yesterday it still doesn't work despite working then.

Link to comment
Share on other sites

When dragging any image in on any frame it will only be persistent until the next keyframe and I have no clue why Spriter does this. Is there a way to avoid it, other than editing the .scml in a text editor?

 

Use copy then paste to all keys

 

 

It's alright, thank you for trying! I would be really happy if this was my biggest problem, though. Right now it works (although with the duplicated images on each frame) if I get a friend to compile it for me - but as soon as I've run the game a couple of times it stops working. I've not had this issue with any other custom .zip so I'm really clueless as to why this happens now. Recompiling it myself and replacing the original zip does nothing to help, as proven yesterday.

Also, some animation are still not visible despite doing the exact same thing in the spriter .scml to them as any other animation. Yesterday, when my friend compiled it, atk_side showed up for the first time, but taunt or eat did not. And it stopped displaying after half an hour or so, after creating a new game or reloading my old one.

 

Edit: If I replace my existing zip with the one he compiled yesterday it still doesn't work despite working then.

 

How are you testing the animations ingame? It might be stategraph issue that causes them not to show.

 

There's nothing else I can provide without seeing the exact project in question, sorry.

Link to comment
Share on other sites

Use copy then paste to all keys

Does that really create a reference to the already existing object? I would suspect it only creates a copy of that object, which would still yield the same problem.

 

@SophieTheDog, same thing as DeathDisciple says, without seeing the project we can't really do anything. That said I didn't experience the problem with the project you uploaded a few days ago. Are you sure you are not modyfing the smcl? You know that everytime you start the game the scml gets recompiled if it was changed since last time?

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