Jump to content

Guide: Switching a Country's Coalition Manually


Sephki

Recommended Posts

Ahoy, this is a guide I've written as I did not find one previously for switching a country to the opposite coalition. I'll keep it as simple as possible but some expertise and editing software (vim/notepad++/emacs/gedit) may be required.

 

Hold on, why would I want to switch a country to another coalition?

If you must ask, you need not read further! But, as kind (and modest) as I am, I will explain. It allows you to add more aircraft to a coalition should you have forgotten or not planned so far ahead, or - you may be modifying another map but it does not contain a desired aircraft on the side you want.

 

What does this guide accomplish?

The idea is to switch an empty country from red to blue or vice versa. The mission editor as of DCS version 1.2.7 does not have the functionality to switch a country after you have created a map. Unfortunately this would mean one of two things: remaking the entire map, or, the often more appealing route of editing your mission file itself.

 

What doesn't this guide accomplish?

At the moment, it is only written for switching a country that has zero units. If you have any units under the country you want to move, you may want to consider removing them and then re-adding them after you have made changes, I haven't tested changing coalitions with units but I was warned it may not always go flawlessly - your mileage may vary.

 

This is not the most simplest of guides, consider it a crash course of introductory to computer science if you will. If you intentionally skip steps and ignore notes, I reserve the right to laugh at you and tell you to re-read it. This is because it can be just as frustrating for me as it is for you when myself or others are trying to assist you.

 

Manual Method (utility may be written soon)

 

  1. As mentioned, you'll need a capable non-rich text editor. If you have no idea what I'm talking about, Google and download Notepad++ if you do not have it already.
  2. Navigate to your mission file with your file manager/browser. Its extension should be ".miz". If it is not, you have a problem and may be on your own. See: How to enable extensions below if you do not see any extensions what so ever.
  3. Create a backup! I will not be held liable for any losses or issues you encounter.
  4. Change your mission file's extension to ".zip".
  5. Open it with windows explorer (or your favourite archival tool).
  6. You should see several files, but only one of them is relevant to us for this guide. Extract the file called "mission". If you do not see this file, ask for help.
  7. Open your freshly extracted "mission" file, if you are using Windows, it will most likely prompt you with an "open with" dialogue. Choose your preferred editor. (notepad++ if you just downloaded it)
     
    Now for the fun part. You'll see a lot of text, but we are only after two specific sections of it. Do not touch anything the guide doesn't say to! You can and will easily break your mission file and it'll be up to you to fix.
  8. Use the Find function of your editor, in most cases it is Control-F. Input the search phrase "coalitions" (with quotations).
     
    You should now be taken to a section that looks similar to this:
    ["blue"] =
    {
    [1] = 21,
    [2] = 11,
    [3] = 8,
    [4] = 13,
    [5] = 5,
    [6] = 16,
    [7] = 6,
    [8] = 15,
    [9] = 20,
    [10] = 12,
    [11] = 9,
    [12] = 10,
    [13] = 3,
    [14] = 4,
    [15] = 2,
    }, -- end of ["blue"]
    ["red"] =
    {
    [1] = 18,
    [2] = 0,
    [3] = 19,
    [4] = 1,
    }, -- end of ["red"]
    If you're not taken to an area that looks like that, try to manually find it or post for help.
  9. Now it gets rather complicated, I'll keep it as simple as possible. Every single country is there on its own line closed in the braces of either red or blue (except neutral countries I believe).
     
    The numbers enclosed in square brackets are enumerators and so long as they go from 1 to # without skipping numbers they're working as intended. This is relevant because when we are ready to move a country we will be modifying several of these.
     
    The numbers after the equal sign indicate the internal country number. You can find a table in the post below this one. Finally each line ends with a comma, do not forget it when editing as your mission file will break if you forget even one of them.
     
    If you get lost, follow the same style quoted above or: "[OrderedNumber] = CountryNumber,".
  10. Now, using the list in the post below this guide: find the country you want to switch. For this example, I'll use country '12', Norway.
  11. Cut and paste the entire line that has your countries number on the right side, placing it in the opposite coalition, grouped with the other countries at the end. Like so:
    ["blue"] =
    {
    [1] = 21,
    [2] = 11,
    [3] = 8,
    [4] = 13,
    [5] = 5,
    [6] = 16,
    [7] = 6,
    [8] = 15,
    [9] = 20,
     
    [11] = 9,
    [12] = 10,
    [13] = 3,
    [14] = 4,
    [15] = 2,
    }, -- end of ["blue"]
    ["red"] =
    {
    [1] = 18,
    [2] = 0,
    [3] = 19,
    [4] = 1,
    [10] = 12,
    }, -- end of ["red"]
  12. Now we need to re-enumerate the list. See how our example red side goes 1, 2, 3, 4, 10? We need to change that so it is counting properly from 1 to the total entries, in our case; that's 5. Change the square bracket enclosed number of the newly pasted country to the new number of total entries for that coalition.
     
    Do the same for other coalition, you might notice if you took it from the middle of the list that the list is now skipping a number. You may need to adjust them all so they count from 1 to the total entries for that coalition.
     
    Done right, it should look like this. Counting from 1 to the total entries of the coalition without skipping a number. Note that our examples highest square bracket enclosed number was 15, it is now down to 14 as we took an entry out of it.
    ["blue"] =
    {
    [1] = 21,
    [2] = 11,
    [3] = 8,
    [4] = 13,
    [5] = 5,
    [6] = 16,
    [7] = 6,
    [8] = 15,
    [9] = 20,
     
    [10] = 9,
    [11] = 10,
    [12] = 3,
    [13] = 4,
    [14] = 2,
    }, -- end of ["blue"]
    ["red"] =
    {
    [1] = 18,
    [2] = 0,
    [3] = 19,
    [4] = 1,
    [5] = 12,
    }, -- end of ["red"]
    You can remove the blank line with nothing in it if you wish.
  13. Note the left hand number of your newly switched country! In our example case, country 12 has gone from [10] on blue to [5] on red. Write down the old number, new number and the number after the equals sign, which we'll refer to as the country number.
     
    Following the example: the old number is [10], the new number is [5] and the country number is 12.

