Jump to content

Prefabs invisible while outside of inventory


Recommended Posts

I've done everything I can think of and yet it still doesn't work. The strawberries, dug strawberry bushes, and strawberry bushes are all invisible while outside of the inventory and I don't know why. The art was drawn right over the atlas-0's of the items these are based on so I don't think that's the problem. Any help would be much appreciated.

More Fruits.zip

Link to comment
Share on other sites

In strawbbit :


		inst.AnimState:SetBank(name)
		inst.AnimState:SetBuild(name)

In dug_strawbb :


		inst.AnimState:SetBank(data.bank or data.name)
		inst.AnimState:SetBuild(data.build or data.name)

When you use an existing file as a base, you have 3 files. Anim, tex, build. You could change the tex and rename the build (did you did this ?), but you can't change the anim (except when recompiling with spriter). So you need to specify to the game "i'm using anim for berry bush and my custom build", here in the two cases anims aren't right so the game can't figure what is going on.

In strawbb :


        inst.AnimState:SetBank("berrybush")
        inst.AnimState:SetBuild(name)

This should be right... Except if you didn't rename the build ?

Link to comment
Share on other sites

1 hour ago, Eusong said:

Shouldn't that work for all the places it says name?

Maybe but it doesn't solve the problem, because you need to put specifics informations at theses place. I'll take an example. One of my old mod add an armor to the game. Since i didn't know anything about spriter, i did the same thing you did : i took the atlas of an existing file, draw something new and make my own prefab.

This is how the bank/build look :


    inst.AnimState:SetBank("armor_wood")
    inst.AnimState:SetBuild("warg_coat")
    inst.AnimState:PlayAnimation("anim")

Bank should be the original file you used as a template. So in your case, something like berries (if you use the berries file), berriebush (like you did in strawbb), and i don't know the anim name for the dug part but i guess you know what file you used as template.

In my case it was "armor_wood" because it was the anim file related to the build i used.


Build should be your custom build : the tex file you modified and the related build. For this, you need the tex file and the build file, and you need to rename the build file. In my case, it's "warg_coat". In your case, it should be " strawbb" for the bush, and "strawbbit" for the fruit. And i don't know for the dug part, probably "strawbb" too, but not sure...


Anim you don't need to change.

 

So you can't just set "name = "strawbb" because the bank info can't be strawbb. Except if you use a tool for decompiling berrybush anim, use spriter to rename the file, and recompile it, but it's a little too much to learn when you start modding.

Link to comment
Share on other sites

I GOT IT WORKIIIIIING.

strawberries.png

 

More Fruits - Unfinished.zip

 

All should work fine now. You will maybe have to modify a little the .tex because the strawberries are a little too high on the bush.

 

So, for sure the main problem was :

Your tex was too big. I guess you used a template from the pappfruit that LOOK LIKE the one of berrybush, but was twice as big. So i guess it was the main reason nothing was shown.

There were some others mistake, like name of bank/build in .lua file and maybe one build name in the anim.zip, but it should work now.

For information :

dug_strawbb


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

	    
		inst.AnimState:SetBank("berrybush")
		inst.AnimState:SetBuild("strawbb")
		inst.AnimState:PlayAnimation("dropped")

Because it's based on strawbb for the tex and build (just you know why the name isn't the same)

 

Can't garantee you'll have no prob, but let me know if something is still wrong. I can't promise i'll be able to do something (or i will want to, because it's exhausting :D ) but we'll see.

Also, you don't need the berrybush anim in your mod file, the game already have it so no need to add it.

 

Good luck.

Link to comment
Share on other sites

Hi Eusong :)
I already wrote at your mod at steam, but in case you have any questions, it might be better to write them here :)

It is about adding your new plants to the worldgeneration. I wrote:
 

Quote

@Eusong:
Adding new things to worldgeneration like you did might not be the best solutiuon, cause "distributeprefabs" values are relative to each other. So even if you adjusted the values by comparing all values of other things in that area, this can change with a game update.
In fact you are replacing other things, instead of only adding your stuff, so if values are too high, other things like trees will disappear.

So it might be better to implement the style I developed in my mod here:
http://steamcommunity.com/sharedfiles/filedetails/?id=758921911
My style does not replace other things in that area, like you code does, it adds new stuff.
I suggest, that you download it and take a look at the modworldgenmain.lua. At the top of it I included a explanation how my style works.
If you use my style, please add short credit to me by mentioning me in your code and your steam description.

 

Edited by Serpens
Link to comment
Share on other sites

I didn't know distributeprefabs could remove things but i guess it's also a way to keep a kind of balance in the world, without too many prefab and especially without too many food, so the problem is that you don't choose what you remove, but i think it's ok to add at least part of the prefab this way.

Link to comment
Share on other sites

5 minutes ago, Lumina said:

I didn't know distributeprefabs could remove things but i guess it's also a way to keep a kind of balance in the world, without too many prefab and especially without too many food, so the problem is that you don't choose what you remove, but i think it's ok to add at least part of the prefab this way.

problem is, that every author has to look up all other values used in this area, to make sure your own chosen values are in line with them.
But you can't know those values for every other mod-stuff.
The endresult when you play with 5 mods adding new stuff this way, you don't will see any normal trees or grass or other of the normal vegatation, because everything was replaced by mod-stuff.

Made a tutorial now :)

 

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