|
Axe Software Forums
Quest Developer Forum Stupid question about randoms
|
Author | Topic: Stupid question about randoms |
Tyrant |
posted 31-10-2001 22:19 GMT
Well, about 3 months ago, I knew how to do this, but now I seem to have a mind block and forgot. How do I set random numbers to variables so I can use them for other things, such as having a 50% chance of escaping a battle? To do that, I usually assign a random number to a numeric variable, such as %runchance%, then add a condition (IF %runchance% equals 1 then can't run away, ELSE you can). In QDK 3.03, I used the "Set a Numeric Variable" command, put runchance as the name, and put Thanks |
Tyrant |
posted 01-11-2001 02:11 GMT
Oh yeah, I forgot to ask if the runchance numeric variable should be added to my list of Status Variables? I tried that and it didn't work either, so I took off the runchance thinking I don't need it on my list. I want the runchance to be, at random, either 1 or 2. If it's 1, then the player failed to run away. ELSE the player safely runs away. The result when I do this is that the player is always able to run away, which means the runchance variable must be coming out 0 every time for some reason, instead of it having the chance of being 1. |
Computer Whizz |
posted 01-11-2001 19:40 GMT
Well, the proper code for it is: set (or set numeric if you are declaring a new var!) <runchance; $rand(1;2)$> So I think the MAJOR problem you have is that you put %'s around the variable you want to change! The = shouldn't matter (I don't think) but it's not needed! Computer Whizz |
Alex |
posted 01-11-2001 23:27 GMT
I think the = will bugger it up and set your variable to zero. You want... Set a numeric variable and then you want to enter runchance and $rand(1;2)$ |