In my game which was supposed to simulate the odds of getting a Gimfish I had a bit of trouble so I had to do a bit of research to find out and decided to share it with the rest of the community.
When you create it you want to first wire a trigger to a button (you can change it slightly like swapping the button with a zone) and then you click the trigger and select ‘Blocks’. Next you want to select the ‘Variables’ tab and then create a variable by the name of ‘RandomNumber’ (or anything you want to represent a random number). After that you want to select ‘Set Random Number To’ block and a 'Random Integer [] to []'
from the ‘Essential’ tab and set it to the chance you want (for example, if you wanted a 1% chance for something you would need to do 'Random Integer [1] to [100]'
(using the number block from ‘Essentials’).
Now you want to select an 'If [] Do []'
from the ‘Logic’ tab. Next attach a [] = []
block from ‘Logic’. Now going from the 1% chance I said earlier you want to put another block ('Random Number' from 'Variables'
) in the first blank of the [] = []
block, then in the second you want to put another number block and set it to 1.
For the final steps you want to get a ‘Broadcast on Channel’ from ‘Essentials’ and attach it to the ‘Do’ part of 'If [] Do []'
and then get a "[]"
from the ‘Text’ tab. and attach it to the right side of ‘Broadcast on Channel’ block. and in the at block ("[]"
) type your channel name, in this case I’m going to use ‘a’. If you want many random chances you just do this entire paragraph of steps as many times as you want, all you just have to do is click the ‘*’ button in the 'If [] Do []'
block and select 'Else If'
as many times as you want.
Now get an ‘Item Granter’, set your item, put your channel in the slot for granting titled ‘Grant Item When Receiving Channel’ an your done!
(Random chance for 2 items, ‘a’ is item 1, ‘b’ is item 2, edit to how you want it)