# [Gen VII] Event Randomization Mechanic

## Recommended Posts

Thanks to @Kaphotics for pointing me in the right direction.  I took the past few days to analyze the randomization mechanic for local events.  I also figured out how offset 0x205 in WCFull is used.

As we know in Gen 7 you can only receive a wondercard that you have not received before in the set.  It turns out that 0x205 can determine the likelihood of which one you get.  Every WC in the distribution set gets a base weight of 1 (even if set to 0).  The wondercard gets added to a list the same number of times equal to the weight.  So if the weight is 5, it gets added 5 times. This is akin to filling a jar of M&M's and picking one out at random.

This has interesting ramifications (if it ever gets used).  As we know, when offset 0x204 is equal to the number of WCs in the set (like eeveelutions), the player receives each WC uniquely once, and then subsequently receives one at random.  This means that 0x205 determines how likely a person would be to get the "rare" WC again.

if offset 0x204 is higher than the number of WCs in the set (like the anime pokes), then the player can only receive a total number of WCs equal to the number of WCs and cannot receive any duplicates. For example, if there are 3 WCs in the set, but 0x204 is set to 4, then you can only receive each WC once and no duplicates.

if offset 0x204 is LOWER than the number of WCs in the set (we haven't seen this yet), then the player can only receive a total number of WCs equal to the counter.

The likelihood of a pokemon increases as you receive them because the probably of the pokemon (presumably common ones) that were already received are not included in the total weight.  So if there are 5 pokemon, 1, 10, 10, 10, 10, then the first time the rare is 1/41, while the next time it is 1/31, etc.

And as an interesting note, it looks like the max number of wondercards in a distribution is 20 and the maximum weight is 255.  That means the list can have up to 5,100 entries (20.4KB memory), and minimum odds of 1/5100, and a maximum of 1/1 (single pokemon).  I personally think it is a terribly written mechanic compared to 5th anniv eggs during the GBA era.

• 1

##### Share on other sites

I remember the Comet Shard was *incredibly* rare to get while with the Eevees, I received one of each before getting any doubles.

##### Share on other sites

While it is possible they could have used probably weights for that distribution, it doesn't make sense since you got one of each first and you could get them all.

##### Share on other sites

Sorry, I don't understand what you're saying.

It took me more than 80 downloads to get one Comet Shard last winter. Staff told me it's extremely rare intentionally.
But I didn't get a single eevee evolution twice before I got them all. I only used one game and I may have had crazy luck, but that's what I was observing.

Edited by Guest

##### Share on other sites

If you are talking about the first set of items from PCJP, they did not have the flag to get one of each and it was random each time. It is possible they had weights. We will never know since nobody dumped it.

EDIT: If I had to guess, it looked like this: 18, 18, 18, 18, 18, 9, 1, where 9 is full restore, and 1 is comet shard.

##### Share on other sites

I dumped this event from the raw compressed offset (0x82D44B0) and I'm unable to decompress this data as of now and I want to confirm its validity.
I'm still waiting for @Bond697 to help me on this case. Anyone know what happened to him? He said he was going to help me but right before I gave him all the data he disappeared.

Edited by Guest

##### Share on other sites

If you send the dump to me I can do it. I wish I knew that you were ram dumping the events.

##### Share on other sites
6 hours ago, Purin said:

I dumped this event from the raw compressed offset (0x82D44B0) and I'm unable to decompress this data as of now and I want to confirm its validity.
I'm still waiting for @Bond697 to help me on this case. Anyone know what happened to him? He said he was going to help me but right before I gave him all the data he disappeared.

If the data is compressed and you haven't been successful at decompressing it, how do you know the WC Data is at that offset?

##### Share on other sites

I worked on this a few months ago and followed what the game was doing. It takes this raw data, modifies only 0x58 bytes of it (might indeed be some kind of encryption) and then decompresses it. I just don't know how to find the algorithm that does the modification, therefore I can only decompress a part of it, not all. I'm just going to wait for Bond's help, we're not in a hurry after all.

Edited by Guest

##### Share on other sites

Considering the entire ROM has symbols and @Kaphotics and I have a pretty good handle, it is easy to find the function you are talking about. Translating the code to C and then interpreting is difficult without associated data. If you want to wait for @Bond697, you will be waiting a while as he is not regularly active.