Probability of dynamic event? Help code
How would you code this: My character is awarded a sword once in game. There are 5 possible sword types he might get. But, each type had different rarity. He will either get a diamond sword 5% chance, gold sword 10% chance, a silver sword 10% chance, steel sword 40% chance, or a bronze sword 35% chance.
Comments
then have rules if random number is equal to or greater then 1, but equal to or less then 5, get steel sword.
If random number is greater then 5 but less then or equal to 9, bronze sword.
and base probablities like that
youll have to play around with how many numbers for each and stuff, but thats the idea
cheers
edit: beat by tshirt, and a fun way to experiment with tables, nice one t
However your main character adds to his percentage, let's say it's by picking up a coin, in the coin Rule put
When actor collides or overlaps with main character then
Change attribute Chance to Chance + 1 ---- (or maybe Chance +5, depending on how much you want).
In an actor off-screen, put a Rule:
When Chance = 5 then
----ruling for your character to get diamond sword---
When Chance = 10
----ruling for your character to get gold sword---
etc.
it's not possible to give more details without seeing your project but hopefully that'll give you a start.
Edit: John beaten by TSB, both beat me! And by the sound of it they got it right: my suggestion doesn't use random, but allows for the main character to eventually collect all the swords.... I think I misunderstood...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps