10/14/2026 [01:10:42] GMT Home .:. Logout
Forums
Hardmaps.com :: Forums :: Map Making Forum :: Joint Operations
 
<< Previous thread | Next thread >>
WAK commands
Moderators: Hardmaps Administrator, *HmS*Wedge, *HmS*grunt, *HmS*Trevor, *HmS*LongBow
Author Post
*HmS*Trevor
Wed Jun 28 2006

Registered Member #35
Joined: Tue Dec 30 2003
Location: Lincolnshire England
Posts: 2080
Some wac commands

//Stop the Spawning!! GroupSpawn(group, spawn count)
if area(6) and never then // if player in area 6
groupSpawn(23, 0) // set group 23 to stop spawning
groupSpawn(40, 0) // set group 40 to stop spawning
groupSpawn(19, 0) etc.
groupSpawn(22, 0)
groupSpawn(21, 0)
groupSpawn(20, 0)
groupSpawn(30, 0)
groupSpawn(29, 0)
groupSpawn(28, 0)
endif

If true(bluekills) then
Lose (1)
Else if true(greenkills) then
Lose (0)
endif


maddoginc
July 4th, 2005, 03:25 PM
WAC Scripting and Commands
==========================

Brief
This has been compiled from what I have learned through my own maps and info gathered from various .wac files located in JO's localres.pff file and .wac's distributed with other JO custom maps. It also contains info gathered from the Novaworld NILE forums, examples used were originally posted by other Novaworld members.

It has been slightly modified to make it a bit more simpler to understand and to add a couple of the new commands now available like "rain" and "overcast". As time goes by I will continue to add anything I find out that works and remove those that do not. If you know for sure that something is missing or doesn't work, please let me know. Thx

Notes:-
GLOBAL WAC file is the "GAME.WAC" (This WAC file is executed by the game first.)
MISSION WAC file is "missionname.WAC" (This WAC file is executed by the game secondly, after the game.wac).
WAC files are executed every second.
Nile will overwrite the WAC file everytime you save your map. If you have manually edited the WAC file then it is HIGHLY RECOMMENDED you always backup your wac prior to more editing in NILE.

---------------------------------------

Syntax
------------
The order of operations in WAC scripting is left to right.
Any lines preceded with a semicolon or text after two forward slashes is considered as a comment. Examples:

; this is a comment about this script

if Past(60) then //This is the events name
(usually defaults to //New Event

The syntax should look something like this: - (parens, line returns and tabbing are all optional)

if trigger1(params) and trigger2(params) then //Event Name or Comment
event1(params)
event2(params)
endif

Example 1.)
Door triggered by area trigger.
If I want to open doors in group 12 the first time I enter area 1501 then I use

if location(1501) and never() then
opendoors(12)
endif

Example 2.)
Time lapsed rain and random thunder and lightning.
(Originally posted by Sal UK and modified by Kip Kilagan -PR-)

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

Example 3.)
Co-op win/lose condition after killing of a certain AI or objects. Remember many things can trigger a win condition not just the death of an object or AI.
If SSN 10001 is dead and SSN 10002 then Win1 = JO wins otherwise if AI 10003 dies then WIn2 = Rebels win would look like this:

if ssndead(10001) and ssndead(10002) and never() then
win(1)
else
if ssndead(10003) and never() then
win(2)
endif
endif
---------------------------------------

WAC Language Commands
======================
Nestable flow control
IF
THEN
ELSE
ENDIF

Boolean logic
AND
OR
XOR

Function modifier
NOT

Note: At this moment in time NILE doesn't like it if you use nested events, it would apear that you need to use seperate events for most things to work.

You can use the following to randomize between nested action in a conditional IF event.
dornd = do the following nested action randomly
doseq = do the following nested actions sequentially
next = used between the actions
enddo = used to close the do statement, comes just before the last endif of the event.

Example:

If elapse(120) and random(5) then
dornd
rain(30, 30) // Light Rain
set(v1, 1)
next
rain(100, 30) // Hard Rain
set(v1, 2)
next
rain(60, 30) // Medium Rain
set(v1, 3)
next
rain(0, 30) // No Rain
set(v1, 4)
enddo
endif
-------------------------------------------------------------------------

VARIABLES & IMMEDIATES
--------------------------------------------
Note:- A variable can always be used as an immediate

"STRING" immediate string value
# immediate decimal number
v# v0 to v511 these are game variables you can set or have set, these are cleared at start of each mission
G# G0 to vG11 these are global variables, these are not cleared during link
M# Music Script Variable

