Editing units.csv File

Order of Battle is a series of operational WW2 games starting with the Pacific War and then on to Europe!

Moderators: The Artistocrats, Order of Battle Moderators

Post Reply
LadyLex
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 47
Joined: Wed Dec 07, 2016 12:57 pm

Editing units.csv File

Post by LadyLex »

Has anyone had any success in editing the unit.csv file? I've been attempting to add a new unit (a seaplane tender). I've attempted to use Excel as well as a couple of other editors to save the files using semi-colon delineated files. When I then open the mod in the editor I get no units showing up.
Erik2
Order of Battle Moderator
Order of Battle Moderator
Posts: 9577
Joined: Thu Jul 14, 2011 12:59 pm
Location: Norway

Re: Editing units.csv File

Post by Erik2 »

You need to set this up as a mod. I think there is some old info about mods in the Scenario section.

You could use the Battle of Britain mod as an example, it should be in your My Games ... Mods folder. This mod is quite small and fairly easy to get an overview of.
You should take a look at the stuff in the Data and Language folders.
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

Re: Editing units.csv File

Post by Horst »

Excel can do some unfortunate text-conversion depending on your language setting, like changing date-slashes to points and such.
When you import the units.csv file within Excel, you should change the format of all columns in the preview to Text instead of keeping it Standard.
When you are done editing your data in Excel, don't forget to save as csv-file again, otherwise semicolons are most likely lost what can cause the game loading the units.csv but not showing units anymore.
bebro
Slitherine
Slitherine
Posts: 4526
Joined: Sun Nov 19, 2006 12:50 pm

Re: Editing units.csv File

Post by bebro »

Using OpenOffice works fine - you only need to select the correct separators (tab, semicolon IIRC) in the dialogue that comes up when opening the CSV.
BiteNibbleChomp
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3231
Joined: Mon Jul 01, 2013 6:35 am

Re: Editing units.csv File

Post by BiteNibbleChomp »

What I usually do is a little tedious, but seems to work:

1. Open csv.
2. Copy everything in csv to a blank word file
3. Run find and replace in word, with ";" set to replace to "^t" (^t is a wildcard feature to represent <tab>)
4. Copy the updated word thing into excel
5. Edit excel as necessary. I find it helpful to freeze the first row and column (In my ancient version of excel, select cell B2, then Window > Freeze Panes)
6. When done, copy excel into a new notepad file (not word - word will keep the column separators and we need to get rid of these)
7. Reselect the entire notepad file and copy into word.
8. In word, find and replace with "^t" turning into ";"
9. Copy into the csv file and save.

- BNC
Ryan O'Shea - Developer - Strategic Command American Civil War
LadyLex
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 47
Joined: Wed Dec 07, 2016 12:57 pm

Re: Editing units.csv File

Post by LadyLex »

Thanks everyone. I'll give these a shot latter today.

I did set up a mod, using the Battle of Britain as well as the "test" mod as examples. Since the mod was loading I was pretty sure that wasn't the issue but it certainly is nice to confirm.