Adding The New Entry

 

  1. Open your editors find function again. This time, type "coalition" (with quotations). be very careful with this section, it is more difficult to explain and so you should triple check what you are doing. Ask questions if needed.
  2. Scroll down to the line that says ["country"]. See how there is a "[1]" below the brace? Remember those numbers from steps 8-12? Great! Now its time for a lot of scrolling and careful edits.
  3. If your newly moved country is now blue: Open your find function again and type "-- end of ["blue"]" (without the beginning and ending quotations).
     
    If your newly moved country is now red: Do the same thing only search for "--end of ["red"]" instead, following quotation note.
  4. Go up one line to where it has "}, -- end of ["country"]" and add a line above it. Copy and paste the below code into said line:
    [YOUR_ENUMERATOR_NUMBER_HERE] =
    {
    ["id"] = C_ID_FROM_TABLE_HERE,
    ["name"] = "COUNTRIES_NAME_HERE"
    }, -- end of [YOUR_ENUMERATOR_NUMBER_HERE]
  5. Now, there are four things we must do. Replace the two YOUR_ENUMERATOR_NUMBER_HERE texts with the "new number" acquired in step 13. Replace COUNTRIES_ID_FROM_TABLE_HERE with the correct countries ID noted also in step 13. Also put the name as seen in the table after the end of this guide, in the place of "COUNTRIES_NAME_HERE" (inside the quotations). You might be able to use custom names but I haven't tried it. Feel free to let us know.
     
    Example:
    [5] =
    {
    ["id"] = 12,
    ["name"] = "Norway",
    }, -- end of [5]

