Jump to content

Recommended Posts

LFDM-Carleo
Posted

Hello all,

 

Does it possible to get a random weather a each start of my multiplayer map.

In my .mission file   i can find this

 

CloudLevel = 600;
  CloudHeight = 900;
  PrecLevel = 0;
  PrecType = 0;
  CloudConfig = "summer\02_Medium_03\sky.ini";
  SeaState = 0;
  Turbulence = 0;
  TempPressLevel = 0;
  Temperature = 25;
  Pressure = 760;
  WindLayers
  {
    0 :     0 :     0;
    500 :     350 :     1;
    1000 :     340 :     2;
    2000 :     0 :     4;
    5000 :     350 :     8;
  }

 

Does it possible to randomise the value  by calling an external java or php file

May be it's not possible but  who no ask will never know

 

Posted

Sure, that should be pretty easy to do. There is also a new tool which I haven't tried yet to save msnbin files (for faster loading) in bin/resaver.

=LG/F=Kathon
Posted

Yes and I do that with my script for TAW server. Weather, wind, temperature, clouds type all can be randomize. I'm not sure about clouds level and high. I also use resaver to create msnbin files :)

LFDM-Carleo
Posted

does it possible to get your script i'm not an expert in developpement and a functionnal base is very helpful

LFDM-Carleo
Posted

Hello all  i'm starting with this  but i don't know how select correctly my caracters string

This implement each time i launch it my random selection whitout erasing the old one

 

import random
Nuage = ['Clear','Light','Medium','Heavy','Overcast']
Indice = ['00','01','02','03','04','05']
Level = ['00','01','02','03','04','05','06','07','08','09']
PLevel = str(random.randint(0,255))
PType = str(random.randint(0,2))
Cloud1 = str(random.choice(Indice))
Cloud2 = str(random.choice(Nuage))
Cloud3 = str(random.choice(Level))


PrecLevel = PLevel
PrecType = PType
CloudConfig = Cloud1+'_'+Cloud2+'_'+Cloud3



fichier = open("test.txt", "r")
chaine1 = fichier.read().replace("PrecLevel = ","PrecLevel = "+ PrecLevel +";")
chaine2 = fichier.read().replace("PrecType = ","PrecType = " + PrecType +";")
chaine3 = fichier.read().replace("""CloudConfig = "summer\\""","""CloudConfig = "summer\\""" + CloudConfig + """\sky.ini";""")
fichier.close()


fichier = open("test.txt", "w")
fichier.write(chaine1)
fichier.write(chaine2)
fichier.write(chaine3)
fichier.close()  

 

LFDM-Carleo
Posted

Ok, loosing my hairs trying to do this

Someone can give me a way to take

LFDM-Carleo
Posted (edited)

Hello all,

 

I have some good result with this script

import random
import fileinput
import sys

Nuage = ['Clear','Light','Medium','Heavy','Overcast']
Indice = ['00','01','02','03','04',]
Level = ['00','01','02','03','04','05','06','07','08','09']
Turbulence = ['0','1','2','5','6','7','8','10','11','15']
PLevel = str(random.randint(0,100))
PType = str(random.randint(0,2))
Cloud1 = str(random.choice(Indice))
Cloud2 = str(random.choice(Nuage))
Cloud3 = str(random.choice(Level))
Turb = str(random.randint (0,10))
Daltitude_0 = str(random.randint (0,360))
Daltitude_1 = str(random.randint (0,360))
Daltitude_2 = str(random.randint (0,360))
Daltitude_3 = str(random.randint (0,360))
Daltitude_4 = str(random.randint (0,360))
Waltitude_0 = str(random.randint (0,25))
Waltitude_1 = str(random.randint (0,25))
Waltitude_2 = str(random.randint (0,25))
Waltitude_3 = str(random.randint (0,25))
Waltitude_4 = str(random.randint (0,25))

Turbulence = Turb
PrecLevel = PLevel
PrecType = PType
CloudConfig = Cloud1+'_'+Cloud2+'_'+Cloud3


