|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
Support::Windows Servers Support forum for Windows EQEMu users. |

03-31-2011, 06:45 PM
|
Hill Giant
|
|
Join Date: Dec 2009
Posts: 157
|
|
weather
Hey, I seem to have a problem in my server with the weather effects changing. I have yet to ever see it change on its own, but using the #weather command works. I would like for the weather to change on its own though. What could be wrong?
|

04-01-2011, 11:56 PM
|
 |
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
default chance for weather to change is VERY tine - like 5%
similarly when it begins to rain - it will rain for hours, cause again, chance to swith back to good weather is also very small
however there is a perl script command now which allows you to run your own weather program (you can set your own random chance or switch it based of time of day etc), just need to disable weather options in zone table
|

04-02-2011, 01:51 AM
|
Hill Giant
|
|
Join Date: Dec 2009
Posts: 157
|
|
That sounds perfect, but how do I find this? Sorry, im not experienced with perl scripts.
|

04-02-2011, 02:04 AM
|
Hill Giant
|
|
Join Date: Dec 2009
Posts: 157
|
|
Alright so from searching on the forum it looks like I have to write a quest to do what you are saying. Can you please post a sample perl script for this? It would be awesome and id be very grateful.
|

04-02-2011, 05:55 AM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
This should work, though I didn't actually test it:
File Name: player.pl - Save this in the zone folder you want to adjust weather for
Code:
sub EVENT_ENTERZONE {
# Set the type of weather desired here
my $weathertype = 1; # 0 for none, 1 for rain, 2 for snow
# Check if weather is not already set to the desired type
if ($zoneweather != $weathertype)
{
my $Rain = 1;
my $Snow = 2;
if ($weathertype == $Rain)
{
# Turn off snow (if it is on) and turn on rain
quest::snow(0);
quest::rain(1);
}
elsif ($weathertype == $Snow)
{
# Turn off rain (if it is on) and turn on snow
quest::rain(0);
quest::snow(1);
}
else
{
# Turn off both snow and rain
quest::rain(0);
quest::snow(0);
}
}
}
|

04-02-2011, 02:30 PM
|
Hill Giant
|
|
Join Date: Dec 2009
Posts: 157
|
|
This is really awesome, thanks a lot!
|

04-02-2011, 02:32 PM
|
Hill Giant
|
|
Join Date: Dec 2009
Posts: 157
|
|
Sorry - one last question, How can I modify this to be based on a chance percentage?
|

04-02-2011, 02:53 PM
|
 |
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
you need to insert a script that would generate sort of a random number and pull from its selection.
along these lines
my $a = quest::ChooseRandom(1, 2,3,4,5,6,7,8,9,10);
then you check with If statement which $a was choose, and set weather accordingly (like 1 to 5 - no weather, 6-8 rain, 9-10 snow)
|
 |
|
 |

