probability event
Problem it solves
You want an enemy to have a 25% chance to drop a rare gem whenever it is defeated.
What this block does
Executes a block of code only if a random percentage roll succeeds against the given chance.
The block
Block ID: retro_probability_event
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| chance | number | 50 | Chance percentage between 0 and 100. |
| handler | () => void | Code to run if the percentage roll succeeds. |
Example
Retro.probabilityEvent(30, function () {
Retro.playRetroSound(Retro.Sounds.RareItem)
})Add the extension
Add github:CrzLe0723/RetroFx to your project, or open: Import RetroFx.