π Colour commands in WAC scripts
The colour commands written by hand in a .wac script: the full list, the values, fades, going back to the map's colours, and a server.wac block an admin tool can fire at any time.
The commands
| Command | Values | Changes |
|---|---|---|
fogcolor(R,G,B) (also fog) | 0-127 | the distance haze |
skyfogcolor(R,G,B) (also skyfog) | 0-127 | the horizon band |
sun(R,G,B) | 0-255 | sun / moon light |
sky(R,G,B) | 0-255 | light from above |
ground(R,G,B) | 0-255 | bounce light from below |
lightning(R,G,B) | 0-255 | tint of lightning flashes |
colorfade(seconds) | seconds | fade time for the colour changes after it |
floor, ceiling, cloud | R,G,B | sent to players by the DLL; what they change on screen is not tested yet |
These commands were always in Joint Ops (they come from Delta Force: Black Hawk Down) but did nothing in a Joint Ops match: the server never sent them to players, and the day/night cycle painted over them every tick. The FMJ onHook DLL fixes both, so they need the DLL on the server and the players. Scripts using them still load and run on a normal install; they just change nothing.
Example
colorfade(5) fogcolor(110,12,12) // the haze fades to red over 5 seconds skyfogcolor(110,12,12) // the horizon band too sun(255,80,40) // orange sun sky(40,220,60) // green light from above ground(30,10,10) // dark red bounce light lightning(255,0,0) // red lightning fogcolor(999,999,999) // any value above 255: back to the map's own colour
"Back to the map's own colour" means the colour from MED Map Colours if the map has one, otherwise the day/night colour.
Lightning has no "off"
lightning(999,999,999) does not hand lightning back. If you change the lightning tint and want the old one back, set the old colour yourself. The DLL keeps re-sending a changed lightning colour to late joiners until you do.
Firing colours from the server, any time
The server runs server.wac (and the map's own .wac) about once a second. A block that watches a global variable lets an admin tool or another script switch colours on demand, without a map change:
if eq(G248, 1) then colorfade(5) fogcolor(110,12,12) skyfogcolor(110,12,12) set(G248, 0) endif if eq(G248, 99) then fogcolor(999,999,999) skyfogcolor(999,999,999) set(G248, 0) endif
Setting G248 to 1 turns the haze red; 99 hands it back. Resetting the variable to 0 stops the block running again every second.
Late joiners
With the DLL, the server repeats every colour the script changed every 30 seconds, so a player who joins mid-match gets the current colours within half a minute. Players already in the game get the colour they already have, so nothing flickers. The repeat waits while a fade is running, so it never restarts one.
WAC files must have Windows line endings (CRLF). A .wac saved with Unix line endings (LF, what some editors use by default) compiles to nothing and gives no error. If a script seems to do nothing at all, check this first. More in WAC basics.