Mirage Source
Percentages! - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: Percentages! (/showthread.php?tid=2514)



Percentages! - Anthony - 21-01-2009

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.


Re: Percentages! - Anthony - 22-01-2009

Thanks Lea, that's easy enough.

So.. What if the percentages aren't a static variable? Will this method still work?


Re: Percentages! - Jacob - 22-01-2009

I do something like :

Code:
If Npc(NpcNum).Drop(i).Chance > (Rnd * 100) Then 'Whatever'

Where .Chance = whatever % you want.