Brad G’s Wac Tutorial for JO:TR /JO:E

published online by Ziprock





Ah! So you want to learn WAC then. Then I presume you can use nile, and now you want to make your maps more flashy. Well the good news is, its pretty easy to learn. The only thing you want to keep in mind, is that wac files are very, very picky. So much as an extra fullstop or bracket , or extra space in the middle of a event will cause the event not to work. A common fault is forgetting to type endif at the end of a section of code.


As you know, there is an events tab in Nile. The events tab is perfect for all the basic things, like attaching AI to weapons / vehicles and so on, however its absoloutly shit when it comes to wanting to add text to your game , weather effects, and so on.


So then, if you want to learn how to do Wac using this tutorial , then your going to have to do it, the same way I do.






What is a wac file?


Well a wac file is what makes events happen



what are events?


hmm , your going to be a tough one to teach aren't you
an event is something what happens in the game.
for example an AI attaching to a gun, or an AI running along the ground, or creating atmospheric changes such as rain, thunder and lightning in your maps, or having text appear , or having something blow up automatically as you get close to it , or shooting a radio component to make a gate unlock .. the list goes on and on and on and on.......



where is the WAC file?


when you save your map in nile, it will automatically generate a WAC file , and save it in the same place as the NPJ file. you can open the wac file using notepad. ( if you have XP double click on the wac file , it will ask you what program to open it with , simply select notepad)

be careful when editing wac files, as so much as a full stop or a space , or a bracket in the wrong place , could cause all of your events not to work properly... but even in the worst case scenario , you would only have to remake your wac file again. it would never damage your map which you've spent hours upon hours on.



one other thing i must point out to you.


When you save your map in nile, it overwrites the wac file... if you have made any alterations to the wac file, the alterations will be lost! . Make sure you make a backup , or even better still , write your wac file in a notepad file and save it as a txt file .. when you have finished the map altogether , copy and paste the script in to the wac file and save it.
so then like to see a basic wac for an example?

if never() and ssndead(1234) then
removeSSN(4321) endif

now this is a very basic one to start with, I'll break it down for you.
Every event starts with an IF, , it has a THEN in the middle, and it will end with an ENDIF

what do they mean you may wonder....

well they mean pretty much the same as what the word does in english.

if never() ok now this means if this has never happened before ( try and use the never command often , as this stops alot of problems occurring. for instance if you just typed if chain(4) then text("GO GO GO") .. four seconds in to the game a message would come up on the screen saying GO GO GO .. and then it would come up four seconds later GO GO GO , and then four seconds later GO GO GO and it would never stop .... however if you had added if never() and chain(4) then text ... it would read the code as " if this has never happened before then display the text go go go .. if it has happened before , then do nothing. this would stop it repeating itself. )

ok so back on track, hopefully you now understand what never() means

if never() and ssndead(1234) THEN
now this means " if the object/person in the game which has the SSN number of 1234 has died or been blown up , THEN do this.... one way to think and try to understand it , is think of it as a trigger

if never() and ssndead(1234) then
removeSSN(4321) endif

now what this is saying is " if the object/person in the game which has the SSN number of 1234 has died or been blown up , THEN remove the object from the game which has the SSN number of 4321. and endif, simply means it is the end , of the if command. another way to look at it , IF marks the beginning of the event , ENDIF marks the end of the event

now every object you add to a map , gets its very own ID number known as an SSN number. you can find out what objects have what numbers, by selecting them in the objects pallet in nile ( the objects you have already added to your maps, not the objects you can add ) and scroll to the right , it will show you its ID number. if you want to work with it, then make a note of it in notepad.

now with all of the above in mind....




Getting started


First of all, use the events tab in nile to attach all AI to the relevant weapon / vehicle.

How do I do this?

Okay il explain everything ( just means a lot more typing, sigh )

For example we will say you are trying to attach three AI to a Tank ( it can be any vehicle the principle is the same)

First of all, rename the tank, and rename the AI. If the tank is outside the gate of the first base you attack , then call it

Tankfirstbase


And name the AI

Tankfirstbasegunner1

Tankfirstbasegunner2

Tankfirstbasegunner3


If there was two tanks at the beginning , call the second tank

Tank2firstbase


And name the AI

Tank2firstbasegunner1

Tank2firstbasegunner2

Tank2firstbasegunner3


So now you can differentiate as to who should be attaching to who.


Now click on the events tab , and click

New folder

New event

And select IF condition from the window which is displayed.

The events palette will now change. As you can see there are two fields at the bottom, one is called IF , and the other is called THEN


Now to explain these to you,


IF means a Trigger “ if this happens….”

And THEN is the action “ Then do this!”


As we are only attaching an AI to a vehicle , we do not need to worry about using the IF half, we will get to that later on. For now , just click on “new action”

Now the window which opens, has a category field at the top. Currently it is on General. Change this to Units.

Select from the list “unit move to unit”

Now you will see that you can enter two things at the bottom of the window.

In the first box click on the drop down arrow and select “tankfirstbasegunner1”

And in the next box down, select “tankfirstbase”

Now this is important that you select the AI first, as the first selection is what determines what moves to what. Afterall a tank cant walk , but the crew can , so naturally you will select the crew to move to the tank.


Now you will be shown the event you just created click on “new action” , and again , select units at the top , then unit move to unit , then select the second gunner to move to the tank, and so on , and so forth until the tank has three people in it. ( remember not all vehicles require three people, a SUV only requires two people to man the drivers seat and the 50 cal on top)


The code it adds to the WAC file will look like this


If never() then

Ssn2ssn(1111,1122)

Ssn2ssn(2222,1122)

Ssn2ssn(3333,1122)

endif


again, don’t worry what the above means, by the time you have read this tutorial you will be typing it by hand.


So then. Now you know how to attach the AI to vehicles and weapons. On you go, and attach them all.


Using the IF command

Now like I said earlier, the IF command is a trigger. For example IF bob is dead then make harry get in the 50 cal gun to protect the base


How we would do this, is as follows


Create a new event folder, and a new event , and select a conditional event.


Click on IF command

Now select units at the top.

Now select ssn dead

Now you will see an option box at the bottom , select the AI which you will be using as a trigger which you should have already renamed to make your life easier. Then click OK

Now select new action

And like before with the tank, select units at the top , unit move to unit, select the AI to move to the 50 cal , and select the 50 cal in the second box, ok? Easy so far isn’t it.






How to add text to an event.




Now this, cannot be done in nile, but this is how you can do it.


If it’s the case that you would like to have a message come up saying “Target at Alpha destroyed” when all the relevant things have been taken out, then create a new conditional event in nile, and in the IF box, use the units list and select ssn dead. Now select the first target at Alpha. Click ok . now I wouldn’t be surprised if there is more than one object which must be destroyed at alpha, so what you do now is click on “AND” which is at the top of the conditional event window. You will notice that the line displayed has gone red. The reason it is red, is because the its not complete. In this case its red because there is nothing following the AND , so its saying AND….. WHAT?! So what you now do , is click on new IF , and select the second object which should be destroyed. Then click on AND , and then select the third object. Once you have added all the objects which must be destroyed to the IF box, save the map, remembering where it saves to, and go to the location where it saved. You will see the npj file of your level , you will also see the wac file. Open the wac file using notepad, and look at the bottom you should see an event like this


If never() and ssndead(1234) and ssndead(2345) and ssndead(3456) and ssndead4567) then

