Drop rates, Spawn rates, calculation
Hello, anyone know some mathematical solutions on how to create spawn rates? I want to randomly spawn an actor maybe at 10% chance and user is able to upgrade this change to 20% 30% and so on...
Best Answers
-
tatiang Posts: 11,949
Make an integer attribute called game.spawnChance. Then set up your rules as follows:
Change attribute game.spawnChance to random(1,10)
When attribute game.spawnChance < 2
[spawn an actor... this is a 10% chance]
or, When attribute game.spawnChance < 3
[spawn an actor... this is a 20% chance]
etc. -
GS_Master Posts: 159
Click the green actor to add 10% chance of white actor spawning the orange when you click it.
https://dl.dropboxusercontent.com/u/26048107/percent.zip -
tatiang Posts: 11,949
Yes, so you'd want a self.spawnChance for each actor in that case. And actually, the attribute you want to change would be self.probability (for lack of a better name). That's the 2 or 3 in the rule I posted above. So more like this:
Initially, set self.probability to 2.
Change attribute self.spawnChance to random(1,10)
When attribute game.spawnChance < self.probability
[spawn an actor... this is a 10% chance]
Then, later change self.probability to 3, which increases the chance to 20%.
Answers