I just want my entity to spawn on this position
[code]6633.843750 10821.031250 -14047.968750[/code]
~
[code]6634, 10822, -14048[/code]
[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 )
ent:Spawn()
ent:Activate()
return ent
end
[/lua]
and where should I put it in?
[editline]10:12PM[/editline]
(I know it's a new vector now :D )
[QUOTE=MachinEZ;18153915]so like this?
[lua]function ENT:SpawnFunction( ent, tr )
local SpawnPos = Vector (7237, 11575, -13888)
local ent = ents.Create( "information" )
ent:SetPos( SpawnPos )
ent:Spawn()
ent:Activate()
return ent
end
[/lua]
and where should I put it in?
[editline]10:12PM[/editline]
(I know it's a new vector now :D )[/QUOTE]
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")
ent:SetPos(Vector(0,0,0))
ent:SetAngles(Angle(0,0,0))
ent:Spawn()
end
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.
Would
setpos 1058.820435 86.475952 95.031250;setang 30.139967 -104.099915 -0.086528
Be 1059 - 87 and 97? Then angles 31 - 105 - 0
[QUOTE=Justin37111;18158257]Would
setpos 1058.820435 86.475952 95.031250;setang 30.139967 -104.099915 -0.086528
Be 1059 - 87 and 97? Then angles 31 - 105 - 0[/QUOTE]
It doesn't really matter, you can use the level of precision that you want.
Consider downloading something like [url=http://www.garrysmod.org/downloads/?a=view&id=32129]this[/url] 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 :D
[editline]03:55PM[/editline]
It worked...Thanks veryy much :D
Sorry, you need to Log In to post a reply to this thread.