Drop Rates: Percentages

0 favourites
  • 3 posts
From the Asset Store
Now you can drop everything in your game with sound :)
  • Until now I've been using random(101) combined with <= >= to get my drop rates but unless I'm missing something they are a bit nonintuitive because the "rates" I compare the roll to are not the real %

    variable to random(101)

    roll<=5 |object1

    else roll<=15 |object2

    else roll<=46 |object3

    else roll<=75 |object4

    But the real rates are : 5%, 10%, 31%, 29%

    is there any other way to do this that is more straight forward because if the percentages have decimals and the numbers are dynamic it gets confusing really quickly

    I also want to make the drop rates dynamic, so you can add or subtract drop rate from the objects

    let's say I want to add a 25% chance to the object3

    object3 has 10% chance to drop

    what I did was:

    divide 10 between the number of objects.

    and add it to the other objects drop chance

    now divide the result for the sum of all the objects drop rates

    (maybe you only have 2 drops and have low ratios so it doesn't add up to 100 like on my example)

    now I multiply for the amount of chance I wanted to add to object3's drop chance and subtract the result to the other objects%

    so now every object got reduced depending on their drop chance% of the drop chance added to object3

    So is there any better ways to do this?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If you use int(random(101)) the returned results won't have decimals, be only integers and so your rates will be more appropriate to what balance you are trying to apply.

    I have written an article on rate drops years ago.

    You possibly want to have a look at it : construct.net/en/tutorials/code-monster-loot-drops-633

  • I know about those expressions but what I wasn't concerned about the dice roll but the drop chance every object has. I also want the decimals for comparing.

    I already read your post but in concept, they work just the same you just added a step before to see which bag of items had every enemy which is one of the many ways for dropping items.

    but let's say I want to drop equipment from your example:

    -I have 100/6 chances to get an owl

    -from that 100/6 I have a 15% chance to drop something

    -That chance is then divided equally between the number of objects on the bag (rarity=bag)

    -so 15%/6 chances to drop equipment per roll

    If I'm not wrong (I suck at math so probably) equipment has a 0,41% chances to drop.

    If I want to add a 25% chances to drop to the equipment it's not as easy as adding 25 to its rarity It just makes it drop on more enemies, but that's not what I want.

    Think of it as If you opening a pack on a game of cards: common(52%), rare(44%), epic(4%).

    and I want to add a 20% boost to rare chances because of an item or skill.

    roll<=obj1_drop_rate

    else roll<=(obj1_drop_rate + obj2_drop_rate)

    else roll<=(obj1_drop_rate + obj2_drop_rate)+ obj3_drop_rate

    roll<=4

    else roll<=44

    else roll<=100

    That's what the math on the first post was for, substracting drop chance from the other objects depending on their drop chance.

    I don't need to make tables for that, and I can certainly just do it as I've been doing it until now I was just curious about if there are better ways to do it.

    I probably can't explain myself properly sorry.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)