I'm not sure how to probability

Awhile back, a fellow rpg maker sent me his game for beta testing and bug finding. On my third play through I noticed a key skill of the MC could repeat even if all enemies were dead. It took us a couple of days to realize that the common event was calling itself twice.

The skill as intended would use itself once, then have a 50% chance to repeat. Mathematically this would mean the third strike has a 25% chance, fourth 12.5%, etc.

But by accident, the skill was being called twice. There was now a 50% chance the skill would be used twice more, with each use having a new 50% chance to repeat twice. It's been too long since I studied probabilities, so do anyone have any idea what the 'curve' here looks like?
just add variable to count or use labels in the event. variable proc times = 0, variable roll 1..2.. if === 1, jump to label proc, variable proc times + 1, if greater than cap, jump to label stop.
There are a few things that make your question ambiguous.
  • It's not totally clear how the repeats work based on your common event. (Does the initial skill get called twice, or only the 'repeats' in the Common Event? Does the skill call the common event twice, or does the common event call itself twice? Does the common event cause a 50% chance to repeat twice, or two 50% chances to repeat once? If the first 50% succeeds, can the second one succeed as well?)
  • Additionally, what answer are you trying to find? (Chance that at least X repeats will happen? Average number of repeats per skill usage? How to calculate one of these two things?)
Interestingly, if each "repeat" of the skill has a 50% chance to trigger itself twice, and multiple repeats of the skill are each allowed to each trigger their own repeats, the average number of repeats (mathematically speaking) will be infinite. This sounds weird, and obviously in a majority of trials the sequence will probably end within a few rounds of the common event, but it's a similar question to the St. Petersburg Paradox.

I think that if the skill is guaranteed to run once, and then each run of the skill gives two independent, 50% chances to run the skill one additional time (allowing both to succeed for 2 additional repeats), you would figure out the chance of the entire chain stopping after step N by calculating 0.25 * ((9/16) ^ (N-1)). So a 25% chance to stop after the first step, a 14.0625% chance to stop after the second step (for a total of ~39% after two steps), and so on.
It's not totally clear how the repeats work based on your common event. (Does the initial skill get called twice, or only the 'repeats' in the Common Event? Does the skill call the common event twice, or does the common event call itself twice? Does the common event cause a 50% chance to repeat twice, or two 50% chances to repeat once? If the first 50% succeeds, can the second one succeed as well?)
The skill gets used once. Then it calls a common event. If a 50% chance succeeds, the skill gets called twice more, each of which loops this.

Additionally, what answer are you trying to find?
How to figure out what the possible probabilities are. Like, as intended the skill is supposed to call 50% for one repeat each time. Thus, the chance is 1/(2^N). But in this situation, I'm not entirely certain how to look at the chance of any given thing happening, and that's ignoring the fact that at some point the game will eventually realize "wait, you've been attacking air five times in a row, end battle".
OK, I understand how it works now. I couldn't come up with any kind of easy formula to represent the chances of the sequence "ending" (resulting in 0 additional calls), so I wrote out most of the first 6 iterations of the cycle onto a spreadsheet. Each row represents one possible iteration of equal likelihood, and each column represents an "iteration" (a new cycle after all of the previous cycles have borne out). For example, in Iteration 2, there are 16 scenarios where there are 2 skill usages, and 16 where there are 0. In Iteration 3, all of the 0's will also result in 0's, whereas the 2's can either succeed twice to create 4 (1/4 chance so 4 scenarios), succeed once to create 2 (1/2 chance so 8 scenarios), or succeed no times to create 0 (1/4 chance so 4 scenarios). And so on. Where the chances where getting very granular (less than 1/32), I represented them with multiple comma-delineated numbers; where they were even more granular, I used ~X to denote the average number of skill usages.
Coin Flip 2x Common Event.png


One takeaway is that after 6 iterations, the average number of skill usages across all scenarios is 6. This is consistent with St. Petersburg's Paradox: the average after X iterations will be X, and therefore (although it's fairly likely a single trial will end early) the average number of times the skill will be used is actually infinitely high.

As far as how to figure out what are the chances that the skill will be used N times, I don't see an easy way to do it. A math genius might be able to figure it out. I think it has something to do with the increasing chance throughout each iteration that a 0 will be hit - it's 50% in two iterations (16 out of 32), 62.5% in three iterations (20 out of 32), 69.53% in four iterations (22.25 out of 32), and so on. I can't find an easy curve to fit the probabilities. It does seem, however, like the amount that the % increases from one step to another is slightly greater than half of the % from the step before (e.g. 12.5% increase from I2 to I3; 7.03% increase from I3 to I4; probably around 3.7% increase from I4 to I5).

However, what you can figure out from this chart is the probabilities of any number of skill usages up to 7, represented by the number of times that appears in the final column divided by 32. Everything above the 7 row is an average of some sort, with the top few rows and some highly-lucky branches of the mid-high rows growing to very large numbers.
One takeaway is that after 6 iterations, the average number of skill usages across all scenarios is 6. This is consistent with St. Petersburg's Paradox: the average after X iterations will be X, and therefore (although it's fairly likely a single trial will end early) the average number of times the skill will be used is actually infinitely high.
Wow, that does really fit. I reread the article because I had thought I remembered the paradox. Thanks for this help. And just like it is with that paradox, I'm uncertain how good this skill actually is. It's an even more extreme Wondershot (from Chrono Trigger).
No problem! As far as "how good the skill is" - unless the damage is minuscule, it's going to be ridiculously good! While half the turns will only result in a single hit, around a quarter will hit 10+ times! Expect players who have a tough time with a boss fight to cheese the move and hope for those ridiculously long strings of repeats.

Just as a bit of extra info, if you "fix" the common event and have it call the skill once (at 50%) instead of twice, the average numbers of hits across a large number of trials would be exactly 2. This can be modeled by 1 / (1 - 0.5) where the first 1 is the initial effect (1 usage) and the 0.5 is the chance that it will repeat (50%). Like the double-usage common event, it's skewed towards small probabilities of large numbers of hits, though it falls off much, much faster.

As a compromise between the two, you could have a ~65% chance to repeat once, or you could have two ~40% chances to repeat once (or even one ~40% chance to repeat twice if you want the rare super-big string of attacks).
Just as a bit of extra info, if you "fix" the common event and have it call the skill once (at 50%) instead of twice, the average numbers of hits across a large number of trials would be exactly 2. This can be modeled by 1 / (1 - 0.5) where the first 1 is the initial effect (1 usage) and the 0.5 is the chance that it will repeat (50%).
That lines up with what I had thought and it's price was just under the cost of Dual Strike another party member had, thanks.

Original thread: https://forums.rpgmakerweb.com/threads/im-not-sure-how-to-probability.122620/