Basically I placed MortAr's trigger actions into an if/then/else, with the condition checking a random percentage (real between 0.00 and 100.00) against a preset chance variable.
The CS_Chance should be constant (quite unefficient if you're setting the same value over and over again)
Next, if you're making a random value between 0.00 ~ 100.00, do you know you have 10,000 values ? Not to mention the zero-error you have, now the value is 10,001. It should be 0.01 ~ 100.00 OR 0.00 ~ 99.99.
1.00 from 100.00 (10,000 values)
10.00 from 100.00 (100 values)
100.00 from 100.00 (1 value)
You should be using 10.00 out of 100.00 OR to lessen the range of calculation, you could use 0.01 ~ 1.00 (1% per interval | 100 values).
That's why I always use Integer as "chances" so you don't get confused with the wonders behind it
And I know the more decimal you have, the more "accurate" your reading is, but how much accuracy do you ask from this 1 ~ 100 ?
That is accurate enough for me.
Compared 30.4563% chance to hit, it's quite ridiculous.