Randomness

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: Randomness
Warrior
Member # 7195
Profile #0
Well, I got an idea and want to write my first scenario - don't worry, I tried to make a big one once, and I learned my lesson - so it will be a short one.
I just stumbled upon one detail I cannot solve.
I want to make a certain event or a special that would occur if let say, hypothetically, your dexterity is high enough.
But to avoid setting an exact amount, I wanted to make it more likely to happen if your dex is higher.
Like for example:
(dex x 5)% of happening or something
So that even if you hadn't 20 dex it could happen - you would just need to try more times, like rolling dice, if you get what I mean ...

Thanks in advance

------------------------------------

Look! It's my one hundredth post!
A time for celebration!
...
Or is it?

--------------------
I don't care what you say, I'm punk and Hardcore all the way!
Posts: 185 | Registered: Sunday, June 4 2006 07:00
Lifecrafter
Member # 6193
Profile Homepage #1
Use get_ran(x,y,z)
X- number of dice to be rolled. Probably just set this to 1.
y- smallest number each die can come up.
z - largest number each die can come up.

So put something like if(get_highest_skill(1) >= get_ran(1,1,20)). In this case, it is possible for it to occur even if your highest dexterity is only 1, but its only a 5% chance.

--------------------
Guaranteed to blow your mind.

Frostbite: Get It While It's...... Hot?
Posts: 900 | Registered: Monday, August 8 2005 07:00