I saw that the trees uses a model_variants-string to change the cq-file when placed on the map. Is this also useable for furniture-decorations? I want to add more diversity to my mod using this code i can add more different models to one single recipe.
But now to my question. A tree once placed can never been replaced on the map. When i add this code to a replaceable model will it change the cq-file every time i change the position?
i added only in the entity file the same code like used for the tree sampling. but the model wasnāt changed but instead he inserted both models sovraposed. this in the picture are two objects.
have i to do some changes also in the ghost file of the item? or what its wrong?
You should only have that model_variants json in the ghost.
If you add to the normal and ghost entities, you will have two models overlapping. You just didnāt noticed before because both models were the same. Now that you have random models, you end up with one from the normal and one from the ghost.
To clarify, everything you do in the ghost is added to the normal object. Thatās why you donāt need to duplicate code.
This is really neat - and, as always, Bruno provides some excellent help!
Youāve just given me some neat ideas, @pingu!
I hope pingu donāt mind, but I would like to expand upon their question.
Letās say Iām creating a chair for which I want:
5 different variants of legs
5 different variants of sitting-pads (or cushions)
5 different variants of backrest
@BrunoSupremo (or any one else), do you know if it is possible to set up three similar ārandom selectionsā between the 5 models for each respective part of my chair, and have them be combined into one model within Stonehearth (that will always remain as one item)? - or, do I have to create the 125 different models and have the āone_ofā selection been written between these 125 models?
While I may not be an expert on this, I donāt think the game is set up to handle āgroupsā of objects as a super-objects. So Iām quite sure youād have to do it the tedious way or at least make several of seemingly random combinations, but just avoid making all of them.
Iām curious if Iām mistaken on this though, so if so, please indulge me .
This is my fear, as well - Iām really hoping Iām incorrect though
Would āno super-objectsā be the case, I think there are work-arounds - however, I fear the only one I can think of would be way more resource-heavy than the tedious making of 125 variants
Amazing - your respons and provided examples are helpful as well as extremely appreciated, Bruno!
Now, I will have to completely re-make the base code of my own mod
Once again, from the bottom of my heart, thank you!
Keep in mind though that this takes effect when an item is created.
If you have a chair with multiple variations, and you want to build a hall with 10 blue chairs, you will have a hard time doing it, as your crafter will keep doing chairs in red, yellow, green, and other colors, randomly.
Oh, lol! Yes of course - the function you describe would be intended for what I have in mind; nevertheless, itās a good thing that you point it out! xD
Well, I feel dumb now. Of course it would work; as you pointed out, it already works with entities like hearthlings and npcs, which Iād say should actually be more complicated than static items.
Thank you ever so much for correcting my folly, Bruno .
Just an aesthetic problem. I noticed that when i want to change the position of the placed model the ghost image changes and doesnāt combine with the placed item.
Probably this problem has no solution but maybe someone knows how to prevent this
before you place a model on the map you see a ghost image of the model (the semi transparent one). after placing it the model changes. you donāt see the right model in the ghost-mode. The transparent one changes every time you change place.