1. Post #1

    February 2012
    34 Posts
    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

  2. Post #2

    July 2007
    864 Posts
    list.Set(
    Isn't closed.

  3. Post #3

    February 2012
    34 Posts
    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?

    Edited:

    list.Set(
    Isn't closed.
    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.

  4. Post #4

    July 2007
    864 Posts
    And category isn't a string?

  5. Post #5

    February 2012
    34 Posts
    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.
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Dumb Dumb x 1 (list)

  6. Post #6

    July 2007
    864 Posts
    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.

  7. Post #7

    February 2012
    34 Posts
    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 )

    Edited:

    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.
    Maybe because the .mdl has a /player in it?

  8. Post #8

    July 2007
    864 Posts
    So, how much of it does work?
    Is it showing up in the list?

  9. Post #9

    February 2012
    34 Posts
    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

  10. Post #10

    July 2007
    864 Posts
    So it's not in the list I take it?
    Give me a second, I never use list.Set myself.

    Edited:

    Second Argument of list.Set should be the Class..
    You can do this:
    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 )
    
    Reply With Quote Edit / Delete Reply Windows 7 Denmark Show Events Lua Helper Lua Helper x 1 (list)

  11. Post #11

    February 2012
    34 Posts
    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?

  12. Post #12

    July 2007
    864 Posts
    Is this for a gamemode?

    Edited:

    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"

  13. Post #13

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

    Edited:

    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

  14. Post #14

    July 2007
    864 Posts
    Put it in (root)/lua/autorun/mynpc.lua (Or another name)

    Edited:

    I do, "freze1231" feel free to add me.

    Edited:

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

  15. Post #15

    February 2012
    34 Posts
    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?

  16. Post #16

    July 2007
    864 Posts
    Uh, does the model exist?
    But, where is your file located?

  17. Post #17
    Pycские Идиот
    LauScript's Avatar
    June 2010
    2,447 Posts
    moral of the story don't start with npcs. start with hello world files and learn basic variable types.


    just saying.
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Agree Agree x 2 (list)

  18. Post #18

    February 2012
    34 Posts
    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.

    Edited:

    This was solved, can this thread be locked now?
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Dumb Dumb x 3 (list)

  19. Post #19
    shadowndacorner's Avatar
    May 2011
    193 Posts
    E2!=lua

    just saying
    Reply With Quote Edit / Delete Reply Mac United States Show Events Agree Agree x 2 (list)

  20. Post #20
    Facepunch's Local Lycanthrope
    Contron's Avatar
    December 2008
    1,759 Posts
    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.

    Edited:

    This was solved, can this thread be locked now?
    There's no need to act like an asshole about it.

  21. Post #21

    February 2012
    34 Posts
    No, i wasnt. Just typing something makes anything sound assy i am not a douche, nor am i to anyone on these forums.