Gatcha System
In this example, we will implement a Gatcha System using Dataset.
First, we will need to create a spreadsheet with the following data:
Season 1 Gatcha Characters
0
1.51
5
1
32.83
4
2
32.83
3
3
32.83
2
Please note that the sum of the Gatcha Chance column is equal to 100.
This will be very important to calculate a random weighted selection in the Gatcha Pull formula.
Importing the Spreadsheet Into the Diagram
To import your spreadsheet into the diagram, first export it using the XLSX or CSV formats.
With your exported file in hands, click on the Spreadsheets menu button. The Spreadsheets drawer will appear on the right.
Click on the "+" button to add a new spreadsheet.

After clicking on the "+" button, the following dialog will be displayed

Click on "Choose" and then select your exported file. After selecting the file on your computer, the dialog will change, asking for confirmation. If the selected file is correct, click on "Submit".

If the dialog displays a "Success" message, you'll be able to find your uploaded spreadsheet in the Spreadsheets Menu.
We can open the spreadsheet by clicking on its name.


We can then rename the Spreadsheet by clicking on the "Properties" button.

We can see the updated name in the Spreadsheets Drawer:

Adding a Dataset Node
The next step is to add a Dataset node. This way we will be able to reference the values we have just imported into our diagram.
To add a Dataset node, you can drag and drop the Dataset node from the Node Toolbox into your diagram.

The Dataset node added into the diagram:

The next step is to rename our node and select the Dataset from the dropdown menu. In this example we will use the following name:
Active Season Gatcha Dataset

Please note the automatically generated Tag name (in yellow).
In this example, with the Dataset node named "Active Season Gatcha Dataset", our tag for this specific node becomes "activeSeasonGatchaDataset".
We will use this tag to connect the Dataset node to other nodes.
If you named your node differently, your Tag name will also be different and you will need to update the following formulas accordingly, otherwise the formulas will become invalid.
Creating the Diagram Loop
With the Dataset import part done, we can then start implementing the actual logic behind our simulation.
In this example, we will need 3 Formula nodes, 1 Origin node and 1 Data Node.
Nodes Overview
Formula 1
Name: Gatcha RNG
Tag: gatchaRNG
Expression: random(0, 100)
Connected to: Gatcha Pull (Formula)
Value: true
Description: Generates a random number between 0 and 100.
This random number will be used to determine pulled character
Formula 2
Name: Gatcha Pull
Tag: gatchaPull
Expression: larger(gatchaRNG, 0)*smallerEq(gatchaRNG, activeSeasonGatchaDataset[1][0])*0+
larger(gatchaRNG, activeSeasonGatchaDataset[1][0])*smallerEq(gatchaRNG, activeSeasonGatchaDataset[1][0] + activeSeasonGatchaDataset[1][1])*1+
larger(gatchaRNG, activeSeasonGatchaDataset[1][0] + activeSeasonGatchaDataset[1][1])*smallerEq(gatchaRNG, activeSeasonGatchaDataset[1][0] + activeSeasonGatchaDataset[1][1] + activeSeasonGatchaDataset[1][2])*2+
larger(gatchaRNG, activeSeasonGatchaDataset[1][0] + activeSeasonGatchaDataset[1][1] + activeSeasonGatchaDataset[1][2])*smallerEq(gatchaRNG, activeSeasonGatchaDataset[1][0] + activeSeasonGatchaDataset[1][1] + activeSeasonGatchaDataset[1][2] + activeSeasonGatchaDataset[1][3])*3
Connected to: Gatcha Pull Rank (Formula)
Value: true
Description: Compares generated random number to the Dataset table.
If between the thresholds for each character, return character number.
We are comparing the randomly generated number to the values defined in the dataset's "Gatcha Chance" column to create a weighted random.
Understanding the Formula's Expression
larger(gatchaRNG, 0) * smallerEq(gatchaRNG, activeSeasonGatchaDataset[1][0]) * 0 +
larger(gatchaRNG, activeSeasonGatchaDataset[1][0]) * smallerEq(gatchaRNG, activeSeasonGatchaDataset[1][0] + activeSeasonGatchaDataset[1][1]) * 1 +
larger(gatchaRNG, activeSeasonGatchaDataset[1][0] + activeSeasonGatchaDataset[1][1]) * smallerEq(gatchaRNG, activeSeasonGatchaDataset[1][0] + activeSeasonGatchaDataset[1][1] + activeSeasonGatchaDataset[1][2]) * 2 +
larger(gatchaRNG, activeSeasonGatchaDataset[1][0] + activeSeasonGatchaDataset[1][1] + activeSeasonGatchaDataset[1][2]) * smallerEq(gatchaRNG, activeSeasonGatchaDataset[1][0] + activeSeasonGatchaDataset[1][1] + activeSeasonGatchaDataset[1][2] + activeSeasonGatchaDataset[1][3]) * 3
In natural language:
If the value is larger than zero, and the value is smaller or equal to the Character ID 0's "Gatcha Chance" (1.51), we return 0 or
if the value is larger than Character ID 0's "Gatcha Chance" (1.51) and smaller or equal to the sum of Character ID 0 and 1's "Gatcha Chance" (1.51 + 32.83), we return 1 or
if the value is larger than the sum of Character ID 0 and 1's "Gatcha Chance" (1.51 + 32.83) and the value is smaller or equal to the sum of Character ID 0, 1 and 2's "Gatcha Chance" (1.51 + 32.83 + 32.83), we return 2 or
if the value is larger than the sum of Character ID 0, 1 and 2's "Gatcha Chance" (1.51 + 32.83 + 32.83) and smaller or equal to the sum of Character ID 0, 1, 2 and 3's "Gatcha Chance" (1.51 + 32.83 + 32.83 + 32.83), we return 3
Graphically (not to scale):

Formula 3
Name: Gatcha Pull Rank
Tag: gatchaPullRank
Expression: activeSeasonGatchaDataset[2][gatchaPull]
Connected to: Gatcha Pulls Origin (Origin)
Value: true
Description: Get pulled character data from the Dataset
Origin 1
Name: Gatcha Pulls Origin
Tag: gatchaPullsOrigin
Connected to: Gatcha Pulls (Data)
Value: 1
Description: Add 1 to pulled characters counter
Data 1
Name: Gatcha Pulls
Tag: gatchaPulls
Connected to: Gatcha Pulls Origin (Origin)
Description: Holds pulled characters amount
The nodes will be connected as such:

The logic works as follow:
Generate a random number between 0 and 100 (Gatcha RNG Formula Node)
Return a value between 0 and 3 that corresponds to the Character ID, based on the previously generated random number (Gatcha Pull)
Get data from the previously generated Character ID and display it
Add 1 to the pull counter
Repeat (1. ~ 4.)
Last updated