I have wrote a working random weather generator based on 3 levels of intensity based on the first code given to me above. I have tested it and it works and I'll post it here in case anyone else wants to use it. It has a chance of giving a low, medium, or high intensity rain/snowstorms. Change the values to whatever you see fit. Ignore the #comments.
sub EVENT_ENTERZONE {
# Set the type of weather desired here
my $weathertype = int(rand(15));
# Check if weather is not already set to the desired type
if ($zoneweather != $weathertype)
{
my $Rain = 1;
my $Snow = 2;
my $mrain = 3;
my $msnow = 4;
my $lrain = 5;
my $lsnow = 6;
if ($weathertype == $Rain)
{
# Turn off snow (if it is on) and turn on rain
quest::snow(0);
quest::rain(0);
quest::rain(20);
}
elsif ($weathertype == $Snow)
{
# Turn off rain (if it is on) and turn on snow
quest::rain(0);
quest::snow(0);
quest::snow(20);
}
elsif ($weathertype == $mrain)
{
quest::rain(0);
quest::snow(0);
quest::rain(10);
}
elsif ($weathertype == $msnow)
{
quest::rain(0);
quest::snow(0);
quest::snow(10);
}
elsif ($weathertype == $lrain)
{
quest::rain(0);
quest::snow(0);
quest::rain(1);
}
elsif ($weathertype == $lsnow)
{
quest::rain(0);
quest::snow(0);
quest::snow(1);
}
else
{
# Turn off both snow and rain
quest::rain(0);
quest::snow(0);
}
}
}
}
|