Removing The Old Entry

 

  1. Open your editors find function again. This time, type "coalition" (with quotations).
  2. If your newly moved country was red: Find function. Search for "["red"]" (with inner quotations).
  3. Scroll down to the line that says ["country"].
     
    Now we need to find the old entry, remove it and then subtract 1 from the countries below it for re-enumeration purposes. If your old coalition was blue, make sure you don't accidentally go into red coalition when editing.
     
    To do this, take note of the 'old number' you should have wrote down in step 13. Depending on how many units are in the mission file, you may have quite a bit of scrolling ahead. Search will unlikely save you this time.
  4. So, start scrolling until you find something akin to
    [YOUR_OLD_NUMBER] =
    {
    ["id"] = YOUR_FACTION_NUMBER,
    ["name"] = "YOUR_FACTION_NAME",
    }, -- end of [YOUR_OLD_NUMBER]
     
    Since this guide is editing Norway, I'll be looking for this:
    [7] =
    {
    ["id"] = 12,
    ["name"] = "Norway",
    }, -- end of [7]
  5. Now, delete that section starting from "[YOUR_OLD_NUMBER] =" down to "-- end of [YOUR_OLD_NUMBER]".
     
    If you're not deleting the last entry, continue below. If you are, lucky you, you're done here and can continue to the next section.
  6. You should see another country below where you just deleted. In this step you'll re-enumerate every single country below what you just deleted.
     
    A simple trick is n-1. So, with that in mind I had several countries below Norway, especially USA with a ["vehicle"] / ["plane"] field. It's important to not touch anything in the these fields, so when you find one, skip all of what you see until you find "-- end of ["field_name_here"]" as this guide does not cover these. Note how the example below omits these in the USA field; you should treat countries with units the same way mentally.
     
    [8] =
    {
    ["id"] = 13,
    ["name"] = "Denmark",
    }, -- end of [8]
    [9] =
    {
    ["name"] = "USA",
    ["id"] = 2,
    ["vehicle"] =
    {
    OMITTED
    }, -- end of ["vehicle"]
    ["plane"] =
    {
    OMITTED
    }, -- end of ["plane"]
    }, -- end of [9]
    [10] =
    {
    ["id"] = 20,
    ["name"] = "Italy",
    }, -- end of [10]
    [11] =
    {
    ["id"] = 6,
    ["name"] = "Germany",
    }, -- end of [11]
    [12] =
    {
    ["id"] = 5,
    ["name"] = "France",
    }, -- end of [12]
    [13] =
    {
    ["id"] = 3,
    ["name"] = "Turkey",
    }, -- end of [13]
    }, -- end of ["country"]
    }, -- end of ["blue"]
     
    So, bearing all of that in mind, our new example will look like this following bracket enclosed n-1:
    [7] =
    {
    ["id"] = 13,
    ["name"] = "Denmark",
    }, -- end of [7]
    [8] =
    {
    ["name"] = "USA",
    ["id"] = 2,
    ["vehicle"] =
    {
    OMITTED
    }, -- end of ["vehicle"]
    ["plane"] =
    {
    OMITTED
    }, -- end of ["plane"]
    }, -- end of [8]
    [9] =
    {
    ["id"] = 20,
    ["name"] = "Italy",
    }, -- end of [9]
    [10] =
    {
    ["id"] = 6,
    ["name"] = "Germany",
    }, -- end of [10]
    [11] =
    {
    ["id"] = 5,
    ["name"] = "France",
    }, -- end of [11]
    [12] =
    {
    ["id"] = 3,
    ["name"] = "Turkey",
    }, -- end of [12]
    }, -- end of ["country"]
    }, -- end of ["blue"]
    Note how the bracket enclosed numbers were reduced by 1. Denmark has taken Norway's place as entry 7.

