Starbound

Starbound

Starbound Workshop
Is something missing from your Starbound Universe? Maybe you'll find it here amongst the wonderful user created mods, or maybe you'll make it yourself!
Learn More
Hemiptera 2 Aug, 2024 @ 7:23am
Animated Farmables?
Hello!
I've struggled for awhile trying to figure out how to make plant/object farmables that haveactive animations for each growth stage but unfortunately my "copy, paste, and mishmash other vanilla objects' code to make new stuff" approach is insufficient to the task.

Currently, farmable objects are set to read their sprite sheet frames as one frame per growth stage and I haven't been able to figure out how to change it to be an entire animation sequence per growth stage.

Has anyone made or seen animated farmable objects (multiple frames per growth stage) before? Any advice?

Thanks!
< >
Showing 1-10 of 10 comments
projectmayhem 82 2 Aug, 2024 @ 12:35pm 
Using Automato as an example....

"orientations" : [
{
"dualImage" : "automatoseed.png:<color>.<stage>.<alt>",
"imagePosition" : [0, 0],
"frames" : 1,
"animationCycle" : 0.5,

"spaces" : [ [1, 0], [0, 0], [1, 1], [0, 1], [1, 2], [0, 2], [1, 3], [0, 3] ],
"requireTilledAnchors" : false,
"anchors" : [ "bottom" ]

}
]

Change the number of frames to your desired frame count, but each stage will have that many frames in the animation. Then you will need to add <frame> into the dualImage somewhere like this....

"dualImage" : "automatoseed.png:<color>.<stage>.<alt>.<frame>",

Then you need to make sure your frame file is set accordingly to allow for the frames. If its animated, you probably dont care about alts, so wouldnt need "alts" in your stages.
projectmayhem 82 2 Aug, 2024 @ 12:53pm 
I made a sample plant using the Automato files and I was able to get it animated. So if you need more help, just let me know and I'll host the files somewhere so you can download them and look at how I did it
Hemiptera 3 Aug, 2024 @ 4:47pm 
Awesome! Thanks so much, I got it working!
I did have to adjust the frames in the frames file to "default.1.0.1" from "default.1.1". So I guess this means we have a .(number) in the frames file frames for each <> after "dualimage" in the object file? (sorry if this is obvious, I'm not a skilled programmer, and what little I do know is pretty much from modding/reverse engineering what I can figure out.)
What this gets me wondering is, given the order of the numbers, the "0" in "default.1.0.1" appears to be in the spot where the "alt" would be represented, so as long as I have a separate set of frames for each alt, I should still be able to use them, right? Though you're right in that the most important objects I've been trying to make probably don't need them. I've got my test object's alts set to "1" instead of the default "5" and it's working fine, so I'll probably leave them in in csae i want to use the object as a template for ones I do want alts on (already getting ideas on how I can use that...)

At any rate, thanks again- I can't believe how simple this was after trying for so long. Now I should finally be able to make my animated aquaponics fishtank!

If I were to apply this to the mothtrap, which has it's own custom animation file, would I just go into the animation file and wherever it says "image" : "<partImage>" I'd change it to "image" : "<partImage>.<frame>" and then add "frames" and "animationcycle" to each "part"?
projectmayhem 82 3 Aug, 2024 @ 5:21pm 
Yeah, sounds like you've explained it correctly. And yes, if you do extra images for the alts, you can do that. You could have the first alt with red flowers, second with blue, third with white and it would randomly pick one of those alts. Each one will also need its own animation, But sounds like you got it from here.

As far as the moth trap, Id take a look at a vanilla object that animates. I pulled up the human generator located at \objects\generators\humangenerator

In the object file it has
"image" : "humangenerator.png:<color>.<frame>",
"frames" : 1,
"animationCycle" : 1.0,

So you will need to add .<frame> in the moth trap object file after its image. And add a frames number for how many frames, and an animation cycle for how long it takes to cycle through. You will have to increase the size of the frame grid and add new rows/columns, do you understand frame files enough to increase the grid?

In the animation file you will need to add .<frame> to the end of the post's image
"post" : {
"properties" : {
"centered" : false,
"image" : "<partImage>:<stage>" <--- add .<frame>
},

Since you will have <stage>.<frame> you will also need to update the frame names from 1, 2, 3, 4. Let's say you have 3 frames in your animation, stage 1 frames would be 1.0,1.1,1.2,1.3 and the next stage would be 2.0,2.1,2.2,2.3

If you have any issues let me know and I'll mess around more with it. It's hard to explain it than it is to just do it and let you see an example.
Hemiptera 3 Aug, 2024 @ 5:41pm 
Thanks! Now that you've given me a general idea/direction, I'll try to fiddle with it and see if I can get it to work this time around. Changing grid sizes/layouts for frames files won't be an issue, thanks for checking though. :)

Once again, I really appreciate your help. Thanks again!
Hemiptera 5 Aug, 2024 @ 11:23am 
(Some time later...)
Whew! Well, it took some doing, but thanks to your direction/hints/instruction I finally managed to do two thing that'v I've wanted to for a long time:
---Animated farmables, including the mothtrap-type objects (the crop-type objects were much simpler 'cause they didn't have their own animation file. The mothtrap took a lot of fiddling, but I finally got it to animate through it stages while in the "on" state).
---Animated objects in "off" state. I can now have switch-type objects have seperate animations for both the "on" state and "off" state! I initially tried it with the mothtrap, but it was only a partial success- something about the farmables lua caused it to be unable to update stages properly or something. I might go back to it and try again later, 'cause I think it may be useful to be able to do. But for now, I'm pretty excited with what I've got working.

Just thought I'd give you an update. Thanks again!
projectmayhem 82 5 Aug, 2024 @ 4:05pm 
Awesome! Do you plan on releasing everything as a mod, or just something you made for personal use?
Hemiptera 6 Aug, 2024 @ 2:51pm 
It all started with me adding some custom monsters, and then I'm like "Oh, let's add some objects too!" and then it went on to "more objects, more monsters, some NPCs, and NPC races!" and kinda keeps ballooning out from there.
I'd like to release a mod at some point, but it'll probably be awhile before I can get around to finishing and polishing all the stuff I keep adding in. >_<
projectmayhem 82 7 Aug, 2024 @ 12:25pm 
I look forward to seeing it!
Hemiptera 7 Aug, 2024 @ 2:10pm 
:)
< >
Showing 1-10 of 10 comments
Per page: 1530 50