Building a random model generator - multiple packs, one entity

Hey! :merry:

I’m working on a statue mod. I already have all the basic parts and the generator works. But I’m trying to solve a problem with “choosing from multiple part packs”. To give an example, there are separate pieces for the body, hair and hands. The generator works well, combining them randomly. But I want the statues to be both depicting males and females, but their parts won’t mix well. So I’m wondering, how would I have one entity, where it would choose from either the male or the female pack and then from the possible pieces? I tried various combinations of the code, but it either did not switch or flat out broke the thing.

I’ll be able to upload my JSON in a few hours if somebody wants to see. I’m just wondering if someone has tried/solved this yet.

Well you can ofc cheat and have two random entities with one recipe. (might also aid in testing)

That’s the plan if crisis hits. I don’t want to have two things in the building editor though. That would cause tons of chaos.

Shit hadn’t thought of that. In that case, Bruno will know XD

could you just make two recipes, one for male and one for female?

Awww that makes me think you could build statues for fallen hearthlings. If it can choose amongst all of the customization options, but then would you also be able to set poses as options as well?

I could, but I don’t want to :stuck_out_tongue: If I don’t find a way of how set this in the generator, then I’m going to do that.

Wow, that would be cool. But that also sounds like LUA. No bueno :joy:

2 Likes

No worries, Rayya knows I don’t do any modding so just figured I’d throw it out there

1 Like

I’m not entirely clear on what the topic is(I’m sleepy, brain drain from all the code the past week)
Are you making a recipe for a statue that you want to randomly be one of two variants?

Not that simple. Each statue has three parts which have a lot of variants. I need something to randomly switch between two packs of parts. Imagine something like having multiple models of a tree for each season, where the leaves would be a one_of and the trunk would be a one_of, plus instead of default and winter it’s male and female. The problem is, that I need these to be randomly chosen as well. If I wrote the code like that it would only react to the seasonal switcher afaik. To a one_of on that level it did not react. Inserting items {} into items {} did not work…

{
"mixins": "stonehearth:mixins:placed_object",
"type": "entity",
"components": {
  "model_variants": {
        "default": {
			"type": "one_of",
            "models": [
                {
               "type": "one_of",
               "items": [
							
                 "file(m_body/m_body_1.qb)",
                 "file(m_body/m_body_2.qb)",
                 "file(m_body/m_body_3.qb)",
                 "file(m_body/m_body_4.qb)",
                 "file(m_body/m_body_5.qb)",
                 "file(m_body/m_body_6.qb)",

              ]
           },
           {
              "type": "one_of",
              "items": [
                 "file(m_hair/m_hair_1.qb)",
                 "file(m_hair/m_hair_2.qb)",
                 "file(m_hair/m_hair_3.qb)",
                 "file(m_hair/m_hair_4.qb)",
                 "file(m_hair/m_hair_5.qb)",


              ]
           },   
           {
              "type": "one_of",
              "items": [
                 "file(hands/hands_1.qb)",
                 "file(hands/hands_2.qb)",
                 "file(hands/hands_3.qb)",
                 "file(hands/hands_4.qb)",
                 "file(hands/hands_5.qb)",
                 "file(hands/hands_6.qb)",
                 "file(hands/hands_7.qb)",
                 "file(hands/hands_8.qb)",
                 "file(hands/hands_9.qb)",
                 "file(hands/hands_10.qb)",
                 "file(hands/hands_11.qb)",


              ]
           },  
		],
		
            "models": [
                {
               "type": "one_of",
               "items": [
								
                 "file(f_body/f_body_1.qb)",
                 "file(f_body/f_body_2.qb)",
                 "file(f_body/f_body_3.qb)",
                 "file(f_body/f_body_4.qb)",
                 "file(f_body/f_body_5.qb)",
                 "file(f_body/f_body_6.qb)",

              ]
           },
           {
              "type": "one_of",
              "items": [
                 "file(f_hair/f_hair_1.qb)",
                 "file(f_hair/f_hair_2.qb)",
                 "file(f_hair/f_hair_3.qb)",
                 "file(f_hair/f_hair_4.qb)",
                 "file(f_hair/f_hair_5.qb)",
                 "file(f_hair/f_hair_6.qb)",
                 "file(f_hair/f_hair_7.qb)",
                 "file(f_hair/f_hair_8.qb)",
				 
              ]
           },   
           {
              "type": "one_of",
              "items": [
                 "file(hands/hands_1.qb)",
                 "file(hands/hands_2.qb)",
                 "file(hands/hands_3.qb)",
                 "file(hands/hands_4.qb)",
                 "file(hands/hands_5.qb)",
                 "file(hands/hands_6.qb)",
                 "file(hands/hands_7.qb)",
                 "file(hands/hands_8.qb)",
                 "file(hands/hands_9.qb)",
                 "file(hands/hands_10.qb)",
                 "file(hands/hands_11.qb)",


              ]
           },  
        ]	
	  } 
	},
	"render_info": {
		"scale": 0.12
	},
	"mob": {

		"model_origin": {
			"x": 0,
			"y": 0,
			"z": 0
		},
		"region_origin": {
			"x": 0.5,
			"y": 0,
			"z": 0.5
		},
	}
},
"entity_data": {
	"stonehearth:catalog": {
		"display_name": "Tall Tree",
		"description": "This used to be an important person.",
		"icon": "file(statue.png)",
		"category": "decorations",
		"material_tags": ["decoration", "stockpile_decoration"]
	}
}

}

3 Likes

Ooooh man
That mod… You’re going to love one of the new things in 0.9.3 :stuck_out_tongue:

1 Like

Does it have to do something with marble? XD

1 Like

Yes :smiley:

Let’s just say that random statues and that feature can be combined in a very nice way with a simple json mixinto :smiley:

(so your mod can be super compatible with ACE in a cool way)

1 Like

Lol, I’m absolutely gonna try that… after I figure this out :joy:

1 Like

I’ll PM you with some hot info XD

3 Likes

OMG I’VE ACCIDENTALLY FIXED IT. Thanks for your participation everyone :joy:

No… wait… I did not… FFFffff

2 Likes