• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Max Value which has subordinate random values.[Solved]

M

Meikel

Guest
Hello Guys ;),

I want to make a program code who allows to make a maximum value for subordinate random values.
I don't know how to explain it so i have here a example.
value.png
The subordinate random values should result 10 at least. (10 is the max value).(10 should be changeable).
Thx for the respond.
sry for my bad english hehe :).

Meikel.
 
Last edited by a moderator:

jo-thijs

Member
Hello Guys ;),

I want to make a program code who allows to make a maximum value for subordinate random values.
I don't know how to explain it so i have here a example.
View attachment 10382
The subordinate random values should result 10 at least. (10 is the max value).(10 should be changeable).
Thx for the respond.
sry for my bad english hehe :).

Meikel.
Hi and welcome to the GMC!

If you're maximum value is maxVal and the sum of all the previous subordinate values is sumVal,
then you can just create a new subordinal value: irandom_range(1, maxVal - sumVal)
 
M

Meikel

Guest
Hi and welcome to the GMC!

If you're maximum value is maxVal and the sum of all the previous subordinate values is sumVal,
then you can just create a new subordinal value: irandom_range(1, maxVal - sumVal)
Thank you.<3
 
Top