[Tool] Batch file to keep map fog of war in sync across multiple chars/difficulties

Well, not really keep it in sync as such, just update the latest fog of war info across all your characters.

I know many people manually copy older map.fow files to new characters they make - it makes no sense to have to rediscover the entire map every time you enter a new difficulty with a new character.

Copy & paste the below into Notepad and save it as “MAP-UPDATE.cmd” in your “Grim Dawn\save” directory.


@echo off
SETLOCAL EnableDelayedExpansion
set NewestFow=
set CurrentFow=
set FinalFow=

call :treeScan

if DEFINED NewestFow (
	echo Latest map file found:
	echo !NewestFow!
	pause
	set FinalFow=!NewestFow!
	call :treeScan
	echo Done.
)
pause
goto :eof

rem ==================================================================
:treeScan
rem ==================================================================
cd main
for /D %%d in (*) do (
	cd %%d
	cd levels_world001.map
	call :processDifficulties
	cd ..
	cd ..
)
cd ..
exit /b

rem ==================================================================
:processDifficulties
rem ==================================================================
for /D %%d in (*) do (
	cd %%d
	call :processDir
	cd ..
)
exit /b


rem ==================================================================
:processDir
rem ==================================================================
if exist map.fow (
	set CurrentFow="%cd%\map.fow"
	if DEFINED FinalFow (
		copy !FinalFow! !CurrentFow!
	) else (
		if NOT DEFINED NewestFow (
			set NewestFow="%cd%\map.fow"
		) else (
			For /F "Delims=" %%I In ('xcopy /DHYL !CurrentFow! !NewestFow! ^|Findstr /I "File"') Do set /a _Newer=%%I 2>Nul
			if "!_Newer!" == "1" (
				set NewestFow=!CurrentFow!
			)
		)
	) 
)
exit /b
rem ==================================================================

How to use:

  • Enter the game with the character that has the most explored map.
  • Exit to main menu.
  • Double-click the batch file.
  • It will output a single line, showing the name and path of the file it’s about to copy.
  • From the path, the character and the difficulty will be obvious. If you want to proceed, press any key. If you don’t - just close the window.
  • The program will then copy the map.fow file to all other characters. You will get a bunch of “1 file copied” notifications and one “file cannot be copied onto itself” error. The error is normal. I’m too lazy to fix it.
  • Press any key to exit.

IMPORTANT!

Whenever you start a new character or enter a new difficulty, exit to the main menu and enter the game with a char that has a well-explored map, then exit to the main menu again. Only THEN run the tool.

When you explore a new part of the world, you may want to run the tool again after you’ve exited the game, so all your characters benefit from the discovery you’ve made.

About the code:

It’s an ugly windows batch file. It makes no intuitive sense. It has strange things like using “xcopy /dhyl” to determine which file is more recent. You either know what it’s doing, or you don’t. If it’s the latter, don’t worry, there’s almost no value to learning the windows batch “language”.