Re-archiving

 

  1. Pat yourself on the back, you're almost done.
  2. Save your "mission" file. (make sure it doesn't gain any extensions)
  3. If you didn't leave the .zip window open, re-open the .zip with Windows Explorer. (or your favourite archival tool)
  4. Drag the file into the zip archive, overwriting the old "mission" file.
  5. Close the archive.
  6. Rename your mission.zip file back to mission.miz.

Finishing Notes

Congratulations! You're finished, now you can go and test everything inside of DCS. Should everything be done right, your mission wont crash and when you add units, the changed country(s) should be blue instead of red or red instead of blue, depending on its' newly assigned coalition.

 

If you didn't have such success and your map spawned mutants, try again from your backup file, making sure to make another backup and erasing the messed up attempt.

 

 

Troubleshooting: Enabling File Extensions in Windows

 

Control Panel -> Folder Options -> View Tab

UNCHECK "Hide extensions for known file types" -> Apply.


Edited by Sephki
Clarity
Link to comment
Share on other sites

Country Table

 

Incomplete Country Table

Missing 7 and 14. Please advise if you know which these numbers belong to.

[TABLE]0|Russia

1|Ukraine

2|USA

3|Turkey

4|UK

5|France

6|Germany

7|UNKNOWN

8|Canada

9|Spain

10|The Netherlands

11|Belgium

12|Norway

13|Denmark

14|UNKNOWN

15|Israel

16|Georgia

17|Insurgents

18|Abkhazia

19|South Ossetia

20|Italy

21|Australia

[/TABLE]


Edited by Sephki
Added insurgents to table
Link to comment
Share on other sites

  • 4 weeks later...

If the only reason to change coalitions is to be able to a use an aircraft not currently available to a country in the coalition, then there is a very quick fix for that. All you have to do is add the aircraft to a country already in the coalition in the {dcs}\scripts\database\db_countries.lua file. It only needs to be done on the PC that is editing the mission. Now, the skins may not be selectable in the Mission Editor without tweaking the skin's description.lua file, but the aircraft will be available.

Link to comment
Share on other sites

  • 3 months later...
  • 1 year later...
  • 5 months later...
  • 8 months later...
  • 6 months later...
Incomplete Country Table

Missing 7 and 14. Please advise if you know which these numbers belong to.

[TABLE]0|Russia

1|Ukraine

2|USA

3|Turkey

4|UK

5|France

6|Germany

7|UNKNOWN

8|Canada

9|Spain

10|The Netherlands

11|Belgium

12|Norway

13|Denmark

14|UNKNOWN

15|Israel

16|Georgia

17|Insurgents

18|Abkhazia

19|South Ossetia

20|Italy

21|Australia

[/TABLE]

 

Any chance to update this table with the other countries also?

Thnx:thumbup:

Lock-On Greece / DCS World Greece http://lockon-greece.forumotion.net/

🇬🇷 1st Hellinic Virtual Squadron for Flaming Cliffs & DCS World
~ Flying since 2008 ~

 

Link to comment
Share on other sites

Any chance to update this table with the other countries also?

Thnx:thumbup:

 

http://wiki.hoggit.us/view/DCS_enum_country

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

 

 

That's a very complete list, but the latest database in the game has a few more countries:

 

 

70 Algeria DZA

71 Kuwait KWT

72 Qatar QAT

73 Oman OMN

74 United Arab Emirates ARE

 

 

May I suggest that ED adds some more latinamerican countries? ... I'd love to see Argentina, Bolivia, Colombia and Peru added to the database.

 

 

Best regards

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

  • 2 months later...

I know this is an old topic, but no one on here pointed out the ME-MOD which I have used it now with 1.5.7 Release, 1.5.8 Release, 2.1 Alpha, 2.2 Alpha, and even the 2.5 Beta. So if people find themselves looking to change the countries of their coalition after creating their mission, this thing works wonders...

 

https://forums.eagle.ru/showthread.php?t=141475&highlight=change+countries

 

And I have just put together a list of the "player" aircraft chart for each country for 2.5 Beta...

 

https://drive.google.com/open?id=1bz_GO-DOc48VANjQAy8rgoajTuorLQvYl_2RXlvE2Zg

Link to comment
Share on other sites

Thanks for making the 'aircraft chart', I have been meaning to do that for a long time, and the fact it's even updated to today's standard is awesome!

And good of you to point to the Coalition Mod in this thread, very nice of you.

http://www.TAWDCS.org ### JOINT TASK FORCE JTF-88 ### https://tawdcs.org/battalion/88th/ ### PC: i9 - 32Gb RAM - GTX 1080Ti - TM Warthog Stick and Throttle - MFG Crosswind Black - TrackIR5 - Buddy Fox UFC
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...