Jump to content

Recommended Posts

Posted (edited)

Here is a small tool allowing to change the weather + time randomly for a server with a mission rotation.

After the ending of a mission, the script will create a new mission file with different weather parameters automatically. 
Source code with instructions: https://github.com/Super-truite/il2_random_weather_script

 

Executable: https://github.com/Super-truite/il2_random_weather_script/releases/download/1.0/random_weather.zip

Installation:

Allow log files in il2:

Make sure gamelog=1 in your startup.cfg file

Mission files organization

The Dogfight folder should not contain the .Mission file as it would be downloaded by players by default which is not optimal (slower download speed). Instead the raw mission files should be in another folder. In my case: "C:\Program Files (x86)\1C Game Studios\IL-2 Sturmovik Great Battles\data\Multiplayer\raw_missions" You have an example of working Multiplayer folder in the project on github. To test the system, you can copy paste it in your data folder and run the script.

Configuring the script

Change the paths to your il2 installation and to your dogfight and raw mission folder in the config.ini file that is present in the dist folder. (for developers, use the config.ini at the root of the project source code directory)

Launch the script

In the dist folder, click on random_weather.exe. A command prompt will appear, then right click on the header of the command prompt and click on properties, then uncheck 'Quick Edit Mode', otherwise the process might pause.

 

I might add some options to have more control on the randomness of the weather for the user.

 

 

 

Edited by super-truite
  • Like 2
  • Upvote 2
  • 2 weeks later...
Posted
Quote

'Haze': str(random.random())[0:3]

@super-truite this mean Haze parameter will be from 0.0 to 0.3?

Posted

no, 0 to 1. the str()[0:3] is just used for some formating of the number. If I find time I will make the weather parameters more easy to change. 

Posted
3 minutes ago, super-truite said:

no, 0 to 1. the str()[0:3] is just used for some formating of the number. If I find time I will make the weather parameters more easy to change. 

Thx!

Another question, I have installed python with il2stats from Vaal (not anaconda) how to use you script with it?

Posted

you just have to install the packages needed. The best way would be in a virtual environment but if you do not use python for other stuff than il2, you can just open a terminal and do: 


 

pip install regex numpy

then you can launch the script in the same terminal :
 

python random_weather.py

 

Posted

terminal said "invalid syntax" (i have installed python 3.5.2)

  • 11 months later...
Posted

In mission file appear new parameter   LayerFog = 0;

possible script now not correct?

  • 9 months later...
Posted

Problem with new map:

Quote

randomization done for: blacksea_s.Mission
current mission:  diep_s.Mission
MISSION END: random weather script launched
Traceback (most recent call last):
  File "random_weather.py", line 207, in <module>
    randomize_weather(current_mission)
  File "random_weather.py", line 172, in randomize_weather
    readMissionFromFile(newMission, os.path.join(path_raw_missions, mission))
  File "C:\ProgramData\Anaconda3\lib\site-packages\pylgbmimec\basic_functions\mission_class.py", line 182, in readMissionFromFile
    mission.addObject(newObject)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pylgbmimec\basic_functions\mission_class.py", line 119, in addObject
    criticalError(MAP_NOT_FOUND.format(mapName))
  File "C:\ProgramData\Anaconda3\lib\site-packages\pylgbmimec\basic_functions\error_handling.py", line 23, in criticalError
    raise Exception(message)
Exception: Error : Map not declared : ""normandy-summer-early"

Map must be added in map_size.py file? With this name "normandy-summer-early" (and "normandy-summer-late")?

How to find parameters for new maps? Or not only this file must be changed?:wacko:

=AD=uumembwa
Posted

I try edit map_size.py to this:

''' define here map size to be used to indexing (speedup object searching) and default coord. for object creation'''
map_size=dict()
map_size['lapino']={'XMin':0.0, 'ZMin':0.0, 'XMax':51200.0, 'ZMax':51200.0}
map_size['stalingrad']={'XMin':0.0, 'ZMin':0.0, 'XMax':230400.0, 'ZMax':358400.0}
map_size['moscow']={'XMin':0.0, 'ZMin':0.0, 'XMax':281600.0, 'ZMax':281600.0}
map_size['novosokolniki']={'XMin':0.0, 'ZMin':0.0, 'XMax':51200.0, 'ZMax':51200.0}
map_size['vluki']={'XMin':0.0, 'ZMin':0.0, 'XMax':102400.0, 'ZMax':166400.0}
map_size['kuban']={'XMin':0.0, 'ZMin':0.0, 'XMax':358395.0, 'ZMax':460800.0}
map_size['prokhorovka']={'XMin':0.0, 'ZMin':0.0, 'XMax':166400.0, 'ZMax':166400.0}
map_size['rheinland']={'XMin':0.0, 'ZMin':0.0, 'XMax':384000.0, 'ZMax':460800.0}
map_size['arras']={'XMin':0.0, 'ZMin':0.0, 'XMax':166400.0, 'ZMax':166400.0}
map_size['normandy-summer']={'XMin':0.0, 'ZMin':0.0, 'XMax':396800.0, 'ZMax':396800.0}
map_size['normandy-summer-early']={'XMin':0.0, 'ZMin':0.0, 'XMax':396800.0, 'ZMax':396800.0}