R = open('Entrainement.Mission' , 'r')
R_lines = R.readlines()
A = R_lines[30]
B = R_lines[31]
C = R_lines[32]
D = R_lines[34]
E = R_lines[40]
F = R_lines[41]
G = R_lines[42]
H = R_lines[43]
I = R_lines[44]

A2 = "  PrecLevel = "+ PrecLevel +";"'\n'
B2 = "  PrecType = " + PrecType +";"'\n'
C2 = """  CloudConfig = "summer\\""" + CloudConfig + """\\sky.ini";"""'\n'
D2 = "  Turbulence = "+ Turbulence +";"'\n'
E2 = "    0 :     " + Daltitude_0 + " :     " + Waltitude_0 + ";"'\n'
F2 = "    500 :     " + Daltitude_1 + " :     " + Waltitude_1 + ";"'\n'
G2 = "    1000 :     " + Daltitude_2 + " :     " + Waltitude_2 + ";"'\n'
H2 = "    2000 :     " + Daltitude_3 + " :     " + Waltitude_3 + ";"'\n'
I2 = "    5000 :     " + Daltitude_4 + " :     " + Waltitude_4 + ";"'\n'


print (A + A2)
print (B + B2)
print (C + C2)
print (D + D2)
print (E + E2)            
print (F + F2)
print (G + G2)
print (H + H2)
print (I + I2)
             
