So I work on my friend's game in my spare time writing quests and events, that sort of thing. I'm working on an event now that has got me stumped trying to work out the probability of results!
The NPC needs to hand out one of twelve items at a particular frequency when another item is turned into her. The problem is three of them need to occur 20% of the time each, another three 10% each, three more at 2% each, and the last three at 1% each. I know that to have a roughly even chance of each item, the frequencies would need to be set such as:
ifrand(8) followed by 9, 10, 11, 13, 14, 17, 20, 25, 33, and ending with (50) between the last two. I probably could've figured this one out on my own (this much was in a guide) but twelve instances of 8% is a bit more straightforward than what I need.
I don't think the code for this allows decimals but even considering integers I find myself thinking in circles! Can anyone help? How would I go about working out more progs like this in the future?