''' number of lines and row for the x/Z indexing'''
SPLIT_MAP = 3

Will see how it works...:wacko:

super-truite
Posted

sorry did not have time to respond. I cannot fix this at the moment. It is a bug of this tool it seems :

but what you try could work!

C6_lefuneste
Posted
On 9/28/2022 at 7:40 PM, NHK295M said:

Problem with new map:

Map must be added in map_size.py file? With this name "normandy-summer-early" (and "normandy-summer-late")?

How to find parameters for new maps? Or not only this file must be changed?:wacko:

Wow, I was not aware someone was using this ! I'll have a look, but I need to install python again, as I reformat my PC.  Map size should ve put only in map_size.py, name should be the same as in mission file. I do not remind now how I measure map size, I think I used the coordinate in mission editor, by moving at X and Y end of the map,

 

  • Thanks 1
=AD=uumembwa
Posted

Yes i found max coordinates in mission editor, via ikon on the edge of map. But i away from home, can't say help it or not, atm 

=AD=uumembwa
Posted

No it still not work with same error message. Maybe must be a some "update" action after files edit? Or maps can be in some another file(s)?

C6_lefuneste
Posted
21 hours ago, NHK295M said:

No it still not work with same error message. Maybe must be a some "update" action after files edit? Or maps can be in some another file(s)?

I'll have a look, but as I said I need to re install my python env....So maybe next WE...

  • 2 weeks later...
Posted

I just added normandy maps in map_size.py and it seems to work. If not please upload your misson here.

  • Thanks 1
Posted

Thanks a lot @C6_lefuneste ! @NHK295M, in theory you just have to upgrade the package in your python environment:
 

pip install --upgrade git+https://github.com/lefufu/PylGBMiMec

I will check when I can

Posted

this happend after install:

(base) PS C:\Users\pimpochka96> cd random_weather
(base) PS C:\Users\pimpochka96\random_weather> python random_weather.py
Traceback (most recent call last):
  File "random_weather.py", line 10, in <module>
    from pylgbmimec.basic_functions.mission_class import *
  File "C:\ProgramData\Anaconda3\lib\site-packages\pylgbmimec\basic_functions\mission_class.py", line 2, in <module>
    from .file_functions import getBegining, readGroupFromFile, readObjectFromFile
  File "C:\ProgramData\Anaconda3\lib\site-packages\pylgbmimec\basic_functions\file_functions.py", line 4, in <module>
    from basic_functions.error_handling import *
ModuleNotFoundError: No module named 'basic_functions'
(base) PS C:\Users\pimpochka96\random_weather>

 

Posted

looks like you do not have the good version of PylGBMimec in your python environment, I do not have this error. Do you use Anaconda ?

If so you need first to launch the anaconda console, then activate your environment (in my case: activate il2) then you need to do the update:
 

pip install --upgrade git+https://github.com/lefufu/PylGBMiMec
Posted
2 minutes ago, super-truite said:

then activate your environment

I don't remember what environment was when i intall random weather:wacko:

activate il2 - not change situation, still same error

Posted

how do you launch the script ?

Posted (edited)
14 hours ago, super-truite said:

how do you launch the script ?

 

 

Edited by NHK295M
delete attach for free space
Posted

How to back to previos version? Now it not work complete, not only error with Normandy:wacko:

Posted

exe version work but only with old missions, i put in the library.zip new map_size and it not work(program closed without any messages) and i dunno how to change parameters in exe version:wacko:

Posted

Oh no, exe not work correctly, it delete mission briefing(localisation files are gone) and leave only mission file:wacko:

  • 3 weeks later...
Posted

Well i try to search about this error and found this, in original file code without points i try to change it and...

Spoiler

2022-11-09.png

Before

Spoiler

2022-11-09-1.png

'basic_functions' and 'declarations' was like a files in code, not as directories

  • 3 weeks later...
Posted (edited)

yes this is indeed that file that causes some problems. I made an update to PylGBMiMec. 
you can install the new version using 

pip install --upgrade git+https://github.com/lefufu/PylGBMiMec

The changes :image.thumb.png.bc23c6cba91b23edd0dac39b3155ff87.png

I will try to make a new executable, but for some reasons I cannot build it anymore

 

Edited by super-truite
  • Like 1

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...