R.close()
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(A, A2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(B, B2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(C, C2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(D, D2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(E, E2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(F, F2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(G, G2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(H, H2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(I, I2), end='')


I launch it from the resaver.bat file

Now i need to launch my file from the editor when my mssion begin to create the next one

 
 

Edited by NNFFL=Carleo
  • Upvote 3
LFDM-Carleo
Posted

Hello again

 

Someone can  tell me if i can call from the .sds file an external file  like my  mission_resaver.bat which is calling my random.py

=LG/F=Kathon
Posted

Hello again

 

Someone can  tell me if i can call from the .sds file an external file  like my  mission_resaver.bat which is calling my random.py

You should open a .sds file from the script after creating a new file to run it in DServer.

LFDM-Carleo
Posted

I can't launch myself each time my script when  the server restart a the end of my mission.

Do you understand what i mean ??   end mission -> Dserver restarting -> loading .sds file -> Mission start

LFDM-Carleo
Posted

I have changed my way . Now i lauching my  mission_resaver.bat  every 30min and my mission have a time ending (2h30min).

Like this what happens in my mission  the new one start with news parameters

 

Now i working on the random parameters to get something  more realistic about clouds winds and rain

=LG/F=Kathon
Posted

I can't launch myself each time my script when  the server restart a the end of my mission.

Do you understand what i mean ??   end mission -> Dserver restarting -> loading .sds file -> Mission start

I did it like that (maybe it will help you):

 

In my script loop:

1. Mission is running

2. Delete old mission file

3. End mission by sending Server Input command to DServer console after xxx seconds

4. Create new mission file (DServer loads new mission file automatically)

5. go to 1.

LFDM-Carleo
Posted

Thanks for your light i find my way

LFDM-Carleo
Posted

Here is my last version of my python for those are interested by

Wind Rain and Turbulence are function of the Cloud type

Snow are not selected because it is designed for summer map

 

 

import random
import fileinput
import sys


Nuage = ['00_Clear_','01_Light_','02_Medium_','03_Heavy_','04_Overcast_']
Level = ['00','01','02','03','04','05','06','07','08','09']
Turbulence = ['0','1','2','5','6','7','8','10']
Hour = ['7','8','9','10','11','12','13','14','15','16','17','18','19','20']
Min = ['00','30']

Cloud1 = str(random.choice(Nuage))
Cloud2 = str(random.choice(Level))

if Cloud1 == '04_Overcast_' :
    PType = str(random.randint(0,1))
    PLevel = str(random.randint(0,100))
    Turb = str(random.randint (0,10))
    Wind1 = 0
    Wind2 = 20
elif Cloud1 == '03_Heavy_' :
    PType = str(random.randint(0,1))
    PLevel = str(random.randint(0,50))
    Turb = str(random.randint (0,5))
    Wind1 = 0
    Wind2 = 15
elif Cloud1 == '02_Medium_' :
    PType = str(random.randint(0,1))
    PLevel = str(random.randint(0,25))
    Turb = str(random.randint (0,3))
    Wind1 = 0
    Wind2 = 10
elif Cloud1 == '01_Light_' :
    PType = str(random.randint(0,1))
    PLevel = str(random.randint(0,10))
    Turb = str(random.randint (0,1))
    Wind1 = 0
    Wind2 = 5
elif Cloud1 == '00_Clear_' :
    PType = str(0)
    PLevel = str(0)
    Turb = str(0)
    Wind1 = 0
    Wind2 = 0
else :
    PType = str(0)
    PLevel = str(0)
    Turb = str(0)
    Wind1 = 0
    Wind2 = 0

    
D0 = random.randint (0,360)
D_Temp = random.randint (-20,20)
D1 = D0 + D_Temp
D_Temp = random.randint (-20,20)
D2 = D1 + D_Temp
D_Temp = random.randint (-20,20)
D3 = D2 + D_Temp
D_Temp = random.randint (-20,20)
D4 = D3 + D_Temp

Daltitude_0 = str(D0)
Daltitude_1 = str(D1)
Daltitude_2 = str(D2)
Daltitude_3 = str(D3)
Daltitude_4 = str(D4)
Waltitude_0 = str(random.randint (Wind1,Wind2))
Waltitude_1 = str(random.randint (Wind1,Wind2))
Waltitude_2 = str(random.randint (Wind1,Wind2))
Waltitude_3 = str(random.randint (Wind1,Wind2))
Waltitude_4 = str(random.randint (Wind1,Wind2))
HTime = str(random.choice(Hour))
MTime = str(random.choice(Min))
Turbulence = Turb
PrecLevel = PLevel
PrecType = PType
CloudConfig = Cloud1+Cloud2
Time = HTime+':'+MTime

R = open('Entrainement.Mission' , 'r')
R_lines = R.readlines()
A = R_lines[30]
B = R_lines[31]
C = R_lines[32]
D = R_lines[34]
E = R_lines[40]
F = R_lines[41]
G = R_lines[42]
H = R_lines[43]
I = R_lines[44]
J = R_lines[18]

A2 = "  PrecLevel = "+ PrecLevel +";"'\n'
B2 = "  PrecType = " + PrecType +";"'\n'
C2 = """  CloudConfig = "summer\\""" + CloudConfig + """\\sky.ini";"""'\n'
D2 = "  Turbulence = "+ Turbulence +";"'\n'
E2 = "    0 :     " + Daltitude_0 + " :     " + Waltitude_0 + ";"'\n'
F2 = "    500 :     " + Daltitude_1 + " :     " + Waltitude_1 + ";"'\n'
G2 = "    1000 :     " + Daltitude_2 + " :     " + Waltitude_2 + ";"'\n'
H2 = "    2000 :     " + Daltitude_3 + " :     " + Waltitude_3 + ";"'\n'
I2 = "    5000 :     " + Daltitude_4 + " :     " + Waltitude_4 + ";"'\n'
J2 = "  Time = "+ Time +":0;"'\n'

print (A + A2)
print (B + B2)
print (C + C2)
print (D + D2)
print (E + E2)            
print (F + F2)
print (G + G2)
print (H + H2)
print (I + I2)
print (J + J2)
             
R.close()
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(A, A2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(B, B2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(C, C2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(D, D2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(E, E2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(F, F2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(G, G2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(H, H2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(I, I2), end='')
with fileinput.FileInput('Entrainement.Mission', inplace=True, backup='.bak') as file:
    for line in file:
        print(line.replace(J, J2), end='')

 

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