Darkrp Vectors

How do i use vectors? i type “getpos” in console and i pasted the numbers in my code but it didnt work

bump? i need help pleaseeeeee

LOL your confused… vector i think wouldn’t work with “getpos” well maybe… but you would most likely have to decode it alot to make sense.

Vector = Vector( -3225.146484, -6435.770020, 262.031250 )

thats an example of it. i try to paste in my own code from “getpos” and it dosnt work

Could we see your code then?

Spawn[ 2 ] = { } --The 2 is whitch number the npc have, the first have 1 second 2 third 3 etc.
Spawn[ 2 ].Entity = "npc_trader" -- Change npc_trader to the name you gave the folder from before.
Spawn[ 2 ].Vector = Vector( -3225.146484, -6435.770020, 262.031250 ) -- This is the position. go ingame and type getpos in console to get your current position...
Spawn[ 2 ].Angle = Angle( 0, 180, 0 ) -- with way it is looking. change ONLY 180!!!

function SpawnEnts( )
	for k, v in pairs( Spawn ) do
		local ent = ents.Create( Spawn[ k ].Entity )
		ent:SetPos( Spawn[ k ].Vector )
		ent:SetAngles( Spawn[ k ].Angle )
		ent:Spawn( )
		ent:DropToFloor( )
		local bubble = ents.Create( "ent_quest_bubble" )
		bubble:SetNetworkedEntity( "ChaseEntity", ent )
		bubble:SetPos( ent:GetPos( ) + Vector( 0, 0, 64 ) )
		bubble:Spawn( )
hook.Add( "InitPostEntity", "SpawnEntities", SpawnEnts )

Type “lua_run_cl print(LocalPlayer():GetPos())” in your console.

Ok i think i got the pos thing down but its not spawning

Check your console for errors, is there any?

No theres none

“SpawnEntities” is a very, very generic name for an InitPostEntity hook. Perhaps it’s being overridden? Try a different name like “NPCTraders-InitPostEntity”.

so if i just replace thoes few lines will it spawn?

[editline]1st February 2011[/editline]


yay! that is my code! :slight_smile: with comments and everything! You can send me the vector and I will help you^^

This won’t fix it, but just saying, instead of doing Spawn[k], just use v. It’ll save you a few table lookups.