If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

item generator with percentage variable

I want learn how to make a javascript for an RPG where it generates and display a specific item, but the generation process is controlled by the percentage variable for items in certain category.

also, aside from the quality, and item type, it'd be nice if you could input a number in and it will also generate the item level from 3- to +3 (controlled by percentage) and display the number at the end modified by the aforementioned modifiers

These forums are generally for helping to troubleshoot problematic code, not for freebies.

^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.* The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

Here's a basic generator, but right now it's fully random, I want to control the rate of generation via probability.
like the probability of generating common is 60% or the probability of generating sword is 50%

one simple way is to simply build an array of the options, and repeat the items you want to be more common than others:

this not only performs faster, it allows the developer to skip the extra quotes around the names, and avoids the parens, making it more letters than syntax, all in all: a lot less typing on a complex application.