Posted By
|
Message
|
Metal Maiden
Registered 10/09/2002
Points 900
|
31st August, 2004 at 22:35:13 -
Yo guys. Im making an engine that has the character dealing radom damage,
i.e: Level one, he'll deal 1-4 damage, level 2 he'll deal 3-8 damage, so on..
But how could I accomplish this? The radom number generator picks lower numbers, and zeros. (and no, I don't want him to be able to 'miss' lol)
thanks a bunch guys if yall can help.
Death in the air
Strapped in the electric chair
This can't be happening to me
Who made you God to say
"I'll take your life from you!!"
|
Pixelthief Dedicated klik scientist
Registered 02/01/2002
Points 3419
|
31st August, 2004 at 22:39:48 -
the command random(x) will pick a number from 0 to x-1. So to get your min/max, you simply use:
random((max - min) + 1) + min
this will generate a number from (min) to (max)
for example:
random((8-3)+1) + 3 will be:
random(6) + 3
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456
|
Metal Maiden
Registered 10/09/2002
Points 900
|
31st August, 2004 at 22:50:29 -
Wooo buddy it werks!
Took me awhile to figure it out, so I just copied:
random((max - min) + 1) + min
and put in the numbers!
Thanks a hellla lot man!
Death in the air
Strapped in the electric chair
This can't be happening to me
Who made you God to say
"I'll take your life from you!!"
|
Lazernaut
Registered 08/09/2002
Points 1103
|
1st September, 2004 at 06:08:04 -
maybe you could make an equation so it'll be something like
Level * (random(4) +1)
or something. That way you only have 1 line, instead of a bunch of "if level 1, then 1-4, level 2 then bla bla "
n/a
|
_rydin
Registered 06/06/2004
Points 317
|
3rd September, 2004 at 00:12:23 -
You could also use an active object with the right amount of animations and have and event that always sets it to a random direction, but using the random(#) thing in the event editor is MUCH better and easier.
"Computers in the future may perhaps only weigh 1.5 tons."
-Popular Mechanics, forecasting the development of computer technology, 1949
|
|
|