04-02-2011, 09:00 PM
|
Hill Giant
|
|
Join Date: Dec 2009
Posts: 157
|
|
OK, i took the time and learned a lot about how to use perl and I wrote this script I'd like to use that takes account a percentage chance of weather when you zone in and also after 1500 seconds it does it again. I know theres probably MUCH easier way to write it then what I did but here is what I came up with:
sub EVENT_ENTERZONE{
quest::settimer("weathertimer",1500);
my $randweather = int(rand(100));
if ($randweather <70) {
quest::rain(0);
quest::snow(0);
}
elsif ($randweather =71) {
quest::rain (1);
quest::snow(0);
}
elsif ($randweather =72){
quest::rain(2);
quest::snow(0);
}
elsif ($randweather =73){
quest::rain(3);
quest::snow(0);
}
elsif ($randweather =73){
quest::rain(3);
quest::snow(0);
}
elsif ($randweather =74){
quest::rain(4);
quest::snow(0);
}
elsif ($randweather =75){
quest::rain(5);
quest::snow(0);
}
elsif ($randweather =76){
quest::rain(6);
quest::snow(0);
}
elsif ($randweather =77){
quest::rain(7);
quest::snow(0);
}
elsif ($randweather =78){
quest::rain(8);
quest::snow(0);
}
elsif ($randweather =79){
quest::rain(9);
quest::snow(0);
}
elsif ($randweather =80){
quest::rain(10);
quest::snow(0);
}
elsif ($randweather =81){
quest::rain(11);
quest::snow(0);
}
elsif ($randweather =82){
quest::rain(12);
quest::snow(0);
}
elsif ($randweather =83){
quest::rain(13);
quest::snow(0);
}
elsif ($randweather =84){
quest::rain(14);
quest::snow(0);
}
elsif ($randweather =85){
quest::rain(15);
quest::snow(0);
}
elsif ($randweather =86){
quest::rain(16);
quest::snow(0);
}
elsif ($randweather =87){
quest::rain(17);
quest::snow(0);
}
elsif ($randweather =88){
quest::rain(18);
quest::snow(0);
}
elsif ($randweather =89){
quest::rain(19);
quest::snow(0);
}
elsif ($randweather =90){
quest::rain(20);
quest::snow(0);
}
elsif ($randweather =91){
quest::rain(0);
quest::snow(1);
}
elsif ($randweather =92){
quest::rain(0);
quest::snow(2);
}
elsif ($randweather =93){
quest::rain(0);
quest::snow(3);
}
elsif ($randweather =94){
quest::rain(0);
quest::snow(4);
}
elsif ($randweather =95){
quest::rain(0);
quest::snow(5);
}
elsif ($randweather =96){
quest::rain(0);
quest::snow(6);
}
elsif ($randweather =97){
quest::rain(0);
quest::snow(7);
}
elsif ($randweather =98){
quest::rain(0);
quest::snow(8);
}
elsif ($randweather =99){
quest::rain(0);
quest::snow(9);
}
elsif ($randweather =100){
quest::rain(0);
quest::snow(10);
}
sub EVENT_TIMER{
if ($timer eq "weathertimer")
{
quest::stoptimer("weathertimer");
my $secondrandweather = int(rand(100));
if ($secondrandweather <70) {
quest::rain(0);
quest::snow(0);
}
elsif ($secondrandweather =71) {
quest::rain (1);
quest::snow(0);
}
elsif ($secondrandweather =72){
quest::rain(2);
quest::snow(0);
}
elsif ($secondrandweather =73){
quest::rain(3);
quest::snow(0);
}
elsif ($secondrandweather =73){
quest::rain(3);
quest::snow(0);
}
elsif ($secondrandweather =74){
quest::rain(4);
quest::snow(0);
}
elsif ($secondrandweather =75){
quest::rain(5);
quest::snow(0);
}
elsif ($secondrandweather =76){
quest::rain(6);
quest::snow(0);
}
elsif ($secondrandweather =77){
quest::rain(7);
quest::snow(0);
}
elsif ($secondrandweather =78){
quest::rain(8);
quest::snow(0);
}
elsif ($secondrandweather =79){
quest::rain(9);
quest::snow(0);
}
elsif ($secondrandweather =80){
quest::rain(10);
quest::snow(0);
}
elsif ($secondrandweather =81){
quest::rain(11);
quest::snow(0);
}
elsif ($secondrandweather =82){
quest::rain(12);
quest::snow(0);
}
elsif ($secondrandweather =83){
quest::rain(13);
quest::snow(0);
}
elsif ($secondrandweather =84){
quest::rain(14);
quest::snow(0);
}
elsif ($secondrandweather =85){
quest::rain(15);
quest::snow(0);
}
elsif ($secondrandweather =86){
quest::rain(16);
quest::snow(0);
}
elsif ($secondrandweather =87){
quest::rain(17);
quest::snow(0);
}
elsif ($secondrandweather =88){
quest::rain(18);
quest::snow(0);
}
elsif ($secondrandweather =89){
quest::rain(19);
quest::snow(0);
}
elsif ($secondrandweather =90){
quest::rain(20);
quest::snow(0);
}
elsif ($secondrandweather =91){
quest::rain(0);
quest::snow(1);
}
elsif ($secondrandweather =92){
quest::rain(0);
quest::snow(2);
}
elsif ($secondrandweather =93){
quest::rain(0);
quest::snow(3);
}
elsif ($secondrandweather =94){
quest::rain(0);
quest::snow(4);
}
elsif ($secondrandweather =95){
quest::rain(0);
quest::snow(5);
}
elsif ($secondrandweather =96){
quest::rain(0);
quest::snow(6);
}
elsif ($secondrandweather =97){
quest::rain(0);
quest::snow(7);
}
elsif ($secondrandweather =98){
quest::rain(0);
quest::snow(8);
}
elsif ($secondrandweather =99){
quest::rain(0);
quest::snow(9);
}
elsif ($secondrandweather =100){
quest::rain(0);
quest::snow(10);
}
}
I feel as if this should work, is there anything wrong with this?
|
 |
|
 |

04-02-2011, 09:20 PM
|
Hill Giant
|
|
Join Date: Dec 2009
Posts: 157
|
|
it doesnt work, can anyone help?
|

04-02-2011, 09:40 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
Conditions use ==
Also, there may be too many elsif's. You won't know that until the script actually runs.
|

04-03-2011, 12:22 AM
|
 |
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
also, I am pretty sure there is no such thing as rain(15)
it either:
(1) - on
or
(0) - off
also, (0)'s should be in code be before (1)'s
|

04-03-2011, 12:53 AM
|
Hill Giant
|
|
Join Date: Dec 2009
Posts: 157
|
|
Thanks for the help, im going to finish tweaking something. It appears that there were too many elsif's (i think)
but I have tested with numbers higher then 1 for the quest::rain(x) command and it does work and it seems to control the intensity of the weather. So far Ive seen much harder rainstorms/snowstorms at (10) rather than (1).
|

04-03-2011, 01:44 AM
|
 |
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
ah great to know- i thought that feature was lost to us =)
|
 |
|
 |

04-03-2011, 01:46 AM
|
Hill Giant
|
|
Join Date: Dec 2009
Posts: 157
|
|
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);
}
}
}
}
|
 |
|
 |
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 11:44 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |