Results 1 to 1 of 1

Thread: EIC v2.0 | Enabling sub-mods/Adding custom units to manpower restrictions

  1. #1

    Default EIC v2.0 | Enabling sub-mods/Adding custom units to manpower restrictions

    How to: use plugins to enable submods and add your own units to the manpower restrictions

    Part 1 - Using Plugins to enable submods


    So why would you want to make or even use a plugin? Well a lot of people won't, but some may want to use submods provided in the EIC submod forum or mods from other parts of TWC to enhance their gameplay experience. This would normally cause a problem to people using the launcher - if the mod needed to be activated via the user.script file, as the EIC launcher overwrites this file with it's own version of it quite frequently (potentially erasing any changes you may have made to enable any submods). This is where plugins come in - they are simply text files that tell the launcher to enable a mod when it is editing the user.script file. We've even included basic error checking - if the pack file cannot be located in your data directory it won't be enabled!

    So lets begin with how to make a plugin. There are some general rules when it comes to EIC plugins:
    • The plugin file must be a text file (.txt format)
    • The plugin file must be stored in data\Europe in Conflict\Launcher\plugins
    • The plugin must contain the name of the mod pack you wish to enable and nothing else (examples shown below)
    • The name of each plugin text file must start with "plugin_" (examples shown below). After this you can name the plugin as you wish
    • The name of your plugin does not need to reference the file it is activating; this is handled by the text inside of the plugin file.
    • Each individual mod must have it's own plugin file; you cannot activate two mods with the one plugin
    • You can use as many plugins as you like!


    Here is a picture of my plugins directory:

    Spoiler Alert, click show to read: 


    As you can see there are 4 plugin files there (really only 3, you'll see why in a minute). 3 of them don't work, one of them does.

    Let's start examining them. The first file, "A plugin that doesn't work.txt", isn't even a valid plugin as it doesn't start with "plugin_". There's no need to even open it up as the launcher won't recognise it as a plugin (so we needn't worry about it's contents)

    The second file, "plugin_A working plugin.txt", is correctly named. So let's open it to see the file contents.

    Spoiler Alert, click show to read: 


    As you can see, it contains the text "Example Plugin.pack" (without the quotes) and nothing else. As the next picture demonstrates, I have a pack file in my data directory called "Example Plugin.pack", so we will expect this plugin to validate.

    Spoiler Alert, click show to read: 


    The third file, "plugin_Another plugin that doesn't work.txt" is named correctly. However, this file contains the text "Example Plugin.pack" with the quotes. The quotes are not needed and will cause issues.

    "The fourth file, plugin_examplePlugin.txt" is, again, named correctly. It contains the text "myMod.pack". Again, the quotes are not needed. As well as that, the file "myMod.pack" does not exist in my directory. So quotes or no quotes, that one wouldn't work.


    The following picture shows what happens when I checked for plugins using the launcher. (Apologies for the poor formatting with long names, will sort that out later)
    Spoiler Alert, click show to read: 


    As expected, only one plugin validated (plugin_A working plugin). The file "A plugin that doesn't work" wasn't even recognised by the launcher, and the other two plugins failed to validate.

    An important note about plugins: If a plugin is found and validated it will automatically be activated. Be careful when using plugins.

    If you're having any difficulty with this process just make a post here


    Part 2 - Adding your own units to the manpower restrictions


    If you are the developer of a mod which adds units to EIC (or even just a user ) you may want to include your new units in the manpower restrictions, especially if you want to avoid AI spam. To begin this process, go to "\..\napoleon total war\data\Europe in Conflict\" and open the file "manpower extension script.lua" using a text editor (preferably one with syntax highlighting, such as Notepad++). The file has full instructions included in it, but I'll paste them here for all to see

    Don't be daunted by the long set of instructions - adding your own units is really very easy If you have any problems or issues, just make a post here

    Spoiler Alert, click show to read: 
    Quote Originally Posted by manpower extension script instructions
    -------------------------------EiC SCRIPTING----------------------------------
    -------------------------Manpower Extension Script----------------------------
    ------------------------------------------------------------------------------
    ------------------------------------------------------------------------------
    **************************************************************************
    ------------------------------------------------------------------------------
    ------------------------------------------------------------------------------
    --INTRODUCTION
    ------------------------------------------------------------------------------
    ------------------------------------------------------------------------------
    This file is used to extend manpower limitations to units added to EiC via submods. Note that manpower only affects the factions listed below,
    in EiC v2.0 we use db-based hard limits for all other factions. Alos note that the manpower system does not lend itself well to units being shared between factions.

    If you are editing this in notepad++ (recommended) you will see some of the writing is in green. Anything in green is a comment, and will be ignored by
    the game - it's simply there for useage instruction.

    The general rules are:
    • *Each unit key must be surrounded by quotation marks (""). Examples below.
    • *If adding more than one unit to a faction, separate each entry with a comma (,). Examples below.
    • *If adding entries causes a CTD when ending turn it's because an invalid unit key was supplied.
    • *If adding entries causes no advice to play at the start of a new game + the camera to start at the center of the map, then you have made typing errors somewhere.
    • This should not happen due to the error prevention methods used (see below). If it does, let the EiC devs know immediately!
    • *Any units added here *must* use the same name as appears in the db entires for it. If must also appear in the same case as it does in the db (upper/lower).
    • *To avoid possible CTD's, a new game must be started after this file has been updated.
    • *DO NOT edit any other part of this file not involved in making unit entries. Doing so may cause severe game instability.


    An error catching and prevention system has been written into the code that utilises this file. If you have any in game errors
    look in /../data/Europe in Conflict/Logs/Manpower Extension Script Log.txt. Here you will see a timestamped log giving details of what is going on.
    The error checking procedure works as follows:
    • This file is checked for errors.
    • If it has none, it is loaded into the game.
    • If it has errors it is not loaded into the game, and details of the error are written to the log.

    The error checking procedure will not account for mis-spelled unit keys.

    ------------------------------------------------------------------------------
    ------------------------------------------------------------------------------
    --USEAGE
    ------------------------------------------------------------------------------
    ------------------------------------------------------------------------------
    --The table "ManpowerExtensionTableHomeUnits" is used to define any additional units that are uniquely available to each listed faction. A unit should not be
    --listed for two different factions here - to do so will cause strange in-game behaviour and possible save game corruption. Example table follows:

    -- ManpowerExtensionTableHomeUnits = {
    -- ["austria"] = {"Austrian New Unit 1", "Austrian New Unit Two", "Austrian New Unit 3" },
    -- ["britain"] = {"British New Unit 1"},
    -- ["france"] = {},
    -- ["prussia"] = {"Prussian New Unit"},
    -- ["russia"] = {},
    -- ["bavaria"] = {},
    -- ["denmark"] = {},
    -- ["naples"] = {},
    -- ["netherlands"] = {},
    -- ["sweden"] = {},
    -- ["portugal"] = {},
    -- ["spain"] = {},
    -- ["ottomans"] = {}
    -- }

    --As you can see, 3 units have been added to the Austrian manpower pool, one to the British, and one to the Prussian. The rest have had no additional units added.
    ...
    ...
    ...
    -----------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------

    --The table ManpowerExtensionTableAoRUnits is used to define any additional units that are uniquely available in the regions listed. A unit should not be
    --listed for two different regions here - to do so will cause strange in-game behaviour and possible save game corruption. For an example table, see
    --above - the same rules apply
    --Note that "Wurttemberg", although listed, does not work - it had to be hardcoded into the manpower module due to issues cause by Lua not recognising
    --the trema on the u (ü)
    -----------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------


    Last edited by T.C.; January 06, 2012 at 04:29 PM.
    My Tools, Tutorials and Resources

    Was running out of space, so see the full list here!

    Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.- Josh Billings
    The creatures outside looked from pig to man, and from man to pig, and from pig to man again; but already it was impossible to say which was which.- George Orwell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •