Code: Select all
#!/usr/bin/perl
while ($#ARGV >= 0) {
if ($ARGV[0] eq "-t") {
$TEST = 1;
shift;
} elsif ($ARGV[0] eq "-g") {
shift;
if ($ARGV[0] eq "acw") {
$ACW = 1;
} elsif ($ARGV[0] eq "ncp") {
$NCP = 1;
} elsif ($ARGV[0] eq "pon") {
$PON = 1;
} elsif ($ARGV[0] eq "rop") {
$ROP = 1;
} elsif ($ARGV[0] eq "rus") {
$RUS = 1;
} elsif ($ARGV[0] eq "wia") {
$WIA = 1;
} else {
die "invalid or missing game parameter\n";
}
shift;
} elsif ($ARGV[0] eq "-s") {
shift;
@areasnow = ($ARGV[0]);
shift;
} else {
print "Usage: mkweathers.pl [-t] -g {acw|ncp|pon|rop|rus|wia} [-s <areasnow>]\n";
exit 1;
}
}
if ($WIA) {
@weathers = ("Fair", "Mud", "Snow", "Frozen", "Blizzard");
@terrains = ("Other", "Swamp", "Wilderness", "Mountain", "FreezeShallow", "NoFreezeShallow", "CoastalWaters", "FreezeOcean", "NoFreezeOcean");
@areascontinental = ("Canadian_Maritimes", "Eastern_Canada", "Western_Canada", "Eastern_Great_Lakes", "Western_Great_Lakes", "Upper_New_England");
@areastemperate = ("Lower_New_England", "Kentuckee_Uplands", "Upland_Middle_States", "Upper_West", "Northern_Plains", "Coastal_Middle_States", "WxAtlantic", "WxEurope");
@areassubtropical = ("Southern_Plains", "Upland_South", "Upland_Southeast", "Lower_Louisianne", "Coastal_Carribean", "Coastal_Southeast");
@areasall = (@areascontinental, @areastemperate, @areassubtropical);
# jan feb mar apr may jun jul aug sep oct nov dec
@continentalcool = (3.6, 3.4, 2.8, 2.2, 0.5, 0.2, 0.1, 0.1, 0.2, 0.4, 2.8, 3.4);
@continental = (3.2, 2.4, 1.8, 1.2, 0.3, 0.1, 0.0, 0.0, 0.1, 0.3, 1.8, 2.4);
@continentalwarm = (1.8, 1.4, 1.0, 0.8, 0.2, 0.0, 0.0, 0.0, 0.0, 0.2, 1.0, 1.4);
# jan feb mar apr may jun jul aug sep oct nov dec
@temperatecool = (2.8, 2.5, 2.0, 1.2, 0.4, 0.2, 0.1, 0.1, 0.2, 0.3, 2.0, 2.5);
@temperate = (1.8, 1.5, 1.2, 0.5, 0.2, 0.1, 0.0, 0.0, 0.1, 0.2, 1.2, 1.5);
@temperatewarm = (1.0, 0.8, 0.6, 0.3, 0.1, 0.0, 0.0, 0.0, 0.0, 0.1, 0.6, 0.8);
# jan feb mar apr may jun jul aug sep oct nov dec
@subtropicalcool = (1.5, 1.2, 1.1, 0.5, 0.5, 0.2, 0.2, 0.1, 0.2, 0.5, 1.1, 1.2);
@subtropical = (0.9, 0.8, 0.7, 0.6, 0.4, 0.1, 0.1, 0.1, 0.1, 0.4, 0.6, 0.8);
@subtropicalwarm = (0.8, 0.7, 0.6, 0.5, 0.3, 0.1, 0 , 0 , 0 , 0.2, 0.4, 0.7);
} elsif ($ROP) {
@weathers = ("Clear", "Mud", "Snow", "HarshWeather", "VHarshWeather");
@terrains = ("normal", "low", "high", "coldwater", "water");
@areascontinental = ("Alpine");
@areastemperate = ("Interior_Lowlands", "Interior_Uplands", "Baltic_Coast");
@areastemperatecoastal = ("North_Sea_Coast");
@areasall = (@areascontinental, @areastemperate, @areastemperatecoastal);
# jan feb mar apr may jun jul aug sep oct nov dec
@continentalcool = (3.6, 3.4, 2.8, 2.2, 0.5, 0.2, 0.1, 0.1, 0.2, 0.4, 2.8, 3.4);
@continental = (3.2, 2.4, 1.8, 1.2, 0.3, 0.1, 0.0, 0.0, 0.1, 0.3, 1.8, 2.4);
@continentalwarm = (1.8, 1.4, 1.0, 0.8, 0.2, 0.0, 0.0, 0.0, 0.0, 0.2, 1.0, 1.4);
# jan feb mar apr may jun jul aug sep oct nov dec
@temperatecool = (2.8, 2.5, 2.0, 1.2, 0.4, 0.2, 0.1, 0.1, 0.2, 0.3, 2.0, 2.5);
@temperate = (1.8, 1.5, 1.2, 0.5, 0.2, 0.1, 0.0, 0.0, 0.1, 0.2, 1.2, 1.5);
@temperatewarm = (1.0, 0.8, 0.6, 0.3, 0.1, 0.0, 0.0, 0.0, 0.0, 0.1, 0.6, 0.8);
} elsif ($ACW) {
# this space for rent
} elsif ($NCP) {
# space abhors a vacuum
} elsif ($PON) {
# vacancy, apply within
} elsif ($RUS) {
# no comment
}
@months = ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$wnum = @weathers;
$tnum = @terrains;
$mnum = @months;
# do not edit; for displaying areas only
@snowcool = (2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2);
@snow = (2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2);
@snowwarm = (2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2);
# do not edit; for displaying areas only
@faircool = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
@fair = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
@fairwarm = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
if (defined(@areasnow)) {
outputweathers("areasall", "faircool", "fair", "fairwarm");
outputweathers("areasnow", "snowcool", "snow", "snowwarm");
} else {
if ($WIA) {
outputweathers("areascontinental", "continentalcool", "continental", "continentalwarm", (0, 0, 1, 1, 0, -1, -1, 0, -1));
outputweathers("areastemperate", "temperatecool", "temperate", "temperatewarm", (0, 0, 1, 1, 0, -1, -1, 0, -1));
outputweathers("areassubtropical", "subtropicalcool", "subtropical", "subtropicalwarm", (0, 0, 1, 1, 0, -1, -1, 0, -1));
} elsif ($ROP) {
outputweathers("areascontinental", "continentalcool", "continental", "continentalwarm", (0, 0, 1, 1, -1));
outputweathers("areastemperate", "temperatecool", "temperate", "temperatewarm", (0, 0, 1, 1, 0));
outputweathers("areastemperatecoastal", "temperatecool", "temperate", "temperatewarm", (0, 0, 1, 1, -1));
}
}
exit 0;
sub outputweathers {
# for @ta: for each terrain, 0 normal, 1 cooler, -1 warmer
my ($areas, $cool, $norm, $warm, @ta) = @_;
my $a, $m, $t, $w, $p, $pr, $weather;
foreach $a (@$areas) {
$inifile = "WeatherPatterns_" . $a . ".ini";
open(INIFILE, ">$inifile") if ! $TEST;
for ($m=0; $m<=$mnum-1; $m++) {
for ($t=0; $t<=$tnum-1; $t++) {
for ($w=0; $w<=$wnum-1; $w++) {
if ($ta[$t] == 1) {
$pr = abs($w - $$cool[$m]);
} elsif ($ta[$t] == 0) {
$pr = abs($w - $$norm[$m]);
} elsif ($ta[$t] == -1) {
$pr = abs($w - $$warm[$m]);
}
if ($pr > 1) {
$p = 0;
} else {
$p = (1-$pr)*100;
}
if ($ROP && ($t == 0) && ($w == 0)) {
$weather = "Fair";
} else {
$weather = $weathers[$w];
}
if (! $TEST) {
print INIFILE "$a|$months[$m]|$terrains[$t]|$weather|$p\r\n";
} else {
print "$a|$months[$m]|$terrains[$t]|$weather|$p\r\n";
}
}
}
}
close(INIFILE) if ! $TEST;
}
}
Code: Select all
./mkweathers.pl -t -g wia | less
Code: Select all
./mkweathers.pl -g wia
Code: Select all
./mkweathers.pl -g wia -s Coastal_Middle_States
Stwa wrote:Also, I found another axiom (from the satellite images), and that is if you draw a diagonal line on the BoA map from NE to SW, to the North and West of the line you are more likely for harsh weather (like frozen and blizzard). And to the East and South, you are less like for harsh weather.
berto wrote:Does that include the Areas.ini file (i.e., the .xls files that generates that)? I will need to mod that .ini(.xls) file also.
Note: I'll be sure to fix the always-fair coastal weathers problem, too.
lodilefty wrote:Areas.ini is one of the few files without an xls file. Hence extremely vulnerable to errors.
Attached are the manually managed {mess} of ini files relating to areas. I suggest minimal changes to any existing aliases, especially regions.ini and anything not involving weather:
Areas.ini belongs in WIA/GameData
Others are in WIA/Aliases
[ATTACH]15833[/ATTACH]
...and I'll include you version 0.4 in the beta patch for now.....
lodilefty wrote:OK, please do the DB, as the changes so far are good ones.
...as you have often said, mods are up to the modders.
PhilThib wrote:Good ideas...I am most interested by a mod for NCP weather
Users browsing this forum: No registered users and 2 guests