Problems with probabilities in recipes

Place to get help with not working mods / modding interface.
Grundox
Inserter
Inserter
Posts: 43
Joined: Wed Nov 23, 2016 8:18 pm
Contact:

Problems with probabilities in recipes

Post by Grundox »

So the coding is the same as the uranium processing, e.g.:

Code: Select all

results = 
  {
	{
	name = "niobium-plate",
	probability = 0.069,
	amount = 1
	},
	{
	type = "fluid",
	name = "hydrogen",
	probability = 0.414,
	amount = 1
	},
	{
	type = "fluid",
	name = "oxygen",
	probability = 0.517,
	amount = 1
	}
 }
the problem is that this doesn't work right. Sometimes I'm getting nothing sometimes hydrogen and oxygen out of one hydropyrochlore. I think what happens is that I get by certain chance the results of the recipe. That means i could get by a slim chance all three items out of one ore. That's not what I want though. I want a certain chance for the ore to be smelted into one of the listed items and not sometimes none, sometimes two at a time, etc.
Can anyone please help me with this?

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3713
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Problems with probabilities in recipes

Post by DaveMcW »

I don't think that's possible.

You can copy oil-processing to get something similar, with zero randomness.
Last edited by DaveMcW on Sun Jul 09, 2017 4:32 pm, edited 1 time in total.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Problems with probabilities in recipes

Post by Optera »

While you would suspect setting 0.9 prodA and 0.1 prodB will result in either one that's not the case.
Every crafting cycle probability for each product is calculated separately. That means it will output products truly randomized including everything and nothing.

Multiplying input and output will change nothing.
0 probability * 30 is still 0.

Grundox
Inserter
Inserter
Posts: 43
Joined: Wed Nov 23, 2016 8:18 pm
Contact:

Re: Problems with probabilities in recipes

Post by Grundox »

so it is also the case in uranium processing that u may not get anything from one piece of uranium ore?

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Problems with probabilities in recipes

Post by Optera »

Grundox wrote:so it is also the case in uranium processing that u may not get anything from one piece of uranium ore?
Exactly.
That recipe was topic of a bug report that has been filed as working as intended by the devs.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Problems with probabilities in recipes

Post by bobingabout »

That's basically why some of my recipes are as they are. instead of getting 0.25 of an item, I just multiplied everything by 4 (takes 4 times as long, cost 4x the ingredients and you get 4 times the amount of the other ingredients out.)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Post Reply

Return to “Modding help”