Endif


As you can see there is nothing between the THEN , and the ENDIF

So now we are going to add the text command text(“…”)


If never() and ssndead(1234) and ssndead(2345) and ssndead(3456) and ssndead4567) then

Text(“ALL TARGETS DESTROYED AT ALPHA”)

Endif


Save the wac file, close it , test your map , and you will see that the text is displayed when all of the targets have been destroyed.





Adding a wav file to play when the text message appears



Now again this cannot be done in nile, but it can be added manually in the wac. The command is wave(”…wav” ,50)


So your script would now look like this


If never() and ssndead(1234) and ssndead(2345) and ssndead(3456) and ssndead(4567) then

Text(“ALL TARGETS DESTROYED AT ALPHA”)

Wave(“alarm1.wav” ,50)

Endif


Now a short sound will play as the text appears


Here is a list of some of the wav files

American Common Radio Calls
ampr127 - "I have bad guys in sight!"
ampr128 - "Enemy down!"
ampr129 - "That's a kill!"
ampr130 - "Got 'em!"
ampr131 - "Target neutralized!"
ampr132 - "Sniper on overwatch."
ampr136 - "Sniper here, I'm on the move."
ampr140 - "Enemy infantry spotted!"
ampr142 - "Enemy troops spotted!"
ampr144 - "Enemy armor spotted!"
ampr145 - "Enemy vehicles in sight!"
ampr156 - "Need a spotter!"
ampr160 - "Searching for air targets."
ampr164 - "Medic on the way"
ampr168 - "I can't reach you!"
ampr180 - "We're under attack!"
ampr181 - "We're under fire!"
ampr184 - "We're all clear."
ampr187 - "All clear."
ampr196 - "We're airborne."
ampr200 - "I got room on this bird, anyone need a ride?"
ampr204 - "We are on the water."
ampr208 - "Anybody need water transport?"
ampr212 - "We're rolling!"
ampr216 - "Anyone need a ride?"
ampr224 - "Approaching the LZ."
ampr240 - "We're rolling up to the drop off."
ampr244 - "Airborne gunner requesting target."
ampr248 - "Anybody need air support?"
ampr260 - "Gun on the water requesting targets."
ampr288 - "Area secure."
ampr372 - "All units, UNIFORM is a go; I say again, UNIFORM is go!"
ampr373 - "All elements, VICTOR is on; I say again, VICTOR is on!"
ampr374 - "All team elements, WHISKEY, WHISKEY, WHISKEY!"
ampr375 - "All squads, XRAY is authorized; I say again, XRAY is authorized!"
ampr376 - "All units, YANKEE is in effect; I say again, YANKEE is in effect!"
ampr377 - "All elements, ZULU! I say again, ZULU!"

