Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-31-2011, 06:45 PM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default 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?
Reply With Quote
  #2  
Old 04-01-2011, 11:56 PM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

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
Reply With Quote
  #3  
Old 04-02-2011, 01:51 AM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default

That sounds perfect, but how do I find this? Sorry, im not experienced with perl scripts.
Reply With Quote
  #4  
Old 04-02-2011, 02:04 AM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default

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.
Reply With Quote
  #5  
Old 04-02-2011, 05:55 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

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);
		}
	}

}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #6  
Old 04-02-2011, 02:30 PM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default

This is really awesome, thanks a lot!
Reply With Quote
  #7  
Old 04-02-2011, 02:32 PM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default

Sorry - one last question, How can I modify this to be based on a chance percentage?
Reply With Quote
  #8  
Old 04-02-2011, 02:53 PM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

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)
Reply With Quote
  #9  
Old 04-02-2011, 09:00 PM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default

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?
Reply With Quote
  #10  
Old 04-02-2011, 09:20 PM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default

it doesnt work, can anyone help?
Reply With Quote
  #11  
Old 04-02-2011, 09:40 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

Conditions use ==

Also, there may be too many elsif's. You won't know that until the script actually runs.
Reply With Quote
  #12  
Old 04-03-2011, 12:22 AM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

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
Reply With Quote
  #13  
Old 04-03-2011, 12:53 AM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default

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).
Reply With Quote
  #14  
Old 04-03-2011, 01:44 AM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

ah great to know- i thought that feature was lost to us =)
Reply With Quote
  #15  
Old 04-03-2011, 01:46 AM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default

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);
}
}
}

}
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 10:37 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3