ID:155113
 
I seem to be having trouble with probability.

Most likely an indention problem, as it doesnt seem to follow normal rules.

Could some please explain how one would go about applying probability (as an example) to a course of events?

Lets say a player logs in, and they receive an event upon log in ..how would i go about setting up the prob selection for this.

DM was vaguely helpful
if(prob(20))
//20% probability this block of code will execute
if(prob(40))
//40% probability this block of code will execute
if(prob(90))
//90% probability this block of code will execute

Note that the above examples are all independent events; that is, the probability of the second event isn't affected if the first block of code executes and the probability of the third event isn't affected if the first and/or second block executes. Sort of like rolling a dice, the probability of rolling a 6 isn't affected at all by previous rolls.

if(prob(20))
//20% probability this block of code will execute
else if(prob(50))
//40% probability this block of code will execute
else if(prob(50))
//20% probability this block of code will execute
else
//20% probability this block of code will execute

Note that the above examples are dependent events; that is, the probability of the second event depends upon whether or not the first event actually occurred or not. The same is true of the third and fourth events.

There's a 20% chance the first event will happen. That leaves 80% for the following 3 events. That is carved up further when the second event takes 50% of that remaining 80% (50% of 80 is 40) probability. Thus 40% remains for the last two events. The third event then takes 50% of the remaining 40% (50% of 40 is 20) and leaves 20% for the final event.

This example is more like drawing cards from a deck. After you draw a card if you don't replace it then the probability of drawing that same card is reduced.
In response to BrickSquadron
I guess what i'm really getting at is the indention.

Because the reference isnt indenting it properly, and when i fix the indention it does not work.