| Mirage Source http://miragesource.net/forums/ |
|
| Percentages! http://miragesource.net/forums/viewtopic.php?f=201&t=4993 |
Page 1 of 1 |
| Author: | Anthony [ Wed Jan 21, 2009 10:22 pm ] |
| Post subject: | Percentages! |
So what I have is this: two numbers with percentages attached to them. 1 = 30% 2 = 70% I need to have 1 appear 30% of the time and 2 to appear 70% of the time.. I am thinking I need a third number? Or an amount of times it has to run through and then take an average or something? I don't know how to do it so I am asking for help! Haha, thanks. |
|
| Author: | Lea [ Wed Jan 21, 2009 11:34 pm ] |
| Post subject: | Re: Percentages! |
Randomly generate a number 0 through 9 If randnum < 3 then return 1 if randnum >= 3 then return 2 |
|
| Author: | Anthony [ Thu Jan 22, 2009 1:07 am ] |
| Post subject: | Re: Percentages! |
Thanks Lea, that's easy enough. So.. What if the percentages aren't a static variable? Will this method still work? |
|
| Author: | Jacob [ Thu Jan 22, 2009 2:12 am ] |
| Post subject: | Re: Percentages! |
I do something like : Code: If Npc(NpcNum).Drop(i).Chance > (Rnd * 100) Then 'Whatever' Where .Chance = whatever % you want. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|