Changing Weather using WAC scripting

Post Reply
User avatar
Country Joe-PG-
Squad Member
Squad Member
Posts: 2119
Joined: Sun May 30, 2010 12:29 pm
Location: USA

Changing Weather using WAC scripting

Post by Country Joe-PG- »

If you'd like to use Rain, Snow, Overcast skies, or Fog in your map that changes during map play here's how I do it using the WAC file.

Start your map's WAC file off with the following:

if never () then
rain (0,1)
overcast (0,1)
fogdist(1000,1)
endif

This short script sets you up to change weather during map play.

The first number inside the parenthesis for rain is how hard the rain falls. This number can be from 0 (no rain) to 100 (down pour)

The second number in the rain parenthesis is for how soon you want it to start from 1 (immediately) to what ever number but I generally don't go more than 120 seconds.

(Note: I've read on one site that the second number inside the parenthesis refers to how long (in seconds) it takes for the script to act. I've read on another site the second number is in tenths of a second. Either way, the higher the number the longer it takes for the script to act and has worked well for my maps.)

The same applies to overcast. The higher the first number the more overcast it is.

The first number inside the fog parenthesis sets the fog distance to so many meters. In the example it's set to go to 1000 meters immediately.

During map play you may want to change the weather. You can use several things to accomplish this.
Objectives or Events when completed. An AI that's dead. AN Enemy vehicle that's been destroyed.
These are just a few of the things I've used in my maps over the years.

For example, I want to change the weather after the first Objective has been completed to overcast and some fog because later in the map I want it to start raining and be a little tougher to snipe. I'd use the following:

if event (3) and never () then
consol("WELL DONE TEAM. MOVE TO THE NEXT MISSION AREA")
overcast(70,60)
movefog(600,60)
endif

What I've done here is to slowly allow the skies to cloud up and the fog to slowly roll in by moving it from 1000 meters to 600 meters.

If I want to use an AI that's been killed to accomplish the same thing I'd use the script:

if ssndead (70) and never () then
overcast(70,60)
movefog(600,60)
endif

Now that I've set up the ability to have it rain I can use an Event or AI dead to actually make it rain. For example:

If event (5) and never () then
consol("GOOD JOB TEAM. NOW SEARCH FOR THE RADIO EQUIPMENT")
consol("AND DESTROY IT ALL.")
rain(50,60)
overcast(100,60)
endif

or

If ssndead (105) and never () then
rain(50,60)
overcast(100,60)
endif

This makes it rain (moderately) and makes it completely overcast.

Let's say later in the map, after an Event has been completed, I need to make the weather a bit more clear because Blue Team has to fly Helicopters and attack an area. I can use the following script(s) to make the weather ease up.

if event (14) and never () then
consol("GRAB AN ENEMY HELO AND FLY TO THE NEXT MISSION AREA.")
rain(30,60)
overcast(50,60)
movefog(800,60)
endif

or

if ssndead (1024) and never () then
rain(30,60)
overcast(50,60)
movefog(800,60)
endif

This moves the rain to a slight drizzle. Clears the skies up a bit and moves the fog out to 800 meters.

Several of the Mission enviorments already have overcast skies so you could choose not to use the overcast script instead just make it rain at certain times during map play.

If you've made a snow terrain map and want it to snow just substitute the word "snow" for "rain" in the above examples.

Remember, this is generally how I use WAC scripting to change the weather and I thought I'd share the info. The other map makers may have a different way to accomplish it. Just ask away. We don't mind helping. :mrgreen:
Image
Image
User avatar
Bubbachuk-PG-
Site Admin
Site Admin
Posts: 4914
Joined: Sun May 16, 2010 1:59 pm
Location: Marshville, North Carolina
Contact:

Re: Changing Weather using WAC scripting

Post by Bubbachuk-PG- »

Thanks, Joe.
Image
Image

The democracy will cease to exist when you take away from those who
are willing to work and give to those who would not.
~ Thomas Jefferson

Website: http://pgsquad.com
Facebook: https://www.facebook.com/oliver.holmes.357
User avatar
The Texican-PG-
Squad Member
Squad Member
Posts: 1746
Joined: Sun Jun 20, 2010 5:00 pm

Re: Changing Weather using WAC scripting

Post by The Texican-PG- »

What kind of settings do you have to have your environment set on the map under General information? Leave fog unchecked? Leave day set as Nice Day?
Image
“If you ain't dyin', we probably need to put more fog in the map”
― The Texican-PG-
User avatar
Bubbachuk-PG-
Site Admin
Site Admin
Posts: 4914
Joined: Sun May 16, 2010 1:59 pm
Location: Marshville, North Carolina
Contact:

Re: Changing Weather using WAC scripting

Post by Bubbachuk-PG- »

Leave "Fog" unchecked.

"Nice Day" does nothing.

Weather environmental settings can only be done with WAC scripts.
Image
Image

The democracy will cease to exist when you take away from those who
are willing to work and give to those who would not.
~ Thomas Jefferson

Website: http://pgsquad.com
Facebook: https://www.facebook.com/oliver.holmes.357
User avatar
The Texican-PG-
Squad Member
Squad Member
Posts: 1746
Joined: Sun Jun 20, 2010 5:00 pm

Re: Changing Weather using WAC scripting

Post by The Texican-PG- »

But there is a setting under General Information that has 'Environment Settings'. It changes how your map looks. Leave it alone?
Image
“If you ain't dyin', we probably need to put more fog in the map”
― The Texican-PG-
User avatar
Bubbachuk-PG-
Site Admin
Site Admin
Posts: 4914
Joined: Sun May 16, 2010 1:59 pm
Location: Marshville, North Carolina
Contact:

Re: Changing Weather using WAC scripting

Post by Bubbachuk-PG- »

But there is a setting under General Information that has 'Environment Settings'. It changes how your map looks. Leave it alone?
You can change the Environment File settings, "Start Time" which is the Time of Day you want the map to start in, and the "Minutes per Day". The lower the minutes, the faster the map cycles through a day.
Image
Image

The democracy will cease to exist when you take away from those who
are willing to work and give to those who would not.
~ Thomas Jefferson

Website: http://pgsquad.com
Facebook: https://www.facebook.com/oliver.holmes.357
Post Reply