![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | MercyFalls |
var random = RandomNumberGenerator.new()
func _ready():
random.randomize()
var n = random.randi_range(1, 100)
How would I code for it to check the randomly generated value and decide whether to drop the item or not based on a drop chance? Sorry I’m very new to all of this and just trying my best to learn as I go. I have checked out a bunch of resources I could find on using RNG + Arrays in Godot but I’m not quite sure how to code it out for myself. Also, I figured using an array might be redundant since I will only have 1 item on my drop table? But perhaps if I wanted to add more items later down the line it would be useful to just use arrays anyway. Any advice appreciated.