I'm looking for a way to make chances of getting better loot increase the more you've looted. I do not want it to be possible to get a rare item the first 5 times and not being able to get an epic item the first 10 times.
However, the more the player loots, the better chance he should have of getting better items/less chance of getting nothing, normal, ...
This is my current code, but it is, as you can see, completely static. I know this might not be of much help, but at least it shows an overview of the items and the %-chance I have in mind.
var rand = random(100); // Random number 0-100
if(rand < 40){
return LOOT_NOTHING;
}else if(rand < 70){
return LOOT_NORMAL;
}else if(rand < 90){
return LOOT_UNCOMMON;
}else if(rand < 99){
return LOOT_RARE;
}else{
return LOOT_EPIC;
}
The project is written in GML, but pretty much any language will suffice as an answer as it's not very language-specific.