Charas-Project

Game Creation => Requests => RPG Maker Programming => Topic started by: zuhane on August 23, 2010, 02:39:53 PM

Title: Stupid randomizer (Help needed)
Post by: zuhane on August 23, 2010, 02:39:53 PM
Hey peeps! Has anyone noticed that on RPG Maker, when you set a variable at a random value, for example, between 1-100,
that it never really varies. It nearly always lands in the 50-80 area and never any lower. I thought it could be used to generate
random results, but it doesn't seem to.

I've created a Zone Icon which has a 30% chance of appearing when you attack in my game. The code is as follows:

<>Variable Operation: Zone Icon Chance - Set, Random 1-100
<>Branch if Zone Icon Chance is Less Than/Equal To Raw Power Chance (Which is 30)
 <>Switch Operation: Raw Power Success
 <>
: End

Shouldn't that technically mean that there's a 30% chance of it appearing? It appears about every 8 or 9th time I attack.
When I check the variable by pressing F9, Zone Icon Chance is nearly always around the 50-80 mark. Why? Is there a better
way to randomize something?!
Title: Re: Stupid randomizer (Help needed)
Post by: MissingName on August 23, 2010, 04:22:27 PM
(http://i874.photobucket.com/albums/ab303/MissingName/SovietPeepAnswers.png)

Sorry, couldn't resist the Peep joke...
Title: Re: Stupid randomizer (Help needed)
Post by: zuhane on August 23, 2010, 05:35:58 PM
It's fine :P

But the problem still stands tall. Anyone have a clue how to sort this out?
Title: Re: Stupid randomizer (Help needed)
Post by: Prpl_Mage on August 23, 2010, 06:37:03 PM
Just set the variable to 1-3. and have the check look for either 1, 2 or even 3. It's one out of three that it is right.
It's the same thing but more accurate. When you have large numbers it is logical that it lands on the thigns in the middle.
It isn't % we're taking about. We're talking about a random number.
And 33% is the same as 1 in 3.
Title: Re: Stupid randomizer (Help needed)
Post by: zuhane on August 23, 2010, 08:58:30 PM
Sorry, Purple. I should have elaborated a little more. That does work. However, the variable
"Raw Power Chance" can be upgraded, making it more likely to appear. This means that
it needs to be adjustable by slight percentages, meaning that I have to keep the scale on 1-100!
Title: Re: Stupid randomizer (Help needed)
Post by: Prpl_Mage on August 23, 2010, 10:14:21 PM
Then I'll try to look into it.
Title: Re: Stupid randomizer (Help needed)
Post by: zuhane on August 23, 2010, 10:36:51 PM
Thanks a lot. It's just weird how inaccurate it is.
Title: Re: Stupid randomizer (Help needed)
Post by: fruckert on August 23, 2010, 10:50:11 PM
That's because computers aren't naturally random, and random numbers in general tend to kind of pile up in the middle of the group anyways.
It's essentially unfixable unless you know how to program a god into a computer.
Title: Re: Stupid randomizer (Help needed)
Post by: MissingName on August 23, 2010, 10:52:37 PM
I've had it show up 92 out of 100 three times in a row, something else twice and then 92 a couple more times.

A suggestion (but I have yet to test this theory): Try generating your var between 0 and 1000.  Then divide that by 10.  I dunno.
Title: Re: Stupid randomizer (Help needed)
Post by: Prpl_Mage on August 24, 2010, 12:17:00 AM
A suggestion (but I have yet to test this theory): Try generating your var between 0 and 1000.  Then divide that by 10.  I dunno.

Might as well set it between 1-10 and then multiply it by 10.
at least it won't be 31,32,,33. It will just be 10,20,30,40,50,60,70,80,90 and 100. Might work with the formula you got.

I was about to give up on this till my mate Missingname here came with the inspiration.
Title: Re: Stupid randomizer (Help needed)
Post by: zuhane on August 24, 2010, 01:21:42 AM
Actually, with that in mind, I could try it with 1-20. It might give a more ranged scope at that level. At
least I can give the character small 5% chance upgrades. Thanks guys. This might work. I'll keep you posted.