• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Help with Lua

Halcyan2

Emperor
Joined
May 12, 2012
Messages
1,380
I'm working on my first Civ V mod and I'm having issues with incorporating Lua changes. (The XML changes seem to be working fine). Right now I am having two issues:

1. When opening a large Lua file (such as replacing the "AssignStartingPlots.lua" which is 462 KB), Mod Buddy takes a really long time to make any changes (even a single character change). Anyone know what the issue is? My best guess is that since Mod Buddy is constantly checking for programming errors, with a large file it needs to check after every single character change....

2. The changed Lua files don't seem to be working (being used) in the Mod. I know that for XML files, you need to update the database through Properties->Actions and then select "OnModActivated" and "UpdateDatabase" for each XML file. Do I need to do something similar to activate the Lua files?

Sorry if these are obvious (to experienced modders) questions. Thanks for any help you can provide!

EDIT: Okay, going through some online guides, it looks like I need to manually set the Import into VFS option to "True". Now going to try that!
 
1. I've had trouble with this myself. Consider using an alternative text editor, such as Notepad++, to make changes, then save them and open your project in Modbuddy to build it.

2. You only need to set VFS to True if you are replacing a core Lua file (like CivilopediaScreen.lua, UnitPanel.lua, etc.). For any custom Lua scripts, you would want to go to the "Content" tab in your mod properties, click "Add...", then add the file as an InGameUIAddin type (even if it isn't UI-related at all). Note that you will most likely need to select your file from the drop-down box first, even though it is the last field in the dialog box. For whatever reason, once you select a Type, it won't show any .lua files in the File drop-down.
 
Thanks for the prompt response.

1. I've had trouble with this myself. Consider using an alternative text editor, such as Notepad++, to make changes, then save them and open your project in Modbuddy to build it.

2. You only need to set VFS to True if you are replacing a core Lua file (like CivilopediaScreen.lua, UnitPanel.lua, etc.). For any custom Lua scripts, you would want to go to the "Content" tab in your mod properties, click "Add...", then add the file as an InGameUIAddin type (even if it isn't UI-related at all). Note that you will most likely need to select your file from the drop-down box first, even though it is the last field in the dialog box. For whatever reason, once you select a Type, it won't show any .lua files in the File drop-down.

Yes, I just learned that you need to set the VFS to True before the files appear selectable under the Content section (before they weren't showing up at all).

The two files are modifications to AssignStartingPlots.lua and NaturalWondersCustomMethods.

Should I select "InGameUIAddin" as the Type? Or should they go under "MapScript" since they modify the map scripting procedure?

EDIT: I suspect that it should still be "InGameUIAddin" since I am trying to change the underlying scripting rules (which would apply to any particular map choice). Based on the description under Content, it sounds like "MapScript" is when you have a custom map parameters that can be selectable when generating a map and my modification deals with underlying rules for any mapscript and is not a mapscript per se. Does that seem right?
 
If you're changing a Lua file that already exists in the game, just set the VFS to True and do nothing else. Although I've never made or edited a map script, so I don't know if there are any differences in what you have to do for those.
 
Back
Top Bottom