by Lionhardt » 15 Mar 2016, 23:03
The ones who have used clouds will have noticed, that the cloud height that is defined in the weather generator is a height relative to the markers height. Therefore if the different weather generators have different heights you will end up with clouds at various heights. I wrote quick script that levels all clouds, maybe somebody finds this useful.
- Code: Select all
import sys
from sys import argv , stderr
def level_clouds(fileIn, fileOut, targetHeight):
with open(fileIn, "r") as fileIn:
fileIn = fileIn.readlines()
with open(fileOut, "w") as fileOut:
for i, line in enumerate(fileIn):
if "'cloudHeight'" in line:
for j in range(0,10):
if "position" in fileIn[i+j]:
markerHeight = float(fileIn[i+j].split(", ")[1])
break
left = line.split("FLOAT( ")[0]
line = left+"FLOAT( "+str(targetHeight - markerHeight)+" ),\n"
fileOut.write(line)
if __name__ == '__main__':
if not len(argv) == 4:
stderr.write("usgae:\npython level_clouds.py <input map_save.lua> <output> <desired cloud height>\n")
sys.exit()
else:
level_clouds(argv[1] , argv[2] , float(argv[3]))
Last edited by
Lionhardt on 17 Mar 2016, 16:51, edited 1 time in total.
Help me make better maps for all of us, visit my Mapping Thread.
Maps needing gameplay feedback:
[list updated last: 31.1.2018]
(maps available in the vault)
- Hexagonian Drylands
- Fervent Soil and Torrid Suns
YouTube Channel