Mod Load Order

Discussion in 'Civ5 - Creation & Customization' started by Kasdar, May 30, 2011.

  1. Kasdar

    Kasdar Warlord

    Joined:
    Jul 29, 2006
    Messages:
    268
    Location:
    Minnesota
    I am worndering if it is possible to add an LUA file with something along the lines of print("Kasdar's Changes Mod"); to each mod I am using so I can easily tell using Firetuner which order my mods are loading in, I am not all that familiar with LUA files so I dont know if having each mod load a LUA with just a print statement will work. Also I need to know if I would have to have a MD5 code for a file in the modinfo files, and how to generate one, if needed for a mod that I didnt create in modbuddy.

    Edit: actually it might benefit everyone if they included an LUA file that does just that to their mods.

    Edit2: I also need to know if there is anything I need to do to get the LUA file I create to actually load, as I know it cant be added to the OnModActivated UpdateDatabase block
     
  2. takkyon

    takkyon Chieftain

    Joined:
    May 11, 2011
    Messages:
    42
    In order to get the LUA file to load, you just need to set the load into VFS property to true.
     
  3. Kasdar

    Kasdar Warlord

    Joined:
    Jul 29, 2006
    Messages:
    268
    Location:
    Minnesota
    I just tried that, and it does not work, I believe the VFS property is only for replacing existing LUA files.
     
  4. Spatzimaus

    Spatzimaus Mad Scientist

    Joined:
    Sep 21, 2005
    Messages:
    3,063
    Location:
    Los Angeles, CA
    For modified versions of existing Lua, you use VFS=true

    For NEW Lua, you go to the Content tab of the properties of the mod, and set it to InGameUIAddin. The middle two fields don't really matter, but the final column is the file name.
    Do NOT use VFS=true for newly-made Lua, or it sometimes will execute twice. (But not always.)

    The other thing is that Lua needs a triggering event. Start of turn, when a unit is created, whatever. Some of these triggers don't actually work. So even if your new custom Lua loads, it might not actually do anything.
     
  5. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,583
    Location:
    Near Portsmouth, UK
    The MD5 value is ignored during the mod loading phase (I believe it's only used during the upload to / download from the ModHub to ensure file integrity during the network transfer)

    To add a .lua file to any mod that just prints out a message

    1) Find the mod's sub-directory in "...\My Documents\My Games\Sid Meier's Civilization 5\MODS"

    2) Edit the .modinfo file (with a simple plain text-editor such as Notepad), locate the <Files> block and add
    Code:
    <File md5="7F472968CE0327E41133B0191D3B5431" import="0">idme.lua</File>
    3) Locate the <EntryPoints> block and add
    Code:
        <EntryPoint type="InGameUIAddin" file="idme.lua">
          <Name>ID Me</Name>
          <Description>Print my identity</Description>
        </EntryPoint>
    4) Save the file

    5) Create the file idme.lua (again with notepad) in the same directory as the .modinfo file

    6) Add the line
    Code:
    print("This is the 'XYZ' mod script.")
    7) Save the file

    8) Start civ, enable the mod and look in the "...\My Documents\My Games\Sid Meier's Civilization 5\Logs\Lua.log" for the message (or use Live Tuner)

    You will almost certainly need to enable the logging system in your config.ini file
    Code:
    ; Enable the logging system
    LoggingEnabled = 1
    But now for the bad news, if you have mods A, B, C and D installed but only A B and D enabled, the load sequence may be A, D, B if you enable C the load sequence may be B, A, C, D if you then disable C again, the load sequence may be D, B, A - so in short, if you need to guarentee that A has loaded before D you can't assume that choosing a "correct" names will make it happen.

    There is a feature in ModBuddy to define mod dependencies, but I seem to remember reading somewhere that it is broken (or not yet implemented)

    HTH

    William
     
  6. SamBC

    SamBC Emperor

    Joined:
    Feb 2, 2010
    Messages:
    1,052
    Location:
    Lancaster
    However, none of these methods will make it print the message at mod load time. An event listener won't even get registered then. What it will do is add them to the list of Addins, so you may get the right order out of them, but it will be later than when they are 'loaded'.

    It could actually be useful to be able to execute arbitrary Lua at the time the mod is loaded, at least in terms of investigating the underlying system.
     

Share This Page