Community
AGI Programming => Mega Tokyo AGI Archive => Topic started by: Patrick on April 21, 2002, 04:47:12 PM
-
I was playing KQ3 and I noticed the squirrels and stuff that randomly appeared on the screen and I thought WOW :o ! I wish I could put that in my game!
Does anyone know how to do this? :D ;) :)
-
Easy, use the random command and make it so that if it generates a certain number then draw the things that need to be drawn on the screen.
If you would like a more in depth explanation of this just ask.
-
random(n,m,k)
where variable k is assigned a number between the range of n to m.
So if you want to display monkeys on the screen 30% of the time.. you could do something like this:
if (newroom) {
random(0, 100, v100);
if (v100 < 30)
{
//load, draw, display, animate monkeys
}
}
- Nick
-
So is v100 just like saying it is this much percent or is v100 a variable ???
-
useing the code above v100 will be set to a number from 0 to 100. and if v100 is less than 30 then it will animate monkeys.... I thought this was funny. :)
-
yeah, to clear that up...it doesn't have to be v100...if you put v145 instead of v100 in the code above, then v145 will be set to a value between 0 and 100
-
sorry.. bad example
-
No, it was a good example, but you didn't really show him what each part did, that is why he got confused.
-
I meant having 100 and v100 together.. i mentioned the syntax for random at the start i thought.
thanks though.
- Nick