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

  • tatiangtatiang Posts: 11,949
    Accepted Answer
    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.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • GS_MasterGS_Master Posts: 159
    Accepted Answer
    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
  • tatiangtatiang Posts: 11,949
    Accepted Answer
    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%.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Answers

  • WhySoCREATIVEWhySoCREATIVE Member Posts: 75
    Thanks so much guys! @tatiang I assume I will need multiple game.spawnChance attributes for each actor then If they can be individually upgraded to higher chance.
Sign In or Register to comment.