Adding random objects to a vertices point in UPBGE

Hello all! I am wanting to add an object to a random vertices on a plane. The idea is to spawn random rocks, grass, trees, etc. I know to most of you who are gods at python, it may seem easy but I am new to this and am currently only proficient at the logic system. Any help would be greatly appreciated!!

I supposed if a script was to be created for this, it could be called on from a logic brick every time the plane spawns. Also, I am using UPBGE, which I have heard doesn’t work the same way as the standard BGE 2.79 in regards to certain things like randomizers and such.

step -1 scatter vertex and use them to instance objects
scatter_1.blend (804.1 KB)

next I refine a little and make it place 3 verts and make a triangle so you can rotate / scale each instance

1 Like

I’ll give this a try! Thank you!

uber_scatter.blend (971.8 KB)

1 Like

uber_scatter_2.blend (980.6 KB) https://www.youtube.com/watch?v=dBQ2WyRpgU0

These are really cool! I attempted to use this in a practical way, but realized that it might be simpler to have a single python code that adds a random object from a list of current objects. In example, I have several “props” in the game, say prop 1 through 10. Is there a way to add any of these randomly to a singular position (perhaps I can apply the python to an empty and upon start of the game, it runs the .py) where it’s random every time the game starts? I know it’s possible to do this with logic bricks, but in UPBGE 2.79, this randomization function does not work for some reason, only in the BGE… any ideas?

This?