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

R.E.D. World War II development thread

Discussion in 'R.E.D. World War II Edition' started by Gedemon, Jul 14, 2011.

  1. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,309
    Location:
    France
    in which scenario please ?
     
  2. thecivinator58

    thecivinator58 Warlord

    Joined:
    Jul 31, 2012
    Messages:
    243
    Location:
    USA
    The 1936 and 1939 scenarios
     
  3. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,309
    Location:
    France
    Ok, thanks, I'll look at it.
     
  4. LostKnight

    LostKnight A wandering knight

    Joined:
    Apr 6, 2004
    Messages:
    493
    Location:
    Ottawa, Canada
    ALso, on the 1942 scenario, two more cities to correct:

    Marseille(southern france)
    Halifax(eastern Canada)

    Correct spelling of Marsiele and Hailfax.
     
  5. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,309
    Location:
    France
    And thanks for the report too :D
     
  6. LostKnight

    LostKnight A wandering knight

    Joined:
    Apr 6, 2004
    Messages:
    493
    Location:
    Ottawa, Canada
    One more:
    In the 1942 scenario, the american cruiser is named *Balitmore*
    It should be *Baltimore*

    Ill post again if I find more!
     
  7. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,309
    Location:
    France
    How to : Mod in the scenario define files


    I've tried to make the mod as customizable as possible to allow the inclusion of very different scenarios type, from strategic size to more tactical map.

    There is a set of basic "default" rules, that are defined in the following files from the "\My Documents\My Games\Sid Meier's Civilization 5\MODS\R.E.D. WWII Edition (v xx)\Lua" folder :
    • RedDefinesGlobal.lua
    • RedDefinesRules.lua
    • RedDefinesUnits.lua
    • RedDefinesClasses.lua
    • RedDefinesProjects.lua

    None of those files are made to be edited, they define some value for the core scripts, but you can refer to them to edit existing (or new) scenarios.

    Because all the scenario files are loaded after the default files, they can override any value to something more fitting to the scenario.

    Now let's talk of the content of the files:


    RedDefinesGlobal.lua

    Contains the general definition for global constant used by the script.

    I won't detail it, but just point some value that are commonly used in the other parts of the scripts/define files:

    The Major civilization IDs are set there, so you can refer to FRANCE for this civ ID instead of GameInfo.Civilizations.CIVILIZATION_FRANCE.ID

    This refer to an existing civilization, as set in NewCivilizations.xml like any other civilization mod.

    The minor are scenario dependent, and thus are the only values that does not have a default definition, because you may want to use a minor civ instead of a major civ. For example, Greece is a minor civilization in the America/Euro 1936 map, and the value from the default file

    Code:
    [B]GREECE [/B]= GameInfo.Civilizations.CIVILIZATION_GREECE.ID
    is replaced by this one when the 1936 files are loaded:

    Code:
    [B]GREECE [/B]= GameInfo.MinorCivilizations.MINOR_CIV_GREECE.ID
    The IDs used for buildings, promotions and new processes (War Bonds/"we need you") are also defined in this file.

    there are some enumeration types, for better readability in the diplomatic function (DOF, DOW, etc...) or the combat function (MELEE, RANGED, INTERCEPT, etc...)


    There are also some tables:

    g_Allied, g_Axis: used in diplomacy functions, to determine who can declare war to who in alternate history mode

    g_Calendar : the custom calendar. You can speed up or slow down the time scale by adding/removing values in dayList. 3 values (like { "1", "10", "20" } )will make a month last 3 turns, 10 values = 10 turns. A small for ... do ... end loop then fill the g_Calendar table with all entry that will be shown in game on the top panel. When editing your hown calendar for your scenario, first copy all the calendar block, and then just edit the dayList table.

    g_Major_Buildings : the default list of buildings allowed for each major civs. Note that the index refer to the civ ID we've defined at the beginning of the script. Also note that the list is incomplete for some civilization, for example France don't have heavy bombers unit, so no need to allow them to build large air factory...

    g_Buildings_Req, g_Buildings_Exclusion : used in the core script to manage which buildings are needed or are exclusive to each others.

    g_Minor_Buildings : default list of buildings allowed to minor civilizations.


    RedDefinesRules.lua


    This files contains the default rules. Nearly all values in it are commented, so simply refer to it, and ask here if any question arise...


    RedDefinesUnits.lua


    Contains some other enums, the short names for each unit ID that have been added to the mod, and some tables used for the units functions in the core files:

    g_Major_Units : default list of available units for each civs. Note that it's a reversed restriction list, any unit not listed will not be available in game, but any units defined here and that have not been defined to be one of the civilization unique unit won't be available in game too. For example, if you put GE_INFANTRY in the french list, it won't do anything, because the German infantry is defined to be the UU for Germany in the unit table in the game database.

    g_UnitUpgrades : the upgrade path of each unit. It may handle shortcut and multiple upgrade, but I've not tested, and would suggest simple path only (like A -> B -> C preferred to A -> B / A-> C / B -> C)

    g_Paradrop : List of units ID that can paradrop from a city.

    g_NoSupplyPenalty : Maybe a bad naming here, it's the list of units that won't lose combat statistic when out of supply line (aka behind enemy lines), but they still won't get reinforcements.

    g_UnitMaxNumber : Units (like capital ships) that can be build only once in the game, and the number that can be build. By default it's based on the historical name list, with a few "what if this civ had completed a third ship of this class". For example the line [GE_BATTLESHIP_2] = 2, means that the unit type GE_BATTLESHIP_2 (aka Bismarck Class) can only have 2 instance in game, and when one die it can't be rebuild.

    g_UnitMaxInstance : allow a limitation of unit number by instance. A line [FR_B1] = 1, would mean the French could have only 1 char B1 in game at any time, but that it can be rebuild when killed.

    g_Minor_Units : the list of allowed units for minor civs.


    RedDefinesClasses.lua

    Short name for each class ID from the game database, and the table used for class management in game:

    g_Unit_Classes :
    • Capture : define if the unit can capture enemy territory.
    • Moral : not used
    • NumType : this is used for unit naming, and a reference to the "main" default class of the unit.
    • MaterielRatio : % of materiel in the reinforcement calculation. Used in conjunction with REINFORCEMENT_BASE from the rules define.
    • MaxHP : Not Used
    • Buildings : Restriction list, the buildings listed here are mandatory to build the unit in a city.


    RedDefinesProjects.lua

    Last of the define files, it contains the enums IDs for the projects, and some default table:

    g_Major_Projects : Default list of projects that can be build by each civilization.

    g_ProjectsTable : define under which conditions a project is made available. See the in file comments for details.

    g_UnitsProject : define if a project is needed by an unit before being made available.



    The scenario files

    Now you have a global vision of the defines values, you just need to know how to edit those. You may want to try to edit one of the file listed above, but I won't suggest it: the scenario may override the default values, and you will ask yourself (or me) why your change don't work.

    So go and edit the scenario files instead :D

    Those files are in a subfolder of the Lua folder, with more or less explicit name (like Europe1940 for the Europe 1939-1945 scenario)

    Generally you'll have 3 files there : Red..., Script... and Defines...

    As you've guessed, it's the Defines... file that you'll have to edit.

    Let's take Defineseuro1940.Lua as an example.

    First you'll note some value that are duplicate from the RedDefinesRules.lua file. remember, the scenario define file is loaded after the default file, and that's the value from the scenario file that will be used in game whan using the Europe 1939-1945 scenario.

    Note that some of those values are in turn be overridden by the option chosen by the user on the setup screen, they are here for debug purpose when I choose to load a savegame with the value from the define file instead of the values selected by the user.

    Then there is the calendar block, copied from the default file, but edited for the scenario time scale. Note how the start date is set by the line

    Code:
    local bStart = (month >= 7 and year == 1939)
    Which means "this scenario calendar begins at the 7th month of the year 1939". the mod code only allows beginning at start of month, don't try to add a specific day in the start date line.

    After that, the minor civs ID used in the scenario are defined. Of course the minor civs must first be added in the game database via the NewMinorCivs.xml, like any other mod...

    And then you'll find this line :

    Code:
    g_Minor_Units = {}
    You could look some paragraph up to refresh your memory, but let me do it: this table is used to stock the units that can be build by minor civilization. Here it's overriding the default table, with a new one that is empty. Yes, in this scenario the minor civilizations won't be able to build any units, only those available at start or mobilized when they enter war will be available to them.

    Below are some optional tables, if not set the core engine won't use the corresponding features:

    g_Reserve_Unit : contains a list of units that the AI can called when needed.
    • Prob : probability (in %) of the unit to be spawned in the AI capital when it calls it reserve. Note that there can be multiple unit listed, each with it's own probability. The probability test is done for each unit independently, at best the AI could get all units in one turn, but getting "100" on it's first unit probability check won't means it will be "100" for the other too.
    • ID : the unit type ID


    g_Reserve_Data : contains the condition or an AI to call reseerve troops. See the comments in file for usage.

    g_Combat_Type_Ratio : try to force the AI to respect ratio in it's army, again, see comments. Not sure if it works as intended, I've other issues to look at before this one, and it may be rewritten at some point with a strategic AI.

    g_Max_Armor_SubClass_Percent : another attempt to restrict the AI's unit types, this time based on armor "main" class. (see RedDefinesClasses.lua)

    g_Initial_OOB : that's the initial order of battle. While you can manually place the units on your map using the WB, this method is "safer", with the 256 units type limit, it will be easier for me to replace some unit types value in a text file than manually replace them on map when the limit will be fixed...
    • Name: name of the group of placed units, used for firetuner/lua.log debug printing only
    • X, Y : coordinate of the plot to place the group. A sea or land group can be composed of 7 units max (center plot + 6 around)
    • Domain : the domain type (Sea, Air, Land). Note: case sensitive "Sea", not "sea".
    • CivID: the owner of the units that will be spawned. Note that using this spawning method I can give any civ any unit (like Panther to USA or B-17 to Germany) independently of previous table and game database restriction.
    • Group : the units to be spawned on the plot
    • AI : (optional) if set to "true", the group wil lbe spawned for the AI player only.
    • IsMinor: (optional) if set to true, allows the code to understand this group must be placed for a minor civ. Failing to set this value when wanting to place a minor civ group will have strange result (as FRANCE and SPAIN could contain the same value, the distinction MUST be made)
    • UnitsName: (optional) Contains name for units (use the same order than the Group entry)
    • UnitsXP: (optional) give an amount of XP to the units from start (use same order than Group entry)
    • InitialObjective: (optional) give an objective via plot coordinate to the group. Not sure if working, and if it is, you should use the same objective for all groups)

    See Stalingrad define file for an example.


    g_Reinforcement_OOB : same as above, but allow spawning mid-game, using a date as index in the form yyyymmdd. (again see Stalingrad define file for an example)


    g_MinorMobilization_OOB : same as g_Initial_OOB, but with a particularity, made to be use with the option CLOSE_MINOR_NEUTRAL_CIV_BORDERS set to true. The groups defined in that table will spawn only at the moment the neutral CS is entering war (from diplo script, or being DOWed in alternate history mode). Can only contain minor civs, and the flag IsMinor must still be defined.


    g_Minor_UU : allow definition of Unique Units by class for minor civs.


    g_ProjectsAvailableAtStart : define which projects a nation should have already completed at the start of the scenario.

    g_MinorProtector : one of the diplomacy features. Here you can define virtual "protectors". When a civ declare war to a protected minor civilization, all the protectors will declare war to the aggressor.

    g_Victory : allow custom victory screen to be shown, linked with the NewVictories.xml database update file.


    The virtual allied and axis are set again in the file, it's redundant here, but have no consequence.


    g_Major_Diplomacy : another diplo table. It contains custom diplomacy change based on the calendar.
    • [index]: date of the diplo change in the form yyyymmdd
    • Type : see RedDefinesGlobal.lua (DOF = declaration of friendship, DOW = declaration of war, etc...)
    • Civ1: the civilization declaring (war, denouncing, etc)
    • Civ2: the other civilization

    g_Minor_Relation : define the relation between minor and major civs. 30 is friend, 60 is ally.

    g_Major_Minor_DoW, g_Major_Minor_Peace, g_Minor_Minor_DoW, g_Minor_Major_DoW : define the peace/war state for minor civs

    g_Cities : allow placement of buildings in cities at game start. The Key tag is used to define a special victory condition, in which you must capture all your enemy key cities before they take yours. Note that in the 1939 scenario, if playing Germany you get all key cities of France and UK before entering war with USSR, you win.
     
  8. ottoman4u

    ottoman4u Warlord

    Joined:
    Mar 8, 2006
    Messages:
    105
    Thanks for this awesome MOD, and your time developing it. I would like to ask if there is a way to make the AI airplane strikes appear quicker. I mean if a fighter plane is attacking a submarine it goes over the tile 7 times. It isn't a problem but in the latter game it takes like 10 minutes per AI turn, and it'd be nice if it were less. Thanks again. (Germany 1939-1945)
     
  9. Gwynin

    Gwynin Warlord

    Joined:
    Sep 6, 2007
    Messages:
    118
  10. ottoman4u

    ottoman4u Warlord

    Joined:
    Mar 8, 2006
    Messages:
    105
    Thanks for the link Gwynin. Does it work with the mod? and can I retro activate it for the game I am already playing?
     
  11. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,309
    Location:
    France
    yes, it's compatible with savegames.
     
  12. ryan1266

    ryan1266 Chieftain

    Joined:
    Feb 22, 2011
    Messages:
    27
    I vaguely remember reading somewhere that it messes with the tile capture system. Is that true?
     
  13. ryan1266

    ryan1266 Chieftain

    Joined:
    Feb 22, 2011
    Messages:
    27
    One minor fix is that the German paratrooper icons (the boxed x) in the 1939 scenario are just normal infantry icons as opposed to the paratrooper icons (a boxed x with two lines) which the US paratroopers have.
     
  14. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,309
    Location:
    France
    I don't see how it can have an effect on the tile capture system, so false I'd said. Didn't remember that report too, if you have a link, I'll have a look at it :)

    yes, thanks. edit: New icons set are introduced with v.31, all the paratroopers will have real symbol on next beta.
     
  15. Skibbi

    Skibbi Prince

    Joined:
    Nov 8, 2011
    Messages:
    422
    Trying to run my mod but it won't work!
    EDIT: Think it is the wrong data files mod
     
  16. Skibbi

    Skibbi Prince

    Joined:
    Nov 8, 2011
    Messages:
    422
    Some quality info! I'm a Hellenic/Polish - Australian and I didn't know what Hellens thought of Metaxas. What do you think their trait shall be?
    • 'Heros fight like Hellens' +15% :c5strength: and double damage needed to retreat (as Gedemon said)
    • 'Sons of Spartans' discipline promotion
    • 'Fierce Hellens' no combat penalty for cut supply lines
     
  17. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,309
    Location:
    France
    I can confirm that the unit limit problem is solved with the DLL source code available :D

    But don't add new units yet, I want to update the units configuration system first.
     
  18. T_KCommanderbly

    T_KCommanderbly Prince

    Joined:
    Sep 28, 2008
    Messages:
    402
    Location:
    United States
    Awesome!
    Ya as soon as you get that system working I'll add more units, probably tank destroyers and assault guns (I think this is what you guys wanted right?).

    and to answer your question about the screens in the other thread I do have an update ill post some time (I still have to edit more things). I took a break for awile so I forgot some of the changes that I did make so I guess I'll just post the entire versian I have.
     
  19. Gwynin

    Gwynin Warlord

    Joined:
    Sep 6, 2007
    Messages:
    118
    I just cant wait for the next update Gedemon :D
     
  20. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,309
    Location:
    France
    okay, 2 bad news, 1 good news:

    Bad:
    - I don't know why it has worked once, but I can't pass the unit limits anymore. Yep that's very bad. Now if it has worked once...
    - The DLL for R.E.D. WWII can't be loaded with the mod, unless I found a workaround you'll have to manually replace the vanilla DLL. that means no "public" release, but a new beta *soon*

    Good:
    - I've added a new combat event successfully, I'll be able to fully restore the functionality as they were before the .674 patch.
     

Share This Page