Excel can do some weird things, which is why I had also tried a couple of other editors (Ron's Editor and CSV Buddy) but they also didn't seem to work. I'll give Open Office a try. Been a while since I used it so I know I'll have to reinstall.
LadyLex
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 47
Joined: Wed Dec 07, 2016 12:57 pm

Re: Editing units.csv File

Post by LadyLex »

Thanks for the help everyone. I did get it to work using CSV Buddy. Just had to make sure I selected the correct encoding. Apparently the file uses UTF-8. Excel will save as ANSI and that is the format I initially used in CSV Buddy.

The only trouble I have at the moment is when I open the file in editor my new unit does not have a "preview" picture in the selection pane and the name shows up as "unit_9999". To create the new unit (which I'm basing on the Barnegat class) I copied the repair ship, only editing a few items such as weaponEffect and traits.

I do have some other questions on the file, but will start a different thread for those after I've done a little more research here on the forums. Don't really want to ask a question that has already been answered.
BiteNibbleChomp
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3231
Joined: Mon Jul 01, 2013 6:35 am

Re: Editing units.csv File

Post by BiteNibbleChomp »

LadyLex wrote:Thanks for the help everyone. I did get it to work using CSV Buddy. Just had to make sure I selected the correct encoding. Apparently the file uses UTF-8. Excel will save as ANSI and that is the format I initially used in CSV Buddy.

The only trouble I have at the moment is when I open the file in editor my new unit does not have a "preview" picture in the selection pane and the name shows up as "unit_9999". To create the new unit (which I'm basing on the Barnegat class) I copied the repair ship, only editing a few items such as weaponEffect and traits.

I do have some other questions on the file, but will start a different thread for those after I've done a little more research here on the forums. Don't really want to ask a question that has already been answered.
To solve the unit_9999 thing, you need to edit the language files. My Documents/My Games/Order of Battle WW2/Mods/(mod name)/Language and then the English_mod or French_mod etc. files.

- BNC
Ryan O'Shea - Developer - Strategic Command American Civil War
LadyLex
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 47
Joined: Wed Dec 07, 2016 12:57 pm

Re: Editing units.csv File

Post by LadyLex »

Thanks BNC. That did the trick for the name. Now to figure out the thumbnail picture in the selector in editor.

I hadn't looked at the language files yet. There certainly is a lot of info in there.
BiteNibbleChomp
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3231
Joined: Mon Jul 01, 2013 6:35 am

Re: Editing units.csv File

Post by BiteNibbleChomp »

LadyLex wrote:Now to figure out the thumbnail picture in the selector in editor.
.
My Docs/My Games/Order of Battle WW2/Mods/(mod name)/Graphics/Units

- BNC
Ryan O'Shea - Developer - Strategic Command American Civil War
Pegon
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 37
Joined: Sun Feb 24, 2013 12:28 pm

Re: Editing units.csv File

Post by Pegon »

Has someone made a guide to editing units.csv. I am trying to add some poke and range to my rail artillery, but unsure how to proceed.
BiteNibbleChomp
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3231
Joined: Mon Jul 01, 2013 6:35 am

Re: Editing units.csv File

Post by BiteNibbleChomp »

Pegon wrote:Has someone made a guide to editing units.csv. I am trying to add some poke and range to my rail artillery, but unsure how to proceed.
1. Read through my above posts.
2. MAKE A BACKUP!!!!!!!!!!!!!!!
3. Change some numbers around to suit your needs.
4. Guess and check.
5. Rinse and repeat.

I find it helps if you look at other units with similar stats to what you are looking for. That is the exact process (obviously excluding step 1, as I only wrote those a few days ago) that I have used when fiddling with the game.

- BNC
Ryan O'Shea - Developer - Strategic Command American Civil War
LadyLex
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 47
Joined: Wed Dec 07, 2016 12:57 pm

Re: Editing units.csv File

Post by LadyLex »

BiteNibbleChomp wrote:2. MAKE A BACKUP!!!!!!!!!!!!!!!
Should be #1 :D

Always make a back up of any files your going to change. Also make backups of the files you do change as you go along. I've had to recover from a backup a couple of times when the units.csv file inadvertently got saved in the wrong format.
LadyLex
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 47
Joined: Wed Dec 07, 2016 12:57 pm

Re: Editing units.csv File

Post by LadyLex »

Pegon wrote:Has someone made a guide to editing units.csv. I am trying to add some poke and range to my rail artillery, but unsure how to proceed.
Make sure you use software which can save the file in the correct format. Open Office is great. I've used a couple of other programs, but Open Office is easiest (and it's free). The file uses semi-colons to separate the records (and commas within the records). If the files isn't saved in the correct format the game will not be able to read it.

Set up the mod folder as outlined here: http://www.slitherine.com/forum/viewtop ... 74&t=64188. I actually have 2 mod folders set up. One for "development" where I edit the files and keep my notes on what changes I've made (and why). The other is the "production" folder I use for playing the game with my mod. The only files here are those needed for the mod. In my development folder is also a backup folder where I keep backups of all of the files. Over kill? Maybe, but I've been able to revert back easily when a change didn't work out and even when I inadvertently saved the file in the wrong format and didn't catch it.

Copy the data folder from the game folder to the mod folder. Only edit the files in the mod folder. This prevents corrupting the original files and prevents future updates from the developers from over writing your changes. It also provides an original copy of the data files should you ever need to revert to them.

Document every change you make and just as important why you changed it. This may just be the project manager in me, but I haven't done this in the past and then discover a change and wonder why I changed it to begin with.

I don't know that anyone has posted "details" about the units.csv file. Some of the columns are fairly easy yo figure out. Others are a bit more cryptic. For the artillery range you'll want to modify the "range" for the unit.
Pegon
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 37
Joined: Sun Feb 24, 2013 12:28 pm

Re: Editing units.csv File

Post by Pegon »

Thanks LadyLex, have managed to up the damage to 10-6, however, the range has still eluded me.
LadyLex
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 47
Joined: Wed Dec 07, 2016 12:57 pm

Re: Editing units.csv File

Post by LadyLex »

Pegon wrote:Thanks LadyLex, have managed to up the damage to 10-6, however, the range has still eluded me.
In the units.csv file adjust the value in column AB, titled range. This value determines the weapons range in hexes. It will still only be able to target units it can see or are spotted by another unit.
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

Re: Editing units.csv File

Post by Horst »

I’ve made a backup of the original game folder and copy my mod files there. I’m not up for clicking the mod-selection screen whenever I restart dozen of times the game due many changes I do sometimes.

If you like to do some changes to language files, I recommend moving all unit_x entries into english.txt or whatever language you prefer, otherwise you go nuts finding the proper unit in now 8(!) language files.
If you like to sort the many units in natural number order, you can use this link here:
http://textmechanic.com/text-tools/basi ... text-lines
I’m still too lazy to sort all these unit-text entries according to their units.csv order what is possibly better if you go through all units.

What I find useful adding to the unit names is the fuel value, air-/land-production for naval units, cargo space, torpedo-cd-range-attack, my individual radar ranges, bombard values for strategic bombers, and whatever else as special transport like the Ohka (never tested that).
For example:
CV Hiryu '43 (C3,P11,R5) for air-cargo3,air-production11,radar5
DD Fletcher '43 (P1,R8,T4-2-22) for land-production1,radar8,torpedo-cd4-range2-attack22
TBM-3E Avenger (F10,R7,T3-2-20) for fuel10,radar7,torpedo-cd3-range2-attack-20
BiteNibbleChomp
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3231
Joined: Mon Jul 01, 2013 6:35 am

Re: Editing units.csv File

Post by BiteNibbleChomp »

LadyLex wrote:
BiteNibbleChomp wrote:2. MAKE A BACKUP!!!!!!!!!!!!!!!
Should be #1 :D

Always make a back up of any files your going to change. Also make backups of the files you do change as you go along. I've had to recover from a backup a couple of times when the units.csv file inadvertently got saved in the wrong format.
#1 was just reading stuff, so I don't think the csv can be damaged by that. 8)

- BNC
Ryan O'Shea - Developer - Strategic Command American Civil War
Post Reply

Return to “Order of Battle Series”