10/13/2026 [22:45:09] GMT Home .:. Logout
Forums
Hardmaps.com :: Forums :: Map Making Forum :: Joint Operations
 
<< Previous thread | Next thread >>
Learning Variables
Moderators: Hardmaps Administrator, *HmS*Wedge, *HmS*grunt, *HmS*Trevor, *HmS*LongBow
Author Post
Brad.G
Tue Sep 13 2005
Registered Member #622
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

hope this has got your thinking cap on (29)
Back to top
Website
kiki diablo
Tue Sep 13 2005
Registered Member #116
Joined: Fri Feb 27 2004
Location: Leeuwarden - Holland - Europa
Posts: 752
he brad , just a question to you?

Are you the maker of THE FINAL AUSSALT?
Back to top
Website
Brad.G
Tue Sep 13 2005
Registered Member #622
Joined: Sat Apr 30 2005
Location: Blackpool - uk
Posts: 64
*cringe* .... lol the failed map.

yes ( hides ) was one of the first oop maps i chucked together... and i ran out of AI to use in it. bit of a failed project....
Back to top
Website
 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System
All trademarks are copyright their respective owners.
This site is best viewed using 1280-1024 screen resolution.
{THEMEDISCLAIMER}
Render time: 0.0561 sec, 0.0098 of that for queries.