Tabletop Simulator

Tabletop Simulator

Real Boosters - Pokemon TCG (Base Set - Evolving Skies) (obsolete, see link in description)
 This topic has been pinned, so it's probably important
TheKuhlOne  [developer] 5 Aug, 2021 @ 11:50am
Advanced Booster Making Guide
Advanced Booster Making Guide
This is a relatively advanced guide and you will need to do some scripting to make your own boosters.

Explanation

Here is a brief description of how the boosters work. Each booster pack is a bag that contains the full set of all the cards in an expansion. When you pull the full set out, we destroy most of the cards using code and keep some randomly selected cards based on our needs. This method does not work well if you plan on having duplicates of your cards.

Let's look at the booster code. Start by duplicating one of the boosters. I recommend copying the Base Set booster as it has simple drop rates. Inspect the code by right-clicking the booster and clicking scripting.

First of all, set the enabled variable on the first line to false. When the booster is enabled, the code will be in effect and the booster will be destroyed when you pull the cards out. Then go to the filterObjectEnter function and set the return value to true. When this is false, no cards can enter the booster.

The booster must contain cards in the correct order to work. Look at the drop_slots table. It contains a list of all the drops in the booster in the correct order when the deck is face down. I.e. uncommon is on the top and commons are on the bottom with the deck face down. If the order of the cards does not match the order of the drop_slots, the booster will not work as intended.

Here is an explanation of the variables you need to set for each drop:

drop_slots = {
-- 1 uncommon
{ total = 32, target = 3, shuffle = {} },
-- 2 rare holo
{ total = 15, target = 0, shuffle = {} },
-- 3 rare
{ total = 16, target = 1, shuffle = {} },
-- 4 energy
{ total = 6, target = 2, shuffle = {} },
-- 5 common
{ total = 32, target = 5, shuffle = {} },
}
Example from Base Set booster

Total is the total number of cards in the drop slot. The Base Set booster has a total of 32 commons for example.

Target is the target number of cards to keep. The Base Set booster commons have a target of 5. This means that 5 commons will drop in a booster (randomly selected from the 32).

Do not modify the Shuffle table, this is used on runtime to shuffle around numbers and calculate the randomly selected cards.

You will need to write some code to modify targets for premium rares and other target changes:

-- do target changes based on drop chance
-- are we getting a holo? 1/3
if math.random(1,3) == 1 then
-- we got holo
drop_slots[2].target = 1 -- target rare holo is now 1
drop_slots[3].target = 0 -- target rare is now 0
end
Example from Base Set booster

Scroll down to the onObjectLeaveContainer function. This function is called when you pull the cards out of the booster. What we need to do is calculate any changes to targets here.

For example, the Base Set booster always drops 5 commons, 2 energy, 1 rare and 3 uncommons. However, the rare has a 1/3 chance to be a holo rare (premium rare). In this section, we can calculate the odds of that (using math.random) and modify the drop_slots targets for both the rare and holo rare. 1/3 of the time we will set the holo rare target to 1 and the rare target to 0, effectively replacing the rare with a holo rare.

Feel free to examine other boosters (such as Legendary Collection) to see examples of more advanced drop rate code.

Process

Now that everything is explained, it is time to start making a booster:
Separate all cards into rarity (drop slots). Add each drop slot to the drop_slots table and set the totals and default targets.
Combine all the cards into one deck, making sure the order is exactly the same as the order in the drop_slots table when the deck is face down. The first element is the top stack, the last is the bottom stack. In the Base Set booster, the uncommons are on the top, the commons are on the bottom with the deck face down.
Write custom code in the onObjectLeaveContainer function to modify targets as necessary (ie. premium rare chances)
Set the enabled variable to false, filterObjectEnter to true.
Place the deck into the booster.
Set the enabled variable to true, filterObjectEnter to false.
Your booster is now ready! Be warned: once you pull the cards out, the booster will be destroyed. Ideally, you should create an infinite bag and place the booster in it.