anim_move immediate equate from ADM file
ammo_name immediate ammo name (ex. ammo2tgt ammo_rocket 1)
fx_fxname immediate effect name (ex. fxrain fx_effect_lightning)
effect_name immediate effect name (ex. fxrain effect_lightning)
health player's health/hp value
mana player's mana
neartype the type of the nearest enemy (from items.def dialog)
neardist the distance to the nearest organic
nearmove the anim move of the nearest organic (setable)
nearid the unique dcb/id of the nearest organic
neartid the id of the organic's target or 0 if no target
nearblind
nearflying
nearguard
nearSSN
nearWP
nearGroup
nearHP
result current return/accumulator value (mostly for debug)
SS_SoundSet immediate soundset name
sSoundSet immediate soundset name (alternate syntax)
ticks number of seconds into game
wind used by SWING, FLICKER, and particle wind2

VARIABLE COMPARE
----------------------------------

eq(#,#) true if #==#
ne(#,#) true if #!=#
lt(#,#) true if #<#
gt(#,#) true if #>#
le(#,#) true if #<=#
ge(#,#) true if #>=#
true(#) true if #!=0
false(#) true if #==0


VARIABLE MODIFY
----------------------------------
Note: The "v" is followed by the number you want as the variable (0 to 511). Ensure variables don't clash with each other.
Also when incrementing variables remember to set the variable to a value prior to the first increment.


set (v,#) set variable # to #
add (v,#) add # to variable #
sub (v,#) subtract # from variable #, clamp at 0
inc (v) add 1 to var
dec (v) subtract 1 from var, clamp at 0
---------------------------------------------------------------------------

TRIGGERS
----------------------------------
Note:- # param can be number or variable.

chain(#) true if previous IF statement has fired # ammount of seconds ago
dooropen(#) true if group # has door open
elapse(#) true if # seconds have past since last activated
event(#) true if event no. # has ? (fired?)
groupdead(#) true if entire group is dead
groupalive(#) true if anyone in group is alive
link(#,#) true if event # fired # seconds ago, link(1,10) is same as chain(10)
location(#) true if you are at that location
meride(#) true if you are riding SSN # (Only works as a trigger for the host of the game)
never() true if event has never fired
outside() true if you are not in a blink box
past(#) true if past # seconds into game
pre_mission() true before map starts,this is added when u tick the Before Mission box in NILE
previous() true if previous event has fired?
random(#) randomly true 1 in # times
ssnalive(#) true if ssn is alive
ssnnarea3D(#,#) true if SSN is within # distance of what? Heh
ssndead(#) true if ssn is dead
ssnloc(#,#) true if vehical or person is in location
ssnnearssn(#,#,#) true if SSN is near SSN within # distance
ssnride(#) true if organic is standing on SSN
tod(#) true if time of day equals # (000 to 2359)
true(#kills) true if # team is all dead, use blue = JO, green = Neutral or red = Rebels ( ie: true(bluekills) )
waveready() true if no talking going on
---------------------------------------------------------------------------

EVENTS
----------------------------------
Note:- # param can be number or variable

CO-OP Win/Lose Conditions:
win(#) # is set to 0,1 or 2 these are draw,JO win and Rebels win respectively.
lose(#) gives the opposite result as win

Weather/Enviroment Events:
ammorain(ammo) rain down ammo # near player (only host sees/hears the fx, but clients still lose health/die
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 ect (strength, time it takes to get to that strength)

Text Output Events:
consol("text") output text to consol - left side
consol#("text",#) output text to consol w/# - left side
report("text") pop-up debug report window
report#("text",#) pop-up debug report window with number
text("text") output text to chat - left side
text#("text",#) output text to chat w/# - right side

Various Events:
ammo2tgt(ammo,tgt) create ammo # at target # (ex. ammo2tgt ammo_rocket 1)
closedoors(group) close doors in group #
fx2tgt(fx,tgt) create fx # at target # (ex. fx2tgt effect_lightning 1)
forceanim(anim) forces all organics into anim slot (debug only)
GroupMax(group, maxengage) set max engage distance
GroupMin(group, minengage) set min engage distance
GroupAtt(group, maxattack) set max engage distance
GtoWP(group, wp) redirect Group to WP list
kill(grp) kill group #
killSSN(ssn) kill SSN #
nearwave("wave.wav", dist) plays wave file from the mouth of the nearest enemy with max dist to be heard
nearanim(anim_move) sets the nearest enemy to ADM move slot
opendoors(group) open doors in group #
remove(grp) remove group # without a trace
removeSSN(ssn) remove SSN # without a trace
sound(sSSNAME, dist, head) plays soundset at distance(meters) and heading(angle)
sound2tgt(ss,tgt) create ssoundset # at target # (ex. sound2tgt sSoundSet 1)
ssn_isgreen(#) set SSN # to alert status green
ssn_isyellow(#) set SSN # to alert status yellow
ssn_isred(#) set SSN # to alert status red
SSNanim(ssn, anim_move) sets the ssn to ADM move slot
SSNatt(ssn, maxattack) set max engage distance
SSNmax(ssn, maxengage) set max engage distance
SSNmin(ssn, minengage) set min engage distance
SSNspawn(#,#) set SSN # to spawn # ammount of times, 0=do not respawn
SSNtoWP(ssn, wp) redirect SSN to WP list
SSNwave(ssn, "wave.wav", dist) plays wave file from the mouth of the ssn with max dist to be heard
ssncspd(ssn,speed) set ssn to combat speed of # kph (seems to only work for vehicles not AI themselves)
ssnpspd(ssn,speed) set ssn to patrol speed of # kph (seems to only work for vehicles not AI themselves)
targetfx(tgt) create med particle fx at target #
teleport(grp,tgt) teleport group # to target #
telessn(ssn, tgt) teleport SSN # to target #
tod(#) set time of day to # (000 to 2359)
wave("wav file path",#) play wav file at # volume (0 - 100)


The following was extracted from the game:

;wac file - nestable IF/THEN/ELSE/ENDIF boolean logic
;
;WAC post directory w:\\vp\\program\\wac - commands listed in GAME.WAC
;WAC debug screen under shift-F12, numlock arrows to select and scroll
;
;GLOBAL WAC is GAME.WAC (executed first)
;
;MISSION WAC is misname.WAC (executed second)
;
;Left to Right order of operations
;
;---WAC LANGUAGE COMMANDS
;nestable flow control
; IF THEN ELSE ENDIF
;boolean logic
; AND OR XOR
;function modifier
; NOT
;comments
; ; /
;
;Syntax - parens optional, line returns and tabbing optional
;
; if trigger1(params) and trigger2(params) then
; event1(params)
; event2(params)
; endif
;
;Example
;
; I want to open doors in group 12 the first time I enter area 1501
;
; if location(1501) and never() then
; opendoors(12)
; endif
;

;---VARIABLES & IMMEDIATES (a variable can always be used as an immediate)
;"STRING" immediate string value
;# immediate decimal number
;anim_move immediate equate from ADM file
;ammo_name immediate ammo name (ex. ammo2tgt ammo_rocket 1)
;fx_fxname immediate effect name (ex. fxrain fx_effect_lightning)
;effect_name immediate effect name (ex. fxrain effect_lightning)
;SS_SoundSet immediate soundset name
;sSoundSet immediate soundset name (alternate syntax)
;V# V0 to v511 game variables, cleared at start of mission
;G# G0 to vG11 global variables, not cleared during link
;M# Music Script Variable
;result current return/accumulator value (mostly for debug)
;ticks number of seconds into game
;wind used by SWING, FLICKER, and particle wind2
;health player's health/hp value
;mana player's mana
;neartype the type of the nearest enemy (from items.def dialog)
;neardist the distance to the nearest organic
;nearmove the anim move of the nearest organic (setable)
;nearid the unique dcb/id of the nearest organic
;neartid the id of the organic's target or 0 if no target
;nearblind
;nearflying
;nearguard
;nearSSN
;nearWP
;nearGroup
;nearHP

;---TRIGGERS (# param can be number or variable)
;random(#) randomly true 1 in # times
;elapse(#) true if # seconds have past since last activated
;chain(#) true if previous IF fired # seconds ago
;link(#1,#2) true if IF #1 away from current IF fired #2 seconds ago
; link(-1,10) is same as chain(10)
;past(#) true if past # seconds into game
;never() true if event has never fired
;location(#) true if you are at that location
;outside() true if you are not in a blink box
;waveready() true if no talking going on
;groupdead(#) true if entire group is dead
;groupalive(#) true if anyone in group is alive
;ssndead(#) true if ssn is dead
;ssnalive(#) true if ssn is alive
;ssnride(#) true if organic is standing on SSN
;ssnloc(#,#) true if vehical or person is in location
;dooropen(#) true if group # has door open
;
;---VARIABLE COMPARE
;eq(#,#) true if #==#
;ne(#,#) true if #!=#
;lt(#,#) true if #<#
;gt(#,#) true if #>#
;le(#,#) true if #<=#
;ge(#,#) true if #>=#
;true(#) true if #!=0
;false(#) true if #==0
;
;---VARIABLE MODIFY
;set(var,#) set var to #
;add(var,#) add # to var
;sub(var,#) subtract # from var, clamp at 0
;inc(var) add 1 to var
;dec(var) subtract 1 from var, clamp at 0

;---EVENTS (# param can be number or variable)
;forceanim(anim) forces all organics into anim slot (debug only)
;report("text") pop-up debug report window
;report#("text",#) pop-up debug report window with number
;text("text") output text to chat - right side
;text#("text",#) output text to chat w/# - right side
;consol("text") output text to consol - left side
;consol#("text",#) output text to consol w/# - left side
;
;flash produce a flash of lightning & thunder
;farflash produce a far away flash of lightning & thunder
;quake(#) earthquake for # 10th of a seconds
;
;sun(#,#,#) sets sun rgb ENV override
;sky(#,#,#) sets sky rgb
;ground(#,#,#) sets ground rgb
;ceiling(#,#,#) sets ceiling rgb
;floor(#,#,#) sets floor rgb (inside ground)
;lightning(#,#,#) sets the color of the lightning
;cloud(#,#,#) sets the cloud color
;gain(#,#,#) sets the brightness of the whole scene
;
;fogcolor(#,#,#) set fogcolor to R,G,B, changes in 1 second
;fog(#,#,#) set fogcolor to R,G,B (same as fogcolor)
;fogtype(#) set fog type 0=fog, 1=haze, 2=haze wall, 3=fog wall
;fogdist(#) sets fogdist to # meters (same as set(fog,#)
;
;sound(sSSNAME, dist, head) plays soundset at distance(meters) and heading(bangle)
;
;nearwave("wave.wav", dist) plays wave file from the mouth of the nearest enemy with max dist to be heard
;nearanim(anim_move) sets the nearest enemy to ADM move slot
;SSNwave(ssn, "wave.wav", dist) plays wave file from the mouth of the ssn with max dist to be heard
;SSNanim(ssn, anim_move) sets the ssn to ADM move slot
;
;SSNmax(ssn, maxengage) set max engage
;SSNmin(ssn, minengage) set min engage
;SSNatt(ssn, maxattack) set max engage
;GroupMax(group, maxengage) set max engage
;GroupMin(group, minengage) set min engage
;GroupAtt(group, maxattack) set max engage
;remove(grp) remove group # without a trace
;kill(grp) kill group #
;removeSSN(ssn) remove SSN # without a trace
;killSSN(ssn) kill SSN #
;teleport(grp,tgt) teleport group # to target #
;telessn(ssn, tgt) teleport SSN # to target #
;targetfx(tgt) create med particle fx at target #
;sound2tgt(ss,tgt) create ssoundset # at target # (ex. sound2tgt sSoundSet 1)
;ammo2tgt(ammo,tgt) create ammo # at target # (ex. ammo2tgt ammo_rocket 1)
;fx2tgt(fx,tgt) create fx # at target # (ex. fx2tgt effect_lightning 1)
;opendoors(group) open doors in group #
;closedoors(group) close doors in group #
;SSNtoWP(ssn, wp) redirect SSN to WP list
;GtoWP(group, wp) redirect Group to WP list
;ammorain(ammo) rain down ammo # somewhere near player
;fxrain(fx) rain down effect # somewhere near player
;ssncspd(ssn,speed) set ssn to combat speed of #
;ssnpspd(ssn,speed) set ssn to patrol speed of #

;*********************************************************


//******ADJUST GROUP HPS***********/
//var v1 is for the enemies
//var v2 is for enemy dead count
if never() then
set(v3, 4)
endif
if not eq(v4, 1) then
inc(v3)
grouphp(v3, 100)
endif
if gt(v3, 52) and never then
set(v4, 1)
endif



[ Edited Mon Oct 09 2006 ]
Back to top
*HmS*Wedge
Wed Jun 28 2006
Captain Slow

Registered Member #3
Joined: Fri Dec 19 2003
Location: Scotland
Posts: 4651
Remember if your a decent map maker and not wanting to PI** OFF players DO NOT put the hit points of bots up........just a tip.
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.1027 sec, 0.0128 of that for queries.