1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Help with Lua

Discussion in 'Civ5 - Creation & Customization' started by Halcyan2, Nov 17, 2013.

  1. Halcyan2

    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!
     
  2. Vicevirtuoso

    Vicevirtuoso The Modetta Man

    Joined:
    May 14, 2013
    Messages:
    775
    Location:
    The Wreckage, Brother
    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.
     
  3. Halcyan2

    Halcyan2 Emperor

    Joined:
    May 12, 2012
    Messages:
    1,380
    Thanks for the prompt response.

    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?
     
  4. Vicevirtuoso

    Vicevirtuoso The Modetta Man

    Joined:
    May 14, 2013
    Messages:
    775
    Location:
    The Wreckage, Brother
    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.
     

Share This Page