Getting Started...
Belliferous Bloss
Join Date: 2009-06-13 Member: 67818Members
in Modding
For a long while I have been wanting to get into the modding community, but just haven't had the time. Now that has changed, and I'm trying to find the best way of getting started, Learning lua and eventually modding the spark engine are goals I want to accomplish at the moment. Any tips, helpful guides, etc would be awesome. I have some experience with C++, and Java, but prefer to learn as if i haven't experienced with any language.
Comments
Lua For Windows: <a href="http://code.google.com/p/luaforwindows/downloads/detail?name=LuaForWindows_v5.1.4-37.exe" target="_blank">http://code.google.com/p/luaforwindows/dow...s_v5.1.4-37.exe</a>
Lua is an interpreted, general purpose language. The above documentation should be enough to get you started (and NS2s implementation has some additional features that you can take advantage of) and Lua For Windows (assuming of course, that you run Windows) will install the Lua interpreter. Note that vanilla Lua does not require classes... in fact, it doesn't even have Class facilities by default. To get back to your C++/Java roots, the Engine Test does have some built-in class features.
To enter Immediate Mode, simply execute Lua.exe and the Lua script you type in will be executed immediately. It is pretty much preferred to write Lua in text files and to have Lua execute your script, you can simply pass it the filepath like so:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->lua.exe C:\myFolder\myScript.lua<!--c2--></div><!--ec2-->
Off the top of my head, you are not strictly required to use *.lua as your extension for the Lua interpreter, but I think NS2 requires it.
Hello World:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->function HelloThar()
print("Hello World!")
end
HelloThar()<!--c2--></div><!--ec2-->
Messing around with the Lua interpreter will help you learn Lua, but to mess around with the modding functionality in NS2/Engine Test, you need to first pre-order and use their modding architecture. As far as engine moddability is concerned, we can't currently modify the engine in any way, and I don't think there has been any word about whether or not its planned. I assume it will be however, as I believe they plan on licensing their engine.
<a href="http://www.unknownworlds.com/ns2/wiki/index.php/Lua" target="_blank">http://www.unknownworlds.com/ns2/wiki/index.php/Lua</a>
Myself I started with learning lua for gmod, which had a much larger documentation, and many more tutorials. When it comes with lua for ns2 I am still struggling to get the flash-lua part to work right.
However, the way I started with ns2 lua was set up a goal for what I wanted to accomplish, then figure out how I wanted to do it. Which for me was spawning a prop of a certain model, by using a modified gun where lmb places prop, rmb removes it.
Was not to hard tbh, we got the source code for the test gun, and it contain lots of usefull comments about what does what. Paired with reading the modified guns from this community mod thing, it actually got very easy.
And beyond this point (as in, when you dont want to be pure lua, and want to use menus (flash) aswell) I cant help you very much, as the next part I wanted to do was a menu I open with gun (works), where the flash calls lua functions to make buttons (fail, says the function does not exist), and when I press button it spawn prop with selected model (fail, I cant press stuff on the menu).
However, I suggest that if you get any problems that you feel are very hard, you have a thread where you can ask for help, maybe this one. Not very usefull when other people dont get same error tho :P.
Goodluck, and tell us if you need help ;).