Basic LUA advice

MikehUKMikehUK Join Date: 2011-09-06 Member: 120215Posts: 1
Hi Chaps,

I'm a big fan of playing NS, have played it since ns1.04 all them years ago, I've decided i want to try out LUA programming and have decided to seek advice on how to get started in teaching myself the Language and writing some code to maybe be helpful for NS gamers. I have a few of idea's of my own on how to improve/implement certain aspects of the game which are slightly missed/overlooked.

I've looked on youtube/reading web pages devoted to LUA and have downloaded the Notepad++ program and have thought about starting off by writing a few codes and designing a few mods for World of Warcraft as it seems like a good place to start and teach myself but if anyone, knows of anywhere which helped them it would be greatly appreciated.

Also i thought it would be a good idea after playing games for 10+ years to finally teach myself to do something bit more constructive apart from ripping peoples faces off in NS and other games :)

Anyway, it was just a thought, will be greatly thankful to anyone who gives 2minutes of their time to help a newbie :)

Thanks Again,

Mike Brown.


  • IronsoulIronsoul Join Date: 2011-03-12 Member: 86048Posts: 869 Fully active user
    while I myself don't know lua. I do know some very very basic fundamentals of programming.

    1. The best way to learn programming, is to program.
    What I mean is, Learn LUA with ns2 since you are planning on modding ns2. Don't bother with world of warcraft.
    2. Learn the good programming practices first, it will be much harder to unlearn bad habits later.
    3. Don't rely on learn x in very short amount of time books.
    I would estimate it would take at least 100 hours to be a competent programmer of any language.
    By competent, I mean is able to understand what you are doing, why you are doing it, and know it's a good way of doing it. By it, I mean programming.
    4. Official documentation is often the best place to go for help. So the actual LUA website, wiki, forums etc are great places to go for advice.
    5. Try to find video tutorials, theyre great.

    I hope that doesn't discourage you at all, but I read it takes 10 000 hours to become a master at something. I assume you aren't going for a master LUA programmer, and even before you reach that 100 hour mark, you will be able to make some decent mods, you just have to understand that it will take time to get good at programming, just like it took time to be able to play ns effectively.

    Cya later while I stop being a hypocrite and get back to my homework :D.

    Now lets hope someone on this forum actually gives some solid websites and tutorials to go to, because I wouldn't mind learning lua for ns2 modding purposes myself.
  • SewlekSewlek The programmer previously known as Schimmel Join Date: 2003-05-13 Member: 16247Posts: 2,338 Fully active user
    If you want to write some stuff for NS2, read the NS2 code and not the wow UI code. There are only a few built in functions to learn from lua, and the syntax is very simple. I was programming a lot c++, php, java before I jumped to NS2 lua and I learned the syntax / built in functions in less than a day.
  • Racer1Racer1 Join Date: 2002-11-22 Member: 9615Posts: 1,525 Advanced user
    edited September 2011
    A few more suggestions:
    - Look at other simple mods, to find out what they did. Compare the original file with a modded file to see what they did, and then try to understand why. (Notepad++ should be able to do this; there are other tools as well).
    - Start small. Try to make a very small change and see if it works. Then move on.
    - Backup before you change. That way, if you screw it up, you can just restore the file and you're back in business.
    - Try out NS2Docs, which shows you most available Lua methods that can be called (and modified).

    P.S. Remember that while some changes can be made on the client side, others require that the server be changed. Consequently, you will probably have to run your own server to make many changes.
  • FehaFeha Join Date: 2006-11-16 Member: 58633Posts: 914
    QUOTE (Racer1 @ Sep 8 2011, 05:09 PM) »
    - Look at other simple mods, to find out what they did. Compare the original file with a modded file to see what they did, and then try to understand why. (Notepad++ should be able to do this; there are other tools as well).

    First time I see this advice. Must say that I like it, would probably help ppl learn modding pretty well.
  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Posts: 4,983 mod
    My suggestion is to use the copy of Decoda that comes with NS2 (you can access is via the launch pad). Also, Spark is nice in that you can change some (but not all) things while NS2 is running. So start NS2, edit things in Decoda, then try them immediately in game.
  • Electr0Electr0 Join Date: 2011-10-31 Member: 130337Posts: 349
    Im also interested in learning lua, i've done a little c++ in the past but still have a very basic idea of programming.

    It looks like lua might be a bit easier and more fun to play around with, so far i've found how to change certain values in the balance files but how do you do more interesting stuff like create a new game mode or add something new like a grappling hook for the gorge?

    If you know of any good video tutorials to learn lua or get a better understanding of programming in general that would be great, i find its easier to learn by watching than reading most of the time.
  • HarimauHarimau Join Date: 2007-12-24 Member: 63250Posts: 3,883
    edited December 2011
    For me, I think I'm like Electr0. I find it difficult to understand just how exactly the code hooks in to the game world - so in that case, the best I'm able to do, really, is balance numbers or modify the mathematics, rather than genuinely replace code, or write new features like a grappling hook, for example.
    If someone (anyone?) would create a kind of walkthrough document/video, where they take us through a lua file(s) in NS2 and look at each component/function, and they demonstrate how that affects/is shown in the NS2 gameworld*, that would really be amazing, and would probably go a long way in explaining how to actually craft new features.
    *This should be possible, since I believe NS2 lua files can be changed on the fly and their result displayed in-game immediately.
    Suggestions: ! @ # $ %
  • HackepeterHackepeter Join Date: 2003-06-08 Member: 17107Posts: 181
    Everything you'll need is already there :) Just figure out how UWE did certain things e.g. how they are adding text to the GUI or how they change the player model if somebody evolves as a alien into another life form. See the game code as a source for examples. Because there is atm no real API/SDK documentation you can only look how they did something and then adapt it to your own problems. Start with something simple and then go one with more advanced stuff. I guess that's how every mod is made so far. :)
Sign In or Register to comment.