Rolling for rarity

Hello, I am writing a script which will roll for rarities for powerups. I have 5 classes of rarities (common, uncommon, rare, epic & legendary) each category needing to be rare than the last. The script in the image will roll a number from 100 and compare where the number lies in a range in order to call a new event which will randomly pick a powerup in an array, depending on what is selected, it will call an event to display the appropriate widget on the screen (powerups are gonna show up on the screen in a similar fashion to how it is done in Soulstone Survivors if that helps you visualise my endgoal).

I was wondering if there was a more optimal way to code my selections or more optimal logic to achieving my goals?

Curves. Sample a curve. Round the result and associate it with rarity (enumerator, perhaps?)


Also, this script will not work the way you think due to pure node evaluation. Every time we Branch, a brand new random value is generated. If you want to continue with what you have, ensure to store the generated value before cascading into branches. Why continue with this? Because if that’s all you need and it is working the way you want, there’s no reason to change it.

Opt for curves if you believe the complexity of the generator can get out of hand. They often do. :innocent:

1 Like

Ah ok thanks for the heads up. I am pretty new to unreal and still trying to get to grips with things, not encountered curves before, any good resources you recommend for learning how to use them?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.