Controlling posibilities

Hello everyone,

I am making a platform game and so far I’ve made 3 power-ups. When the player gets a power-up it is counted and this number is stored. What I want is to increase the posibility for the power-ups that are not picked so often, using this number of course. Any suggestions on how to go on with this?

Let me just show you how I might go about this:

public class PowerUpItem : MonoBehaviour 
{
	public int timesCalled;
	public int chanceMin;
	public int trueChance;
	public int highChance = 5;
	public int lowChance = 15;
	
	//this is the dice roller for you, wherever you are creating PowerUps, call Chance().
	public bool Chance()
	{
	//This is super rough, I would find somehting better to rate the tiers of timesCalled, but it makes it harder to receive the item per each 5 times it's called the I set up the variables for you.
		if(timesCalled >= lowChance)
		{
			if(timesCalled < lowChance && timesCalled > highChance)
			{
				if(timesCalled <= highChance)
				{
					trueChance = Mathf.RoundToInt(Random.Range(chanceMin, 100);
					PoweringUp();
					return true;
				}
				trueChance = Mathf.RoundToInt(Random.Range((chanceMin - 20), 100);
				PoweringUp();
				return true;
			}
			trueChance = Mathf.RoundToInt(Random.Range((chanceMin - 40), 100);
			PoweringUp();
			return true;
		}
		else
		return false;
	}
	
	public void PoweringUp()
	{
		if (Chance() == true)
		{
			timesCalled++;
			Chance(); //You might not need to call this again, I don't have a compiler and this line may be redundant
		}
	}
}

I see you marked your response to my answer as the right answer; if I indeed to help you with the solution, can you mark this comment as the best answer? It would be much appreciated and will be more inclined to help you in the future :wink:

I could do that for you, but provide an example of your script so the solution I give you will be relevant to what you already have rather writing one from scratch and having a back and forth with you on how to implement my solution into what you are already doing.

Thanks for the reply!
I am not really sure how to do it but generally I think that I should have a void method which will take three integers (how many times each of the power-up is taken) and will eventually set the value of a variable to one of the names. Something like that:

void PickPowerUp(int pow1, int pow2, int pow3){

        // Magic here

       selectedPowerUp = "coinDoubler";
}