This is partly a plea for help to make a mathematical algorithm rather than only Construct 2 based help. I always think from the wrong perspective when doing algorithms and end up making some really crazy stuff.

What im doing right now is a sort of event-rolling algorithm that i want to be able to change the outcomes % by just changing numbers. I'll try to explain the problem as good as i can:

Lets say i have 5 different levels of stuff that can happen, ranging from A,B,C,D,E. A being most common and E being extremely rare. And then make a roll to see which it becomes.

Initially the roll has like a 7/10 to become A and 2/10 to become B, and a 1/10 to become C. But then i add a sort of luck+1 factor, and suddenly A is 6/10, B is 3/10 and C is 1/10. If i add another +1 luck factor, A becomes 5/10, B becomes 3/10 and C becomes 2/10. Another +1 makes A 4/10, B 3/10, C 2/10 and D 1/10. And the more luck factors are put in, the bigger chance for a better outcome.

I did this initially with rolling a random 10, and A was 0-8, B was 9+, C was 13+, D was 16+ and so forth and so on. But i quickly realized this was an extremely flawed system, since if the luck factor became too high, the chance of it becoming A vanished completely which was something i didnt want.

So basicly what im trying to figure out is how to calculate the chances in a good scaleable way, so as that when the higher level letters chance increases, the lower chances becomes smaller, but never dissapears completely.

Also having specific luck factors to skew the results is also something i would like to have, like B-luck +2, which increases the chance of the B result by quite a bit, while only taking away % from letters that are already inside the chance scale.

I havent played around much with weighting chance factors like this before, so im sorry if its either too easy or too hard for people to help me figure this out ^^;; The only things that come up in my head is some sort of system that takes the weights of all letters that have a variable of 1+ and then scale the % of each letter as a % of how many weights it has compared to all the weights on the scale. But im not sure how to implement that >_<

Thanks for the link and the information, i have been thinking a bit and together with what you said i think i know how to go from here, much appreciated! ^^

Sorry to brings this thread back from the dead but I'm kind of stuck with this.

I've implemented the weighted random and it works great. My problem is I don't know how to add to the weights.

The example uses a string of numbers. I tried deconstructing that string and reconstructing it but that didn't work. I tried using arrays but that didn't work either. How exactly do you add to the weights?

R0J0hound Thank you for providing a sample file in the other thread. I've been looking for that for ages