Where would I start learning LUA for civ?

Pizza Guy

Chieftain
Joined
Jun 29, 2016
Messages
17
I already know how to use SQL and XML, but that can only get you so far. I want to learn LUA, so I can actually start making meaningful changes to the game. I already read this, but I didn't really get it... Hopefully that will change with enough time, and me learning LUA. But I honestly have no idea where to start. That's why I come to you, to ask you for advice. I need to know where the path to learning LUA begins. And I hope you will know.
 
The way I 'learned' lua was by looking at other people's codes (on CivFantaics), and then trying to understand what they did. An alternative would that to be to download mods (but NOT those gigantic total conversion mods; start with the "simple" and smaller mods) and look at how they achieved to code their UA/UU/UB/whateverelse.

That being said, I already knew several things about the basics of coding (though Lua is a tad bit different in some syntax, the idea is the same), and I bet that helped me a lot trying to understand Lua. So any experience in stuff such as java(script), php, python, GameMaker Language, or even something as simple as Scratch would already help out a lot! If you don't, you could try to search for "The basics of coding" in Google, which I bet would contain some great tutorials/explanation videos!

Now, I'm nowhere near being a Lua master (heck, I'm still a novice), but I've found out that simply trying to code stuff has learned me a lot. Don't be afraid to open up a thread if you don't know where to start coding your UA (or whatever else), don't be afraid to open up a thread to ask a specific question regarding Lua, and don't be afraid to open up another thread if you've gotten somewhere with your code, but don't know how to continue! (Or create your own 'inquiries-thread', which many people (including me) have done so that they won't spam the forums ;))

Anyhow, Good Luck!
 
The way I 'learned' lua was by looking at other people's codes (on CivFantaics), and then trying to understand what they did. An alternative would that to be to download mods (but NOT those gigantic total conversion mods; start with the "simple" and smaller mods) and look at how they achieved to code their UA/UU/UB/whateverelse.

That being said, I already knew several things about the basics of coding (though Lua is a tad bit different in some syntax, the idea is the same), and I bet that helped me a lot trying to understand Lua. So any experience in stuff such as java(script), php, python, GameMaker Language, or even something as simple as Scratch would already help out a lot! If you don't, you could try to search for "The basics of coding" in Google, which I bet would contain some great tutorials/explanation videos!

Now, I'm nowhere near being a Lua master (heck, I'm still a novice), but I've found out that simply trying to code stuff has learned me a lot. Don't be afraid to open up a thread if you don't know where to start coding your UA (or whatever else), don't be afraid to open up a thread to ask a specific question regarding Lua, and don't be afraid to open up another thread if you've gotten somewhere with your code, but don't know how to continue! (Or create your own 'inquiries-thread', which many people (including me) have done so that they won't spam the forums ;))

Anyhow, Good Luck!

My extent of programming knowledge is pretty much just Gamemaker Language, but I am semi-good at it. I also used LUA for making a game in LÖVE 2d, but it was very simple and primitive.
 
I recommend Whoward's Lua Cheat Sheet btw, which is a list of all the Game's Lua-functions. E.g. pUnit:SetHasPromotion(iPromotion,bValue) is used to grant/remove a promotion to pUnit.

The p, i, b, or any other letter in front of the variable names are from Hungarian Notation, which most people use here.

P.s. Again, the Lua syntax is a lot different from GameMaker's, which you'll need some time to get used to (I speak from experience ;))
 
I recommend Whoward's Lua Cheat Sheet btw, which is a list of all the Game's Lua-functions. E.g. pUnit:SetHasPromotion(iPromotion,bValue) is used to grant/remove a promotion to pUnit.

The p, i, b, or any other letter in front of the variable names are from Hungarian Notation, which most people use here.

P.s. Again, the Lua syntax is a lot different from GameMaker's, which you'll need some time to get used to (I speak from experience ;))

Thanks!
 
One of the best ways to learn "Lua for CivV" is to look at the Lua provided by Firaxis - specifically that for the DLC scenarios.

Start with the simple scenarios, eg the Mongol hoard or the Korea invasion, and work your way up. Most of the "smarts" for the scenarios are in the TurnsRemaining.lua file in the DLC scenario sub-directory, eg "C:\Program Files (x86)\Steam\steamapps\common\Sid Meier's Civilization V\Assets\DLC\DLC_05\Scenarios\KoreaScenario"
 
Top Bottom