Spawning Custom SWEPS With Hammer Entities?

I’ve created a map but I am wondering if it’s possible to spawn specific custom created SWEPS Ina a specific spot within a Hammer map? Preferably with entities but if it is only possible in LUA code could someone help me on that? Thanks.

Just create an entity in hammer and put in the same class name as your SWEP.

What type of entity? Probably a silly question though.

Do I place a standard weapon entity and just change the class of it?

Any entity. You are going to replace it’s classname anyway, so it doesn’t matter.

Thanks man.

Hm, how are you including the SWEPs with the map? Are you packaging the whole thing as an addon or are you somehow putting the code “into” the map (I heard that putting LUA code into maps is possible)?

Hammer doesn’t create the weapon itself, it just tell the game to spawn whatever “class_name” where the entity is at.

But I remember that some people were able to execute LUA code from a map somehow
or maybe I remember wrong

Correct me if I’m wrong but I think you do that the same way you run console commands from hammer, in this case you use lua_run “Your script”

Someone’s gonna have to help me out again, Robotboy said I need to have to just simply name the class name of an entity to the weapon name, however I can’t do this; the only way I can do this is by creating an FGD and even then it won’t work correctly because these are SWEPS and have Lua code toppled on them to make them work correctly, it would work if I simply replaced HL2 weapons but we’re making custom SWEPS.

I did find this however, perhaps Robotboy is referring to this in actuality? The weapon models are located in the following directory:
C:\Program Files (x86)\Steam\SteamApps\common\GarrysMod\garrysmod\gamemodes\candymountain\content\candy_weapons\models\weapons\sentry\

In this directory however, there are a variety of other folders which includes: lua, materials and sound:

I’m really not quite sure what to do here.

[editline]19th December 2013[/editline]

Figured it out. I am getting an error on one of the weapons though, a crazy physics error. Anyone know what this means?

Screw it. I coded some Lua into make the player have the gun when they spawn.