Simple entity spawn

I just want my entity to spawn on this position

6633.843750 10821.031250 -14047.968750


6634, 10822, -14048

[lua] self.Entity:SetPos(Vector(6634, 10822, -14048)) [/lua]
Wont work =/

ent:SetPos(Vector( 6634, 10822, -14048 ))

so like this?
[lua]function ENT:SpawnFunction( ent, tr )

local SpawnPos = Vector (7237, 11575, -13888)

local ent = ents.Create( "information" )
ent:SetPos( SpawnPos )

return ent

and where should I put it in?


(I know it’s a new vector now :smiley: )

SpawnFunction is only called when spawning the entity in Sandbox.
What exactly are you trying to do? To create an entity at map start or simply at any given moment?

I would also like to know this, mine is for map start.

Here’s a stripped down way to do it :
[lua]local function EntitySpawning()
local ent = ents.Create(“ent_class”)
hook.Add( “InitPostEntity”, “MapStartSpawning”, EntitySpawning )[/lua]

As you can see it only involves placing the spawning code in an InitPostEntity hook, which is called when the map has finished loading.

setpos 1058.820435 86.475952 95.031250;setang 30.139967 -104.099915 -0.086528
Be 1059 - 87 and 97? Then angles 31 - 105 - 0

It doesn’t really matter, you can use the level of precision that you want.

Consider downloading something like this also, as it could help you understand how vectors and angles in the Source engine work :wink:

thanks…I’m going to try it now :smiley:


It worked…Thanks veryy much :smiley: