Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Randomizing problem

Author
Message
Dragon Tycoon
20
Years of Service
User Offline
Joined: 3rd Feb 2004
Location:
Posted: 5th Feb 2004 01:57
I am trying to make a text RPG to give me some practice in basic code, and I decided I might as well throw in a battle system, just for kicks. However, when I try to add a random number to the power of the attack (like real RPGs do) I run into my problem. Whenever I run my little battle-demo thing the randomized numbers are always the same! I can't quite figure out how to work the RANDOMIZE command, and I'm pretty sure that's the solution. Can someone help?
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 5th Feb 2004 01:59 Edited at: 5th Feb 2004 02:00
add this to the top of your project source code.

randomize timer()

this will seed the random numbers from the current seconds of time from 12 am


Dragon Tycoon
20
Years of Service
User Offline
Joined: 3rd Feb 2004
Location:
Posted: 5th Feb 2004 13:50
Thanks for the help, it really works!
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 5th Feb 2004 14:39
dont sweat it


jasuk70
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 5th Feb 2004 15:13
I've done this simple dice function if it comes in handy for anyone... (You still need the randomise timer() in the code as well...



Say to roll 3d6, you just need to do


Jas

----
Http://www.jsun.co.uk

Login to post a reply

Server time is: 2024-09-21 20:49:23
Your offset time is: 2024-09-21 20:49:23