Medic NPC help

Like the title says, I’m trying to make an NPC, just a basic one, not an SNPC. What I want to do is make an NPC that will act just like the medic does, and heal you when you’re injured. I’ve tried adding this:

SpawnFlags = SF_CITIZEN_MEDIC,
in, and it works fine, as in I'm at 100 hp he does nothing. At 99 or lower, he'll give me a medipack if I walk near him, except for one problem, it doesn't actually heal me. Any suggestions?

Edit: Also I would like to know how to change the NPC’s physical properties via Lua(if that’s possible), like so it doesn’t bleed when shot, but sparks and has a metallic clang. Thanks in advance!

You might need to somewhere indicate it giving the ent_healthpack or whatever.

How would I do that? This an NPC, not an SNPC, btw.

NPCs basically are SNPCs

They are still scripted.

I know that, I just didn’t think you could define a schedule, or whatever it’s called, on an NPC.

[editline]11:46PM[/editline]

come on, i’m sure someone can help

Maybe look here. http://developer.valvesoftware.com/wiki/Npc_citizen

well, thanks for the link, but im kind of noobish at lua, i can do some very basic stuff, but I already tried the spawn flag medic. it makes an error when i try to spawn my npc. I’ll post the code in case anyone needs it:

local Category = "The Grand Republic"


local NPC = { Name = "Parjai Trooper",
Class = "npc_citizen",
SpawnFlags = SF_CITIZEN_MEDIC,
Model = "models/SGG/Starwars/clonetrooper_bee.mdl",
Health = "300",
KeyValues = { citizentype = 4 },
Category = Category }

list.Set( "NPC", "npc_bee", NPC )

anything wrong there? btw, im using shotgunguy49’s clonetrooper models, but i wont release without his permission. or until i get this medic thing working :frowning:

[editline]09:25PM[/editline]

looked more closely at the link, it appears thats about C++ coding, or whatever hl2 npcs are coded with.

It’s telling you spawn flags and stuff.

i know, if you had looked at my earlier post u would’ve seen that I already tried the medic spawnflag

Go into hammer and look at the spawnflag values for the npc_citizen. Find the value of “Medic” and use that.

Hmm, hadn’t thought of that. Thanks, I’ll try.

sorry about late response, but i had to reinstall hammer, but got bored waiting for it to install, so i played gmod, and was playing it for a couple of hours after it finished. aaaaaanyway, i’m kind of stumped here. on hammer, i found the spawnflag for medic and everything, but how would i implement that on a LUA-coded NPC, not an SNPC. or, like my other thread, you could supply me with a SNPC tutorial/template.

i tried just doing npc_citizen, and i also tried npc_citizen_medic on the class, would anyone have any idea what i would put on the class to make him heal me?

In hammer, check all the spawnflags you want and find the value (including the Medic one).
In Lua, do this:


npc:SetKeyValue("spawnflags","value of spawnflags you want")

It should be an npc_citizen.

uhhh, ok thats for an npc right? and if it is, what would i put in for the value of spawnflags? sorry, im VERY noob.

Yes, that’s for an npc_citizen.

Yeah, sorry, i mean what would i put for that?

I just told you twice. You need to go into hammer, check all the spawnflags you want, and find the value of all of the spawnflags.

ohhhh, ok sorry…

[editline]07:22PM[/editline]

ok, i should probably be rated dumb for this, but how would i find the value of the spawnflags?

I wouldn’t rate you dumb for asking questions. People who do that are idiots.

In hammer, when you open an entity’s properties, there’s a “flags” tab. Choose that and check all of the ones you want. Then go back to the original tab and uncheck “SmartEdit” (in the upper right corner of the properties window). Somewhere on that list is “spawnflags”. What you want is the value just to the right of it.