[RM2K3] SETTING UP AN THE RNG

Posts

Pages: 1
Is there a better way I could code a percentage chance of something happening? Or better yet is there a way to improve RM2k3's RNG? I've searched the forums and google but almost of the the topics more or less were debates on where RNG is good or bad.


This is the chance of a normal attack missing and more often than not it happens once a test battle (which average about 3 turns per battle) and even worse if a miss happens it usually happens on the next turn despite the variable getting re rolled twice.


This is how I'm setting up it my percentages. (Ignore the faded bits.) Am I doing something wrong or do you think there's no problem?
Maybe fudge the numbers a bit more if it's not working for you. Find a better number than 30? It is basically just a random draw like any other randomised number generator - takes a random number between the two points. If it happens too often, make the numbers between bigger, but it might be that you're just getting some bad rolls. How many tests have you done? Any amount less than 20 don't really give a good sample pool to judge from.
You more or less have the right idea. Start with this:
Set a variable from 0 to 100
Check the variable if it's above or below a certain point ( <= 30 would be 30%)

Then you can modify that as you see fit. A number from 0 to 1000 would be the equivalent of using a % with 1 decimal place, or 0 to 10 would be % increments of 10.

If you have to check more than 2, for instance: <= 30, <= 60, > 60, just make sure the conditional branches themselves are prioritized so that they all get checked. <=30 would have to get checked first, since the number "10" could be both <= 30 or <= 60.
What you've shown in the script should be operating fine and only cause a "miss" once every 30 tries. Because this is not happening, there must be something that's messing with it that you're not showing us. There is no need for you to set the Hero Acc to 0 or to set the randomized value twice. Once is sufficient.

Try this once just to see if there's something else at work here. Change your "Hero Acc" variable to be set not 1..30 but rather something like 2..30. Since you only "miss" if you roll a 1, changing your randomized values like that means that you should never, in a million tries, ever miss. Thus if you ever do miss you know that the number is getting altered or re-randomized elsewhere.

One possibility is that parallel process events do run in parallel, which means that one script can mess up another script.
author=PepsiOtaku
You more or less have the right idea. Start with this:
Set a variable from 0 to 100
Check the variable if it's above or below a certain point ( <= 30 would be 30%)

Then you can modify that as you see fit. A number from 0 to 1000 would be the equivalent of using a % with 1 decimal place, or 0 to 10 would be % increments of 10.
I've given this a try and I'll admit it seems to work better than the method I was using before. I'm still getting doubles way more often than I'd like but hedge's advice below may have helped with that.

author=hedge1
Try this once just to see if there's something else at work here. Change your "Hero Acc" variable to be set not 1..30 but rather something like 2..30. Since you only "miss" if you roll a 1, changing your randomized values like that means that you should never, in a million tries, ever miss. Thus if you ever do miss you know that the number is getting altered or re-randomized elsewhere.

One possibility is that parallel process events do run in parallel, which means that one script can mess up another script.
I tried it and like you mentioned no misses came up. I double checked and no parallel processes were using that variable in anyway. I was using that variable in other formulas but that shouldn't have mattered since I re-rolled it at the beginning of every attack. Either way I changed it to a different variable altogether and it seems to have fixed the double missing issue.


This is what I'm using now. Thanks for the help guys.
Pages: 1