Random chance but with upgrades

Anyone know how to implement upgrading certain thing causes less random chance of it having


for example i want to have like security in my game the more player has securities the less they get raided. like i want i wanted to do it like this

|Security Formula Result (Chance %)|Explanation|
0: 0×8 = 50% High chance of robbery
1: 1×8 = 42% Slightly safer
2: 2×8 = 34% Safer
3: 3×8 = 26% Less chance
4: 4×8 = 18% Rare
5: 5×8 = 10% Very rare
6: 6×8 = 2% Almost never

I see 2 ways depending on how you wanna do it

Make variable call it Chance and set it to RandomInRange(100)
NOW

If Chance rolled something GRATER THAN 50 you succeed
If LESS THAN 50 you got robbed

SO what if you make another variable call it Bonus
And now you check if Chance is less than 50+Bonus
And bonus was set to 20
That means we are checking if Chance is less 70 which would mean you succeed and anything above 70 would get you robbed

So this is 70% to succeed and 30% to fail

So increasing bonus would give you better chance of success

Maybe you wanna go opposite?

Chance is less than 50-Bonus
So chance to succeed is 40% and chance to fail is 60%

And now you don’t need multiplier which is still possible but i say adding or subtracting another var makes it easier

That sounds all nice but if the player upgrades the security huh? like the chances yk?

So what is your problem?

You have 2 variables
Combination of both gives you %
Where you can manipulate them individually

The problem would be if the player bought all the securities that would mean it never does happen almost. Like the less they have securities the more likely they will be raided and the more securities they have the less they get raided

Security Formula Result
0 = 50% High chance of robbery
1 = 42% Slightly safer
2 = 34% Safer
3 = 26% Less chance
4 = 18% Rare
5 = 10% Very rare
6= 2% Almost never

I still don’t understand your problem

You mean you don’t have idea how decrease multiplier by times it was used?

Chance + (Bonus/4)
For sake of simplicity bonus is 12

So 12 / 4 = 3
You increase bonus to 20
So 20 / 4 = 5
If 40 then 40 / 4 = 10
Want me to go on?

BUT this is stupid
As well with each upgrade you could increase Bonus by 2
0
2
4
6
8
10
12
14

So At minimum you have 50% chance to get robbed at max you have 36% chance to get robbed

You could also increase it by 3 or 4

So like i said multiplier here is stupid
Its only matter of adding SOME number

And before you ask
You can totally go with price of Bonus to be 100 gold * Bonus
So if you increase it by 2
100 * 2 = 200
100 * 4 = 400
So up to 14 it would be 1400
Not good enough?

Bonus = Bonus * (100 * Bonus)
So 2 * (100 * 2) = 2 * 200 = 400
So 4 * (100 * 4) = 4 * 400 = 1600
I hope you get the idea by now
But then 14 * (100 * 14) = 14 * 1400 = 19600
If that is too much then

Bonus = (Bonus / 1.2) * (100 * Bonus)

I am not gonna write calculations here
A LOT of value manipulation you could shove in here
Where there is expression in gdevelop to power of value

pow(Bonus.Bonus)
IF bonus is 2 then its 2 * 2 = 4
If its 4 then 4 * 4 = 16
If its 16 then 16 * 16 = 256
Growing to fast?
Divide it by some fraction of Bonus

Again A LOT of ways you can manipulate values here