Random creation?

Ok so I know how to create objects every little bit, but how do I make it so that I creates at a random position and increases the the speed at which the objects are created?

Are you talking about adding objects in the game using the Add Object actuator, or are you talking about creating objects in random places in the editor (outside of the game, while modeling)?

I’m talking about in game.

I had a sort of scenery generator thing in a concept proof I’m working on, but I got rid of it, deciding it looked better when I placed trees/bushes (the only two scenery objects it generated) by hand, as trees/bushes don’t really grow randomly in nature (why is that tree in my river? Why is that bush on top of my tree?). I don’t know if this is exactly what you meant, but it might help, so I’ll explain it anyway.

You need three empties. Simple. Top view, by the way. One empty is the far left side of the level, a little above the highest point of the ground. This has an ipo animation moving from top to bottom of that left edge. I used 300 frames in the animation. The other empty is in the same position as the first one, parented to the first one. This has an ipo moving to the far right side of the level. Also 300 frames. Playing the animation, this second empty should move from the top left corner to the bottom right. This empty also casts a ray on the -Z axis. It should reach far enough to touch the lowest point of the ground. Using Python, set the position of the third empty to the hit-position of the ray. Now give the first two empties each an integer property, and set up logic bricks to change those properties randomly between 1 and 301 (300 frame animations) and play the ipos based on that value.

Finally, have the third empty add whatever objects you had in mind. You can adjust this to add different objects at different frequencies. You should also have a system (I used a timer, message) to end all three empties after a while… unless you want your framerate to drop endlessly! :wink: Hope that helps you… sorry for the vague explanation if you wanted to use this method, or the overly-detailed explanation if you didn’t.

Ok well I only want objects created on the x axis. Oh wait. Nevermind I either need a whole lot created throughout the level or Ill just place them myself. But Ill keep this im mind for the future. Though I could probably use that to create the objects randomly along the x and y axis befor you start.

wow magnum… that’ so cool… so simple and elegant solution… love it!

Gracias, dogger. Like I said though, it seemed better to place the objects manually. I guess there are other situations where it may be more useful. (I always seemed to have exactly one floating tree somewhere on the map, exactly one…:().

Sounds like you just need to add some code that cleaned up after the trees were generated, making sure all of them touched the ground. But that is a really nice way to add random scenery!