GameMaker (2.3)
Icon

Weighted Random Script

Mranaglyph

You must be logged in to obtain assets

Description

The scrWeightedRandom function exists to choose a value with uneven/unequal probability. The function requires 3 parameters and has 1 optional parameter, which defaults to false, but can be changed to true for debugging purposes at runtime.

As a use case example, if you are making an RPG, and would like an enemy to drop certain item(s), but DON'T want the item(s) to all have the exact same chance of dropping for the player, you can use this function to change the likelihood that a particular item will drop, or even nothing at all, if you like.

End User Licence Agreement (EULA).

Age Rating: 4+

Version

GMS2.3 - Version 1.0.1. Published November 6, 2023

Updated README Documentation and Comments for better readability.

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait