Make entities can randomly spawn on the ground :D

Is it possible ? :-?.
If it’s possible, i will try to use it in my stalkerrp :-?
(For make artifart system, yeah XD)

I don’t know about totally random ground locations, but if you have a specific map you like, and you find several good locations, you could add the Vectors to a table, and have a spawn function (that might run every 30 seconds?) get a random slot from the table, and spawn the NPC there.

I know this is very vague, but so is the title. =-p


I have this example from a gamemode I was working on a while back:

Antlion Spawn Vectors

mapLoc = {}

mapLoc[“gm_flatgrass”] = {

mapLoc[“rp_cscdesert_v2-1”] = {

If this doesn’t make any sense, reply with more detail on what you want.

-- Type GetPos in console to get cordinates
local points = {
    Vector(0, 0, 0), 
    Vector(0, 0, 0),

hook.Add("InitPostEntity", "SpawnNPC", function()
    local pos = table.Random(points)
    local npc = ents.Create("npc_kleiner")


Well, thank for all your guys help :slight_smile: !
But, yeah…
I need a code what can make my entities spawn on a “totally random ground locations”
Because i don’t want they just camp around the artifact spawn point XD

The easiest way would be for you to just include lots of spawn points.

Edit - Even better make it not choose points which have players nearby.

Yea, just put in alot of spawn points, and if you want it to change position, you could create a timer to change it’s position.

This is really easy mate. First take a random X and Random Y across the lines of the map with a Z a nice value thats above most of the terrain and will not spawn under any displacements or such.
Then trace straight down towards the map, getting the position.
Then add about 20 to Z, and spawn w/e you want there.