New account registration is temporarily disabled.

RANDOM KEY [RM2K3]

Posts

Pages: 1
I want the game to generate a random key code to the player each time he begins a new game. I want that key to be as close to unique as possible (different for each player and each playthrough). Is there any clever way to do this other that just assigning a random value to a variable between 999999?
What do you mean by random key code? Do you mean the key code from the DynRPG patch Cherry made? Or the actual engines Key Input Process function?
I've never actually used rm2k3 so feel free to just think of me as irrelevant but the best way to ensure a different number every time is generally to use the time to generate it to the second is best but even just minutes or hours can work. If you really want a unique result just get a random number from like 0 to 1000, and add it to the time in seconds. Guaranteed different every time, just assumes ability to check system clock and even if you can't you can still just resort to a random number but every number has a chance of reappearing then and always will unless you use some kind of information from the computer that never repeats like the time in seconds or the MAC address.
Neither... I mean... just a code. A random sequence of numbers and/or letters.
Is the key supposed to have any special function aside from being unique? If not, then simply assigning a random value from 0 to 9,999,999 ought to be as good enough.
author=Kazesui
Is the key supposed to have any special function aside from being unique? If not, then simply assigning a random value from 0 to 9,999,999 ought to be as good enough.


No, just identification. Yeah, I'll go with that.

xavion that's a good idea, but rm2k3 doesn't have access to system clock.
I'm scared of patches.
The DynRPG patch isn't an RPG_RT one. It literally just installs the patch onto your game and that's it. If you're that concerned you can always back up your project, and then test out the DynRPG patch. I'd highly advise you install it. It adjusts various errors RPG Maker 2003 had in general.
The keycodes in my current project are generated on the fly. I just set it to kick out a random variable between 1000 and 9999.

You could also have a shadow parallel event running in your common list that acts like a clock. You could use its value to modify the random number produced, giving roughly the same suggested effect but without requiring any patching.
Pages: 1