Changing Weather using WAC scripting
Posted: Sat Mar 12, 2011 8:19 am
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.
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.