Jump to content

Script to randomize Cockpit pictures at each game start


Recommended Posts

Posted

Hi,

I was bored with the default cockpit pictures so I have prepared a command prompt script that scans subfolders for a random dds file and copies it to every folder in all the planes/textures, then runs the game.
So if you click on this script every time you want to run the game, you will have each time a randomized cockpit picture.

 

How to install:

  1. Download some cockpit picture sets and make at least one folder with dds files.
  2. Create a new file, name it for example il2_random_pictures.cmd
  3. Copy the following code into the file and save.
  4. When you run it, it will do the following:
    a. Get the game path from your registry. (currently only works for a game copy bought from normal store, no steam support).
    b. It scans all subfolders for dds files, picks one random file.
    c. Scans all airplanes folders under \data\graphics and copies the picked random file into \Textures\ folder of each airplane.
    d. Starts the game.
  5. The script folder should look like:
    Script.thumb.png.04a340354dcb5d6808954077d510e4a3.png
  6. Please note: when you run the file, it will overwrite your old cockpit pictures (default ones), so backup if you want to use them again in the future!
  7. Please note: Every game start ALL planes will have the same random picture. When you exit and run the script again, another random picture will be picked and replace the old one.
    I plan to enhance the script so every plane will have a different randomized picture, but it will take more effort to do so (more complex script).
@echo off
FOR /F "usebackq tokens=3*" %%A IN (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{66F649A9-0FA2-487E-BC0D-894BD7E89D5E}_is1" /v InstallLocation`) DO (
    set appdir=%%A %%B
    )
ECHO %appdir%

setlocal EnableDelayedExpansion
cd %cd%
set n=0
for /R %%f in (*.dds) do (
   set /A n+=1
   set "file[!n!]=%%f"
)
set /A "rand=(n*%random%)/32768+1"
FOR /R "%appdir%\data\graphics\Planes\" %%F IN (\) DO (
    Echo %%F | findstr /C:"Textures">nul && (
    copy "!file[%rand%]!" "%%Fcustom_photo.dds"
)
)
cd "%appdir%\bin\game"
il-2.exe

 

  • Like 1
  • 1 month later...
SL19711105buhesulong
Posted

这个脚本是否可以升级成随机更改飞机的油漆?

Can this script be upgraded to randomly change the skin of the aircraft

  • 2 weeks later...
Posted (edited)
On 4/15/2020 at 10:41 AM, SL19711105buhesulong said:

这个脚本是否可以升级成随机更改飞机的油漆?

Can this script be upgraded to randomly change the skin of the aircraft

I am not sure I understand your question.
The script puts a random dds picture in all plane folders with a file with constant name (custom_photo.dds), since aircraft skin can contain various names, and the missions may relay on it (correct me if I am wrong), this one will be a tricky one to make. Unless I did not understand you correctly, if this is the case, please provide more information.

Edited by Zeev
  • 5 years later...
Vishnu
Posted

Hello Zeev....I found your post...I know it's old and I'm not sure if your'e still playing,  but I would love to combine your knowledge with the photos I created here.... I'm not very computer literate, and I'm not entirely sure how to operate your original post.  

@Zeev

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...