American Voice Calls
ampv124 - "Hold your fire!"
ampv125 - "Cease fire!"
ampv126 - "Stop Shooting!"
ampv144 - "Laying down cover fire!"
ampv156 - "Spread out."
ampv160 - "Regroup on me!"
ampv168 - "Target aquired."
ampv184 - "Making my way to you, hold on!"
ampv208 - "Incoming!"
ampv260 - "Take evasive action!"
ampv264 - "Hold the chopper!"
ampv284 - "We've got company!"
ampv392 - "Blow the target!"
ampv396 - "Target blown."
Rebel Voice Calls
qmpv104 - "Hold this position!"
qmpv106 - "Hold your ground!"
qmpv107 - "Maintain this position!"
qmpv108 - "Cover me!"
qmpv109 - "Need cover fire!"
qmpv112 - "Fall back!"
qmpv114 - "Retreat!"
qmpv124 - "Hold your fire!"
qmpv125 - "Cease Fire!"
qmpv126 - "Stop shooting!"
qmpv133 - "You are giving up my position."
qmpv135 - "Do not draw attention to me!"
qmpv157 - "Spread out!"
qmpv159 - "Don't group together."
qmpv159 - "Don't bunch up!"
qmpv169 - "Target in my sights."
qmpv210 - "Enemy incoming!"
qmpv211 - "Watch out! We've got incoming!"
qmpv262 - "Don't get us killed!"
qmpv383 - "No one is taking this base!"
qmpv385 - "Let's take their base!"
qmpv460 - "Come on get it!"
qmpv462 - "Bring it on!"
qmpv468 - "Come on, get some!"
qmpv469 - "You want some of this? Huh?!"

Other Sounds
alarm1 - Small buzz, heard in several player-made COOP maps when Mission Objective is updated.
command1 - Small chirping noise, heard in default COOP maps when Mission Objective is updated or completed.
psp_win - Chirping noise made when a PSP has been captured by a friendly team.
psp_lost - Buzz made when a PSP has been lost to an enemy team.
psp_t_ot - Sound made when a enemy PSP has been taken, and friendly capture has started.
psp_t_t - Sound made when a a friendly team has started a neutral PSP capture.
lpdish1 - ambient sound made by electronic or communication equipment (needs to be looped or IF statement made true all the time to be constant)
lplight2 - ambient sound, electrical buzz (needs to be looped or IF statement made true all the time to be constant)

As posted on Novaworld by: SpectreM4A3

Chrius lew has also compiled a zip file you can download, which contains a list of all the wav files in the game. there are quite literally, thousands. You can find this zip file on dfbarracks.com in the downloads section



The NEVER command

What does this do? Well what it is saying , that if this has never happened before, then do this.

For example if you made a past event like explained in the next section, after 15 seconds it would display the text, then after another 15 seconds it would display the text again , and again , and again …. If you use the IF never it will only do it once. In effect it stops events from looping as it recognizes the fact that the event has happened before.



The Past command

The past command is how many seconds you would like to pass in to the game before the event takes place. For example


If never() and past(30) then

Text(“Designed by brad G”)

Endif


Now 30 seconds in to the game the message above will appear on the screen.



The Chain command

The chain command is similar to the past command , on the basis that it is a time delay. The difference being, chain is a delay of time starting from then the previous event became true. For example


If never() and ssndead(3454) then

Text(“Tank down!”)

Endif


If never() and chain(5) then

Removessn(3454)

Endif


Now as you can see here , there are two events. How do we know there are two events , because there are two endifs. Remember an endif is placed at the end of every if event.


Now what it is saying is , if the tank is dead, then display the text tank down! , the five seconds after the text has been displayed, remove the tank from the map to stop the players from using it and wiping out your whole map in it.





The ssnremove command


Pretty self explanatory ,although very useful. For instance if you wanted a gate to be unlocked ( ora section of fence removed) when you destroyed a radio component you would use this command. To be honest, you may as well do this using the events tab in nile.


Create a new event

A conditional event

In the IF box, select ssndead , and select the object to be destroyed to do what ever it is you want to be removed


In the Action box, select units,

Then ssnremove, the quite simply, select the object you want to be removed.


The event will look like this in the wac file


If never() and ssndead(1111) then

Removessn(2222)

Endif




Using the chain command to cause a chain reaction of explosions


Now what I mean by this is, if you have layed one of my maps “operation Bravo two Zero, you will notice in one part of the map, the really long bridge begins to blow up at one end, and then the next bit blows up , then the next bit blows up , gradually working its way towards you. This is done by using the Chain command to make a delay between the explosions.


For example.

Ssn 1234 = a guy to act as a trigger

Ssn 1111 = fuel barge 1

Ssn 2222 = fuel barge 2

Ssn 3333 = fuel barge 3

Ssn 4444 = fuel barge 4

Ssn 5555 = fuel barge 5


Place the fuel barges in a line, just underneath the surface level. May it be the ground or water if it under the bridge.


If never() and ssndead(1234) then

Text(“The enemy are advancing! Blow the bridge/tunnel”)

Endif

If never() and chain(5) then

Killssn(1111)

Endif

If never() and chain(2) then

Killssn(2222)

Endif

If never() and chain(2) then

Killssn(23333)

endif

If never() and chain(2) then

Killssn(4444)

endif

If never() and chain(2) then

Killssn(5555)

Endif


Now il break it down for you. If you kill the ssn number of 1234, the text message will appear “The enemy are advancing! Blow the bridge/tunnel”

After a five second delay the first fuel barge will blow up.

After a two second delay from the first blowing up, the second will blow

After a two second delay from the second blowing up , the third one will blow

After a two second delay from the third blowing up, the fourth one will blow,

After a two second delay from the fourth one blowing up, the fith one will blow


Of course you can have as many as you like, just extend the code.



Waveready command


This command will make a wave file play , immediately after a previous one has finished. A good example of this would be you hearing a voice shout out “MEDIC!” , then it would be followed with “Medic on the way!” in effect like they are talking to each other


