• Random entity spawning
    7 replies, posted
How would i spawn lets say a tree how ever many times around the map?
A table of stuff you want to spawn (like models perhaps) Then choose a random entry in the table via table.random() Finally, use the random entry to spawn entity at random location using math.random() for vector X, Y, Z. Also, add a checks after entity is spawned, to make sure they are on the ground and on the map, to do so use: E:IsInWorld() and E:IsOnGround().
and how would i get the trees that are on the map from hammer and use them
[QUOTE=xESWxDEATH;45192855]and how would i get the trees that are on the map from hammer and use them[/QUOTE] The easiest way I think would be to load the map in single player then turn sv_cheats on and picker then use ent_text to get the model.
how would i make the entitys spawn on the ground in stead of in the air?
You'd have to feed it proper vectors that compensate for this.
the map is full of hills and i just want to spawn the trees at random which i have done but they stay in mid air i have the spawning position for the ent to be random in x, y axis but not the z how would specify for the z where the ground is for every random tree
For those spawning in mid-air use: [url]http://wiki.garrysmod.com/page/Entity/DropToFloor[/url]
Sorry, you need to Log In to post a reply to this thread.