Legit location?

im trying to create a gamemode, and as a part of it, i make random spawning npcs, how do i make sure the random location of them isnt inside an object?

just make a table of secure spawn spots for the maps.

Figure out the size of the npc’s. When you spawn them do a find ent’s in box at the position you would like to spawn them. If you get a ent then you need to move on to a new spot.

And how do i do that? Also, Lau, how to i know which spots are clear? I cant use the hammer with a BSD protected map…

Use some script to view your current coordinates, write them down, move somewhere else, write down, repeat, then save them in a table, then set the NPC to any of those in the table.

Ok, thanks… One more question about these stuff, how do i know a model class in a protected map?

What do you mean?

Hmmm… Each object (entity) has a name which is used to be accessed, right? How do i find out what it is?

entity:GetName() ??

lua_run print(Entity(1):GetEyeTrace().Entity:GetName());

in console (untested)

[editline]29th October 2011[/editline]


Oh, you mean the targetname you set inside hammer? GetName should return that, otherwise, you can try:


If you want to do secure spawn points wouldnt a trace be the best option?

I’m doing that for cars in the garage.