This would look like this

If never() and ssndead(1234) then

Wave(“?” ,50)

Endif

If previous() and waveready() and never() then

Wave(“?” ,50)

Endif


Now after the first wave file has played , the second one will start.




Ssnlosssn command


Quite a handy command, it means “ if ssn sees ssn” . a good example of this, would be using the command to load in to a vehicle , if you wanted it to respawn when it was destroyed. In this instance , we will say the vehicle is a SUV and has the ssn number of 3333 , the driver has the ssn of 1111 and the gunner has the ssn of 2222


The event would look like this


If ssnlosssn(1111,3333,10) then

Ssn2ssn(1111,3333)

Ssn2ssn(2222,3333)

Endif

Now to break it down for you


If ssn1111 ( the driver ) sees ssn 3333 ( the SUV ) then

Driver get in the SUV

Gunner get in the SUV


Now note that I haven’t put never() in the command, reason being if you remember the definition of the never() , the reason I left it out, is because the AI will respawn and get in to the vehicle. If I had used if never , they would only do it once.


Another good example is if you want Friendly AI to get in to your vehicle as you drive towards them, simulating you picking them up then the WAC would look like this


If ssnlossn(1111,2222,40) then

Ssn2ssn(1111,2222)

Endif


Now what this is saying , if the friendly AI with the ssn number (1111) see’s your vehicle , and its within 40 feet of it, then attach to the vehicle. Only problem here , is if you get out the vehicle , he will move in to the drivers seat. More on how to get them to stay in their seat later on.



The ssnride command


A very good trigger. Commonly used on human players to make them/you trigger events. It uses the ssn number of an object you use.. I think this will be easier to explain , if I just give an example


If never() and ssnride(1234) then

Text(“GET THE HELL OUTTA THERE!”)

Endif


What just happened there then you may wonder?


Well the ssn 1234 is a jeep, which you cunningly positioned for the players to make their escape in. now when an SSN ( a real player has an ssn number too) gets in to the vehicle with the ssn of 1234 , then the text message will be displayed. Lol I can nearly hear all the cogs turning in your head with all the ideas which must have sprung in to your mind.



Adjusting Vehicle Speed


Now as you may have noticed, when you attach AI to a vehicle, and have the vehicle follow a WP list, the vehicle goes at max speed. Which looks a little silly when a BTR starts moving like it has a rocket stuck to it.

You can control the speed from which the vehicle travels at, in KPH


ssnpspd(1111,45) for patrol speed
ssncspd(1111,65) for combat speed


simply add these to your wac file as follows


if never() then

ssnpspd(1111,45)

ssncspd(1111,65)

endif


which means the vehicle with the ssn number of 1111 will now travel at 45kph, when the vehicle is attacked, or begins to attack, it will travel at 65kph



Making the enemy chase after you when they see you


Ok now this is easier to do in niles little helper. But never the less, il show you how its done by manually creating the wac event.


If an AI has the ssn number of 111, then you would write the wac like this


If never() then

SSNmax(1111,100)

SSNmin(1111,3)

SSNatt(1111,100)

endif


to do this using nile's little helper


open your map in niles little helper, and at the top , click on Briefing and wac create.

then select
"create wac scripts" from the list

now you will be greeted with a list of all of the AI in your map. at the bottom you will notice some buttpons you can click on ,

click on "select all"

now you will see
max min att which are faded out in grey. place a tick next to them to make them active ( they will now appear black )

now set the values.

max ... is the maximum distance from what they can see.

min , is the minimum distance they will get to you. so if you set this at 3 , they would stop advancing on you when they were three meters away.

att , is the distance which they would start to attack you. so for example , if you put

max 200
min 3
att 100

then the AI would see you from 200 meters away , he would start to run towards you , but wouldnt shoot at you until he is 100 meters away, and woujld stop approaching you if he managed to get to 3 meters of you.

so now you have set these settings, click on "set all selected"
you will notice that the values you set have appeared in the columns down the middle of the AI list.


now click on "generate wac script"


a pop up window shall now be displayed saying Success the file has been generated .
it will have genrated the file to the same place where your NPJ file resides... so open thne folder where your NPJ file is, and you shall find a new file , called yourmapname.WA_
thats not a typing error. like .wac .. but .wa_

open the .wa_ file in notepad, and copy and paste its contents in to the WAC file of your map.
congrats, your AI will now chase after you



what do the above mean?

SSNmax(1111,100) is pretty much how far they can see, and at what distance a way you will be before they act
SSNmin(1111,3)/ this is the distance which they will stop advancing to you. In this case it will be 3 meters
SSNatt(1111,100) this is the distance you set which tells the AI at what distance to stat attacking. In this case it is the same as the SSNmax , so the AI will begin to shoot at you at 100 meters, and will also begin to advance at you.


Now the thing is, if you were to do this by hand, you would have to type this for every single AI in the level. However if you used niles little helper, you would be able to do all of the AI you wanted at the same time… a lot.. lot .. quicker.





Variables



Variables (VAR/VARS) are just memory storage locations which can be changed by the user/mapper.

Remember it’s only going to store a numerical value for you.
You can make this value go up or down, by one integer (i.e. whole number) at a time (using ‘inc’ and ‘dec’) or go up and down in bigger steps using ‘add’ and ‘sub’.


