Is this NPC code right?

I am new to LUA and absolutly love it. I learned (I think) how to make NPCs, and i am having troubles finding it in my NPC menu. Any suggestions?

local NPC = { Name = “SAS NPC”,
Class = “npc_combine_s”,
Model = “models/player/ct_sas.mdl”,
Health = “25000”,
Category = Animals}

list.Set( “NPC”, “SAS”, NPC

The original code is

local NPC = { Name = “Name here”,
Class = “npc_citizen”,
Model = “models/name_here.mdl”,
Health = “250”,
Category = Category }

list.Set( “NPC”, “npc_name_here”, NPC )

Did i do something wrong? Please respond ASAP

list.Set(
Isn’t closed.

Oh, wait. Wouldnt that make it undetectable as well? I will try. But all in all, the code looks good?

[editline]24th February 2012[/editline]

local NPC = { Name = “Female Metrocop”,
Class = “npc_combine_s”,
Model = “models/police_female.mdl”,
Health = “200’”,
Category = Category }

list.Set( “NPC”, “npc_cpbitch”, NPC )

This is the chick combine code and all the others in the MetroPolice addon are closed statments, and they work perfectly fine.

And category isn’t a string?

Can I MOD lock this forum? I am getting help from the Post your questions thread.
@Freze, no offense, your suggestions arent helping, you are not explaining much. Sorry.

You’re not really taking it. I’m telling you, to close your function, and to make Category a string.

What you’re doing is asking me to do it for you.

If you’re not capable of making two " you shouldn’t be doing lua.

wait, I think i found what you were saying, sorry, here is my updated code and it still doesnt work

local NPC = { Name = “SAS NPC”,
Class = “npc_combine_s”,
Model = “models/player/ct_sas.mdl”,
Health = “200”,
Category = “Animals” }

list.Set( “NPC”, “npc_SAS”, NPC )

[editline]24th February 2012[/editline]

Maybe because the .mdl has a /player in it?

So, how much of it does work?
Is it showing up in the list?

No, but i know i got it this time. Like, It wont show up as a combine soldier either, i spawned one of every NPC i had and not a single on of them was my SAS guy

So it’s not in the list I take it?
Give me a second, I never use list.Set myself.

[editline]24th February 2012[/editline]

Second Argument of list.Set should be the Class…
You can do this:
[lua]
local NPC = {
Name = “SAS NPC”,
Class = “npc_combine_s”,
Model = “models/player/ct_sas.mdl”,
Health = “200”,
Category = “Animals”
}
list.Set( “NPC”, NPC.Class, NPC )
[/lua]

OK, so I need to put the class on list.Set( “NPC”, NPC.Class, NPC ) and where local NPC is I put the section i want to create or do i put it under an existing category?

Is this for a gamemode?

[editline]24th February 2012[/editline]

NPC.Class is a variable. It’s NPC table above, and it’s key “Class” which is a string holding “npc_combine_s”.
You can do
list.Set( “NPC”, NPC.Class, NPC )
or
list.Set( “NPC”, “npc_combine_s”, NPC )
But it will be the same, since NPC.Class is “npc_combine_s”

Nononono, lol. I want to make my own NPCs, i am just using this as a begginer place for LUA,

[editline]24th February 2012[/editline]

wait
do u have skype? I can show you my screen and what i am doing there. I dont have a mic so i cant talk

Put it in (root)/lua/autorun/mynpc.lua (Or another name)

[editline]24th February 2012[/editline]

I do, “freze1231” feel free to add me.

[editline]24th February 2012[/editline]

Or add me on steam, that might be easier.
Link here
<----

local NPC = {
Name = “SAS NPC”,
Class = “npc_combine_s”,
Model = “models/player/ct_sas.mdl”,
Health = “200”,
Category = “Animals”
}
list.Set( “NPC”, NPC.Class, NPC )

this is EXACTLY my code, can i import this into gmod and it work now?
Or better yet, heres another question that might solve this: What is on my code that you dont include? Because i am doing everything you tell me to fix, and it still doesnt work. Would you like me to get another model?

Uh, does the model exist?
But, where is your file located?

moral of the story don’t start with npcs. start with hello world files and learn basic variable types.

just saying.

Nah, i started with E2, so i could skip a chunk of that Hello world Bull crap. He was able to correct me, so moral of the story is, please dont comment on a question unless you are helping, that is a banable offense.

[editline]24th February 2012[/editline]

This was solved, can this thread be locked now?

E2!=lua

just saying

There’s no need to act like an asshole about it.