Replicating a default NPC under a different name

Is it possible to replicate a NPC under a different name (basically copying a NPC). So for example to copy the npc_cscanner and then keep it, but also make it npc_dscanner.

Find it in the Garry’s mod folder and Copy plus Paste it and edit the coding maybe.

Not there, because he spawns a HL2 Entity that was created in a different programming language. What garry did was allow you to spawn that entity with the push of a button.

here is how oyu get the source:

go onto source SDK, make a mod, browse arround and look for some C++ files and maybe some H and you will find it

no idea on how to compile it though :3

Ok forget the 3 previous answers. The short answer is that you can’t do that since in Garry’s Mod you can only derive from other scripted entities. You do have some options though.
You could completely recreate the NPC in lua so that you can base yourself on it. This would of course be quite complicated. Depending on what you intended to do you could simply get away with spawning the regular NPC then changing it’s properties and hooking to the evwnts you want to tweak.

Damn, you see what I want to is: A friend of mine made me a script so that you can make the City Scanner shoot and drop mines, but it looks for npc_cscanner and I want to make multiple types of this enemy with different difficulties. I guess I gotta try re-creating the City Scanner.

Thanks for the reply.

Hmm? Can’t you just spawn some scanners and then reference them using something else then the class name?
Something like that :
scanner.Difficulty = x

Then make the script act differently according to the difficulty set for that scanner.

So for example would this work:
The npc
[lua]local NPC = QuickNPC(“shootscanner”, “Arial Assult Scanner”, “npc_cscanner”, “combine”)
NPC = AddMultiplier(NPC, 20, 1)
NPC.DeathDistance = 14

The custimization bit:
[lua]local distMax = 1000 – Maximal distance the scanner can attack
local spread = 0.03 – Bullet spread
local damage = 4 – Amount of damage the bullets do
local numBullets = 1 – Amount of bullets shot each time
local rate = 0.1 – Rate of fire
local distEnemy = -1 – The distance the scanner should keep to the enemy (-1 = use default distance)
local bEquipWithLandmine = true – Equip scanner with a landmine?
local landMineDropDist = 250 – Minimal distance to the enemy at which the dropmine should be dropped
local bEnableSpotlight = true – Enable spotlight of the scanner?
local degShoot = 35 – Maximal degree at which the scanner can shoot the enemy[/lua]

And then do for example:
[lua]local NPC = QuickNPC(“shootscanner”, “Arial Assult Scanner”, “npc_cscanner”, “combine”)
NPC.local damage = 2 --Quick guess
NPC = AddMultiplier(NPC, 20, 1)
NPC.DeathDistance = 14

local is not part of the name, it’s a token that restricts the variable’s scope. You would need to change the script to either accept parameters in the function that makes the scanner or make these variqbles a part of the created NPC’s table. This will require a small rewrite so that the script uses the values given to the npc instead of constants.