The 'V' just lets us and the game know its a variable.

You can use V0 to V511(see update) as game variables, which cleared (zeroed) at start of mission

UPDATE: My tests have shown that variables are NOT always cleared at the start of a mission and for reliability they should be initialised (see note at bottom).
Also, testing (by 'Fence Post') has shown that there is a chance that there is in fact only 256 VARS available (i.e. 0 - 255).

You could for example use a VAR to store the number of deaths of an AI. A typical and common use is the counting of civilian AI, so that in a mission the JO team can loose by killing too many of them.



Example:

IF NEVER() THEN // Initialise variable, usually to
zero (but not necessarily).
set(V10,
0) // Called var 10 just because I wanted to.
ENDIF

IF ssndead(#1) AND NEVER() THEN
inc(V10) // if this civilian gets killed add 1 to v10
ENDIF

IF ssndead(#2) AND NEVER() THEN
inc(V10)
ENDIF

IF ssndead(#3) AND NEVER() THEN
inc(V10)
ENDIF

//Put as many ssn's as you like here, (in the above format)
//Then add the compare code (below) to check the VAR.

If
gt(V10, 4) AND NEVER() THEN // If greater than 4 civilians dead the rebels win.
Win(2)
ENDIF

Basically each time an AI is killed, then V10 gets incremented, untill it gets to 4, then................in this case somebody (the rebels) win.
It doesn't matter which ones are killed or in what order, all that matters is that if you have say ten AI civies and any four get killed the variable V10 will equal 4 and activate the win(2) action.

For another explanation of this senario see Bad Feelings post which is also in the Variables forum.


Initialising VARS:
To be absolutely sure your variable starts at the value you want it to, include this code, using the VAR# to the # of your choice.

IF NEVER() THEN
set(V#, #)
ENDIF

Variables are an extremely powerful tool and their uses are probably only limited by your imagination.



Whole variables chapter written by gettinbetter


Using variables as a trigger

if eq(v9, 1) and never() then // IF V9=1
SSNtoWP(66721,7) // Send AI Chopper to Waypoint List 7
This way you can have it loaded. running and waiting for takeoff
endif


You can then setup anything as your actual trigger for the chopper, EXAMPLE
If we kill an AI

if Never() and ssndead(1149) then // IF Never Before and Object # is dead
set(v9, 1) // Set V9=1 And POW Your chopper is airborn!
endif


Or you could even send another AI to check on his fallen buddie with

if eq(v9, 1) and never() then // IF V9=1
SSN2SSN(1150,1149) // Send AI 1150 to check on 1149
endif


Written by Godfather


Using variables to create a lose


Scenario:
We have a map with 6 civilians in it. If three or more civilians are killed, we want the map to end with a loose condition -- Rebels win.

Solution:
Let's make a variable that can count how many civilians are killed. We'll name that variable "v25".

At the beginning of our map, we set our variable to hold the value of "nothing":
If never() then
Set(v25,0)
endif


We need to increase v25's value if one of the civilians are killed. Therefore, for each of our civilians we set up a script like this:
If never() and ssndead(1001) then //civilian with ssn1001 has been killed
Inc(v25) //increase v25
endif


Now, when you have done that with all your civilian ssns, it's time to set up the trigger that tells if to many of them have been shot:
If never() and gt(v25,2) then //v25 is greater than 2
text("Too many civilian casualties! Be more careful next time...")
endif


If never() and chain(6) then // six seconds later
win(2) // rebel team wins
endif


to create a win


Scenario:
We have a map with 6 SAM sites in it.


Solution:
Let's make a variable that can count how many SAMS are Destroyed. We'll name that variable "V1".

At the beginning of our map, we set our variable to hold the value of "nothing":
If never() then
Set(V1,0)
endif


We need to increase V1's value if one of the Sams are destroyed. Therefore, for each of our civilians we set up a script like this:
If never() and ssndead(1001) then //SAM with ssn1001 has been destroyed
Inc(V1)
endif


Now, when you have done that with all your SAM's ssns, it's time to set up the trigger that tells if to many of them have been shot:
If never() and eq(V1,how many sams in your map) then

text("All sams destroyed")
endif


if chain(5) then

win(1)

endif

Further Variable Examples.

so now you should understand that a variable stores a numerical value. but what else wac it be used for other than counting civilians deaths, or sams being destroyed?


well as all it does is hold a numerical value, you will have to think in other ways which this could be of an advantage. so how about i give you an example.


lets say i have a doorway which is blocked. next to the door is a computer terminal with a chair.

when you sit down at the computer it would say "To enter Confidential logs please enter password "


then a few seconds later it would say " to enter access control please enter password"


if you havent found the password by now then nothing will happen.


but if the player has already found the password, then the sequence will continue allowing you in to the comnputer system to unlock the door. sounds pretty complexed huh?


so then this is what i want you to do.


take a part of your map, and block off a doorway or a point where the players will advance through.


place a computer and chair next to the doorway.


now somewhere else, place a file cabinet, and sink it under the ground so that only the top draw is showing. now we will say this is a safe. looks pretty similar. now place a chainlink walkway on the ground under the safe, which will act like a trigger when a player stands on it.


now place a commander somewhere


so then, the computer will unlock the door, but you cant do this until you have the password to gain access to the computer which is kept in the safe, but you cant open the safe until you have retrieved the combination code which is held on the computer. but you cant get the safes combination from the computer until you have the password to get in to this part of the computer.. keeping up with me? good!


so lets get wac'ing!


start with each bit at a time. so first of all, lets start with the safe


if never() and ssnride(XXXX) then // the player stands on the walkway on the ground under the safe

text(" you need the combination for the safe")

text("Intel reports the combination is stored on a computer")

wave("command1.wav" ,50)

endif


now lets think about the above bit of script. when a player stands on the trigger that message will be displayed. which is good.... if they dont have the combination... but what if they do have it? it wouldnt make sense to get that message if they already found the combination. so we need to add a NOT to it.


if never() and ssnride(XXXX) and not gt(V2,0) then

text(" you need the combination for the safe")

text("Intel reports the combination is stored on a computer")

wave("command1.wav" ,50)

endif


so now it will display the message, providing V1 has not increased ..


so now lets work on the computer a little


if never() and ssnride(XXXX) and not gt(V2,0) then

text(" you need the combination for the safe")

text("Intel reports the combination is stored on a computer")

wave("command1.wav" ,50)

endif


if never() and ssnride(XXXX) then //sits on chair

text("Entering system..........")

endif


if never() and chain(5) then

text("To enter confidential log please enter password")

endif


if never() and chain(5) then

text("to enter Access control please enter password")

endif


so the above is the bare script. you sit on the chair, and a simple few text messages are displayed. so again get your thinking cap on. to enter the confidential log we need a password. lets say the password is in the pocket of the commander.


if never() and ssnride(XXXX) and not gt(V2,0) then

text(" you need the combination for the safe")

text("Intel reports the combination is stored on a computer")

wave("command1.wav" ,50)

endif


if never() and ssnride(XXXX) then //sits on chair

text("Entering system..........")

endif


if never() and chain(5) then

text("To enter confidential log please enter password")

endif


if never() and chain(5) then

text("to enter Access control please enter password")

endif


if never() and ssndead(XXXX) then // the commander is dead

inc(V1)

text("You have found a Confidential Log password in his pocket *escalation*")

endif


so lets modify the computer script to acknowledge the fact he is dead


if never() and ssnride(XXXX) and not gt(V2,0) then

text(" you need the combination for the safe")

text("Intel reports the combination is stored on a computer")

wave("command1.wav" ,50)

endif


if never() and ssnride(XXXX) then //sits on chair

text("Entering system..........")

endif


if never() and chain(5) then

text("To enter confidential log please enter password")

endif


if never() and chain(5) then

text("to enter Access control please enter password")

endif


if never() and ssndead(XXXX) then // the commander is dead

inc(V1)

text("You have found a Confidential Log password in his pocket *escalation*")

endif


if never() and ssnride(XXXX) and eq(V1,1) then //sits on chair and password recovered

text("Entering system..........")

endif


if never() and chain(5) then

text("To enter confidential log please enter password")

endif


if never() and chain(5) then

text("E-s-c-a-l-a-t-i-o-n")

endif


if never() and chain(2) then

text("password accepted")

endif


if never() and chain(3) then

text("you have found a file containg a safe combination")

inc(V2) // so now its kept record that you have the safe combination

endif


so there we go... we have now written the script which will only allow you to get the safe combination from the computer providing you have got the password from the commander. so lets do the next bit.


if never() and ssnride(XXXX) and not gt(V2,0) then

text(" you need the combination for the safe")

text("Intel reports the combination is stored on a computer")

wave("command1.wav" ,50)

endif


if never() and ssnride(XXXX) then //sits on chair

text("Entering system..........")

endif


if never() and chain(5) then

text("To enter confidential log please enter password")

endif


if never() and chain(5) then

text("to enter Access control please enter password")

endif


if never() and ssndead(XXXX) then // the commander is dead

inc(V1)

text("You have found a Confidential Log password in his pocket *escalation*")

endif


if never() and ssnride(XXXX) and eq(V1,1) then //sits on chair and password recovered

text("Entering system..........")

endif


if never() and chain(5) then

text("To enter confidential log please enter password")

endif


if never() and chain(5) then

text("E-s-c-a-l-a-t-i-o-n")

endif


if never() and chain(2) then

text("password accepted")

endif


if never() and chain(3) then

text("you have found a file containing a safe combination")

inc(V2)

endif


if never() and ssnride(XXXX) and eq(V2,1) then

text("entering safe combination")

endif


if never() and chain(4) then

text("Safe open - found a computer password *foundstone*")

inc(V1)

endif


so now you have the password, again it has increased variable one. so back to the computer..


if never() and ssnride(XXXX) and not eq(V2,1) then

text(" you need the combination for the safe")

text("Intel reports the combination is stored on a computer")

wave("command1.wav" ,50)

endif


if never() and ssnride(XXXX) then //sits on chair

text("Entering system..........")

endif


if never() and chain(5) then

text("To enter confidential log please enter password")

endif


if never() and chain(5) then

text("to enter Access control please enter password")

endif


if never() and ssndead(XXXX) then // the commander is dead

inc(V1)

text("You have found a Confidential Log password in his pocket *escalation*")

endif


if never() and ssnride(XXXX) and eq(V1,1) then //sits on chair and password recovered

text("Entering system..........")

endif


if never() and chain(5) then

text("To enter confidential log please enter password")

endif


if never() and chain(5) then

text("E-s-c-a-l-a-t-i-o-n")

endif


if never() and chain(2) then

text("password accepted")

endif


if never() and chain(3) then

text("you have found a file containing a safe combination")

inc(V2)

endif


if never() and ssnride(XXXX) and eq(V2,1) then

text("entering safe combination")

endif


if never() and chain(4) then

text("Safe open - found a computer password *foundstone*")

inc(V1)

endif


if never() and ssnride(XXXX) and eq(V1,2) then

text("Entering system")

endif


if never() and chain(5) then

text("To enter confidential log please enter password")

endif


if never() and chain(5) then

text("to enter Access control please enter password")

endif


if never() and chain(4) then

text("f-o-u-n-d-s-t-o-n-e")

endif


if never( and chain(2) then

text("password accepted")

endif


if never() and chain(4) then

text("Door unlocked")

removessn(XXXX) // the object blocking the door

endif



so as you can see, variables can be used just like a switch. or boolean logic if you will.










Working with weather



You can create weather effects using wac, such as mist , rain , thunder lightning make it daytime or night time etc…


Here is a good example for you of a basic weather effect I found on the nova world forums

Explanation:
After 90 seconds has passed it will begin to rain and go overcast, both reaching full strength 20 seconds later. It also sets variable 1 to 1 with "set (v1,1)". After another 90 seconds (180 seconds into the round) the rain and overcast will die away to nothing over 20 seconds and the map will brighten up again. Also the variable 1 is now set to 2. Only if variable 1 is set to 1 will the last part of the script activate... causing thunder and lighting randomly once in every 30 times.

if never() and Past(90) then
rain(100,20)
overcast(100,20)

set (v1,1)
endif

if never() and Past(180) then
rain(0,20)
overcast(0,20)

set (V1,2)
endif


If eq(v1,1) and random(30) then
farflash
flash
endif


Here is a list of most of the other weather effect which you can use. The best way to learn is to experiment with them


fxrain(fx) rain down effect # somewhere near player
farflash produce a far away flash of lightning & thunder
flash produce a flash of lightning & thunder
fogdist(#) sets fogdist to # meters (same as set(fog,#)
fogtype(#) set fog type 0=fog, 1=haze, 2=haze wall, 3=fog wall
gain(#,#,#) sets the brightness of the whole scene
overcast(#,#) produce an overcast (strength, time it takes to get to that strength)
quake(#) earthquake for # 10th of a seconds
rain(#,#) produce rain (ammount of rain, time it takes to get to that ammount) (Don't use FXRAIN)
skyspeed(#) set the sky speed to #
tod(#:#) set the time of day to #:# eg: tod(12:00)
wind (#,#) produce wind sounds etc (strength, time it takes to get to that strength)

snow(#,#) strength , time it takes to reach max strength



Breathe time.


so how about increasing the time the players can breathe underwater... may be of use to you if you had a tunnel sectyion which was underwater you wanted the players to swim through in order to get in to a base.


if never() then

breathtime = 10

endif


now after 20 seconds you will drown. yes thats right.. 20. what ever you set the number to, they will be able to breathe for twice as long.



hidessn unhide.

since the latest update , you can now hide objects. please note this command does not remove the object from the game, it simply turns it invisible so even though you cant see it , you still cant walk through it.


if never() then

hidessn(XXXX)

endif


to make it visible again


if never() then

unhidessn(XXXX)

endif



Disablessn

you can also lock your vehicles!


if never() then

disablessn(XXXX)

endif


if XXXX being a vehicle the player will not be able to drive it anywhere. would be of use if you didnt want the players to get away using the vehicles before they had completed an objective.


to enable a vehicle again


if never() then

enablessn(xxxx)

endif


seatbelt

this command locks the players in to their seats. for example


if never() and ssnride(xxxx) then

set seatblet(1)

endif


so now when a player rides a vehicle with the ssn of xxxx , it will lock the seatbelt in place , preventing the player from exiting the vehicle.


to turn off the seatbelt,


if never() then

set seatbelt(0)

endif


this does not just work on vehicles , it also works on chairs. and pssoibly anything else you attach to.





Time of day


Events can also be triggered by the time of day.


if never() and eq(CurTOD,732) then

text("event triggered")

endif


so now at 7:32 the message " event triggered " would be displayed


list of all wac commands for reference


// WAC Quick Reference Help File

// WAC Flow Control (basic statements)
// IF triggers THEN actions END
// IF [ifname] triggers THEN actions END (optional named if)
// IF triggers THEN actions ELSE actions END
// IF triggers THEN actions ELSEIF triggers THEN actions END
// PLOOP actions(player) END
// GLOOP group actions(item) END
// DOSEQ actions NEXT actions [NEXT actions..] END
// DORND actions NEXT actions [NEXT actions..] END
// IF triggers ENTER actions END (triggers on first true)
// IF triggers LEAVE actions END (triggers after last true)

// WAC Compiler Commands
// VAR variablename (declares a number variable, shows up on debug screen)
// CHEAT cheatname (declares a server cheat variable, shows up on debug screen)
// RUN filename (this includes the text from a file, good from command line)

// WAC Logic and Math (tests for inside IF statement)
// Arithmatics ()+-*/^
// Booleans AND OR NOT < > <= >= == !=
// Example: IF V1<12 THEN
// Example: IF V1<12 AND V2<12 THEN
// Note: this compiles to IF (V1<12) AND (V2<12) THEN

// WAC Assignment Var = Value
// Example: V1 = 12
// Example: V2 = V2+V3*4
// Note: This compiles to V2+(V3*4)

// WAC Triggers (Things to do after IF statement)

// elapse (seconds)
// never ()
// previous ()
// chain (seconds)
// past (seconds)
// before (seconds)
// ontick (seconds)
// groupdead (number)
// groupalive (number)
// dooropen (number)
// SSNcritical (ssn)
// SSNexists (ssn)
// SSNdead (ssn)
// SSNalive (ssn)
// SSNwounded (ssn)
// SSNride (ssn)
// SSNonSSN (ssn, ssn)
// SSNnearSSN (ssn, ssn, distance)
// SSNlosSSN (ssn, ssn, distance)
// SSNseesSSN (ssn, ssn, distance)
// SSNarea (ssn, area)
// SSNarea3D (ssn, area)
// SSNloc (ssn, number)
// SSNLeadSSN2SSN (ssn, ssn, ssn, distance)

// WAC Actions (Things to do after THEN/ENTER/LEAVE statement)

// reset (ifname)
// Gkill (group)
// Gremove (group)
// Gsetaccuracy (number, number, number)
// GtoWP (number, wplist)
// kill (number)
// remove (number)
// teleport (number, target)
// GroupMin (number, distance)
// GroupMax (number, distance)
// GroupAtt (number, distance)
// GroupSpawn (number, number)
// GroupHP (number, number)
// opendoors (number)
// closedoors (number)
// text (text)
// wave (filename)
// hideSSN (ssn)
// unhideSSN (ssn)
// disableSSN (ssn)
// enableSSN (ssn)
// holdSSN (ssn)
// unholdSSN (ssn)
// setaccuracy (ssn, number, number)
// SSNtoWP (ssn, wplist)
// killSSN (ssn)
// removeSSN (ssn)
// teleSSN (ssn, target)
// SSNwave (ssn, filename, distance)
// SSNradio (ssn, filename)
// SS2SSN (soundset, ssn)
// SSNanim (ssn, anim)
// SSNMin (ssn, distance)
// SSNMax (ssn, distance)
// SSNAtt (ssn, distance)
// SSNSpawn (ssn, number)
// SSNHP (ssn, number)
// SSNADDHP (ssn, number)
// ssn2ssn (ssn, ssn)
// ssnrelease (ssn)
// ssnface (ssn, face)
// ssnturn (ssn, heading)
// ssnguard (ssn, number)
// ssnname (ssn, texttoken)
// ssnpspd (ssn, number)
// ssncspd (ssn, number)
// ssnuse (ssn)
// set (variable, value)
// add (variable, value)
// sub (variable, value)
// inc (variable)
// dec (variable)
// store (variable)
// load (value)
// TOD (hour)
// targetfx (target)
// ammo2tgt (ammo, target)
// fx2tgt (fx, target)
// ammoarea (ammo, area)
// sound2tgt (soundset, target)
// flash ()
// farflash ()
// quake (number)
// win (number)
// lose (number)
// music (number)
// skyspeed (number)
// skyheight (number)
// fogtype (number)
// fogdist (distance)
// movefog (distance, seconds)
// rain (number, seconds)
// snow (number, seconds)
// overcast (number, seconds)
// Help ()
// text# (text, number)
// consol (text)
// consol# (text, number)

// WAC Debug Commands (This also contains old stuff)

// sound (soundset, distance, heading)
// forceanim (anim)
// tele (ssn)
// fall ()
// fov (number)
// squadevent (number)
// random (number)
// outside ()
// location (number)
// area (area)
// area3D (area)
// waveready ()
// weaponfired (number)
// event (number)
// meride (ssn)
// meattached (ssn)
// medrive (ssn)
// meongun (ssn)
// ammorain (ammo)
// fxrain (fx)
// lightning (red, green, blue)
// face (face)
// anim (anim)
// sunfade (number, seconds)
// gain (red, green, blue)
// squadclear ()
// blockfire (number, number)
// colorfade (number)
// sun (red, green, blue)
// sky (red, green, blue)
// ground (red, green, blue)
// floor (red, green, blue)
// ceiling (red, green, blue)
// cloud (red, green, blue)
// fogcolor (red, green, blue)
// fog (red, green, blue)
// skyfogcolor (red, green, blue)
// skyfog (red, green, blue)
// crash (red, green, blue, green)
// eq (number, number)
// ne (number, number)
// lt (number, number)
// gt (number, number)
// le (number, number)
// ge (number, number)
// true (number)
// false (number)






Setting up PSP's


now okay.. i know this has nothing to do with the wac file, but i get asked this quite often. why dont my psp's show up on the map , or how can i make them so you cant capture the second one until you have taken the first? and how do you have an arrow like a waypoint showing you where the next psp is?


place the first psp in your base where you start. then place the rest through your map in the order how you would like the players to take them.


open the properties of the psp in your starting point.


you will notice there are some attributes here you can change , such as the radius and the LFP, and TEAM


change the LFP to 1

change the TEAM to 1

change the RADIUS to 9


now the next psp away ( the one you want the player to take first )


change the LFP to 2

leave the team on 0

change the radius to 9


now the next psp away ( the one you want the players to capture after the last one )


change the LFP to 3

leave the team on 0

change the radius to 9


carry on doing this until you run out of psp's.