|
-
Who needs pants?
Percent Chance of something happening.
Hey guys/gals, just wondering the best way to make something happen at a percentage chance. I am currently making a game where their a few different areas where chance of things happening i want set as a percentage.
Ill give you an example of one instance. When a battle happens in the game if the user defeats the monster their is a chance that the monster drops certain items. eg there could be 5 different items he could drop and there are some rare items that theres a 5% chance of him dropping and their is a 54% chance of him droping another item and so on.
so
Item1 = 84%
Item2 = 32%
Item3 = 5%
Item4 = 43%
Item5 = 88%
What i was wondering is what would be the best way to calculate chance. I figured just produce a random number between 1 - 100 and then if its less then 54 get the normal item and if its less then 5 get the other item.
What i want to be able to do is set every item in the games rarity property to a number out of 100. And any character can drop any number of different items.
Just let me know if it doesnt make sense. I just figured there would be a way better way to go about it then what i was about to do.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|