Cope
Oct 01, 2010, 05:09 AM
So I'm new here, but I thought I'd share a couple programs that have already made modding easier for me.
Windows Grep (http://www.wingrep.com/)
The first is Windows Grep, which is free to use. It mimics the grep command on Linux, which lets you search for a specific string inside any number of files or folders. Very useful for finding TXT_KEY's or anything else really, just point it at the Assets folder, put in your search string and *.lua, *.xml as the file types and off you go.
PE Explorer (http://www.heaventools.com/download.htm)
The second is maybe a bit more esoteric, but it's helped me out with .lua scripting. One thing I can't find anywhere is a list of what functions are available, like City:GetFoodTurnsLeft() for example. So for this I use PE Explorer, which comes with a 30 day trial but I'll leave it up to your imagination to find a version without that. This one probably needs a short tutorial, so here goes:
Most of the available functions are in "CvGameCoreDLLFinal Release.dll" in the root Civ V directory. Open this in PE Explorer then go to View > Exports. Here is a list of *most* of the available functions, but not all of them. It's a bit hard to read, but clicking on any function will give you a slightly better description of it in the box below the function list. See the screenshot attached.
For example in the screenshot I've selected ?getBuiltTime@CvPlot...., which translates to:
public: int __thiscall CvPlot::getBuildTime(enum BuildTypes)const
Which tells me this function can be called from a Plot object, expects a BuildType to be passed with it, and returns an integer (a whole number). So in a .lua file, I could do:
local testPlot = Map.GetPlot(m_iCurrentX, m_iCurrentY);
local buildTime = testPlot.GetBuildTime(BuildType.BUILD_FARM);
Which should return the number of turns it will take to build a farm on that particular plot. Finding the BuildType is another instance where Windows Grep is handy, just search for BuildType and it'll find the .xml with a list of all valid build types (in this case CIV5Builds.xml). Note that in .lua the first letter is capitalized too, GetBuildTime.
As I said before some functions don't show up in the export list, there's a way to find these too but it's a little more complicated. I think I'll leave that for another post if people are interested.
Notepad++ (http://notepad-plus-plus.org/)
Lastly, I'm sure everyone who's modded Civ before will know this one. Notepad++ great for looking through .lua or .xml files to find something you want, before you import it into your mod via ModBuddy.
Windows Grep (http://www.wingrep.com/)
The first is Windows Grep, which is free to use. It mimics the grep command on Linux, which lets you search for a specific string inside any number of files or folders. Very useful for finding TXT_KEY's or anything else really, just point it at the Assets folder, put in your search string and *.lua, *.xml as the file types and off you go.
PE Explorer (http://www.heaventools.com/download.htm)
The second is maybe a bit more esoteric, but it's helped me out with .lua scripting. One thing I can't find anywhere is a list of what functions are available, like City:GetFoodTurnsLeft() for example. So for this I use PE Explorer, which comes with a 30 day trial but I'll leave it up to your imagination to find a version without that. This one probably needs a short tutorial, so here goes:
Most of the available functions are in "CvGameCoreDLLFinal Release.dll" in the root Civ V directory. Open this in PE Explorer then go to View > Exports. Here is a list of *most* of the available functions, but not all of them. It's a bit hard to read, but clicking on any function will give you a slightly better description of it in the box below the function list. See the screenshot attached.
For example in the screenshot I've selected ?getBuiltTime@CvPlot...., which translates to:
public: int __thiscall CvPlot::getBuildTime(enum BuildTypes)const
Which tells me this function can be called from a Plot object, expects a BuildType to be passed with it, and returns an integer (a whole number). So in a .lua file, I could do:
local testPlot = Map.GetPlot(m_iCurrentX, m_iCurrentY);
local buildTime = testPlot.GetBuildTime(BuildType.BUILD_FARM);
Which should return the number of turns it will take to build a farm on that particular plot. Finding the BuildType is another instance where Windows Grep is handy, just search for BuildType and it'll find the .xml with a list of all valid build types (in this case CIV5Builds.xml). Note that in .lua the first letter is capitalized too, GetBuildTime.
As I said before some functions don't show up in the export list, there's a way to find these too but it's a little more complicated. I think I'll leave that for another post if people are interested.
Notepad++ (http://notepad-plus-plus.org/)
Lastly, I'm sure everyone who's modded Civ before will know this one. Notepad++ great for looking through .lua or .xml files to find something you want, before you import it into your mod via ModBuddy.