Joined: Sat Apr 30 2005 Location: Blackpool - uk Posts: 64
all a variable does, is store a numerical value. thats it.
basically it does maths, may it be addition , subtraction, and so on.
how does it work?
the first thing you would do is set the variable to 0
so then , in your wac file
if never() then set(V1,0) endif
which means V1 now equals 0.
now lets say you have four commanding officers in your map, and you would like the messages displayed as they are shot
shoot one ( 3 commanding officers to find ) you shoot the next ( two commanding officers to go ) the next one ( one more to find ) the last one ( thats all of them )
the thing is , you wont be able to predict which order they get shot, so if the player shoots the last one , the message would say ( thats all of them ) not good as there are three more to kill. this is when you would use variables for example.
if never() then set(V1,0) endif
if never() and ssndead(1111) then inc(V1) endif
now this means that when ssn 1111 is dead, then INCrease V1 by one.
so if theres four people, do it for four.
if never() then set(V1,0) endif
if never() and ssndead(1111) then inc(V1) endif
if never() and ssndead(2222) then inc(V1) endif
if never() and ssndead(3333) then inc(V1) endif
if never() and ssndead(4444) then inc(V1) endif
so now when you have shot all four people in what ever order, V1 will equal 4. got it?
so now for the text messages.
if never() and eq(V1,1) then text("3 more commanding officers to find") endif
which says if V1 EQuals 1 ( one has been shot ) then display the above text on the screen.
so now do it for all four
if never() and eq(V1,1) then text("3 more commanding officers to find") endif
if never() and eq(V1,2) then text("2 more commanding officers to find") endif
if never() and eq(V1,3) then text("1 more commanding officers to find") endif
if never() and eq(V1,4) then text("All commanding officers eliminated") endif
you see? as you killed one ,it added one, as the value of V1 equal'ed 1 , 2 , 3 or 4 it displayed he relevant text message.
so the whole script should look like this
if never() then set(V1,0) endif
if never() and ssndead(1111) then inc(V1) endif
if never() and ssndead(2222) then inc(V1) endif
if never() and ssndead(3333) then inc(V1) endif
if never() and ssndead(4444) then inc(V1) endif
if never() and eq(V1,1) then text("3 more commanding officers to find") endif
if never() and eq(V1,2) then text("2 more commanding officers to find") endif
if never() and eq(V1,3) then text("1 more commanding officers to find") endif
if never() and eq(V1,4) then text("All commanding officers eliminated") endif