Stuff in blue denotes information that has been updated.Stuff in green indicates stuff that will be used in the BWScript Emulator AI module for BWAPI, and that AI script writers should keep these in mind when writing scripts.

Header commands

farms_notimingBuild necessary farms only when it hits the maximum supply available.

farms_timingBuild necessary farms with a correct timing, so nothing is paused by a maximum supply limit hit.

start_areatownStarts the AI Script for area town management. Should only be used in campaign scripts, as it uses the trigger location as its bounds (or area).

start_campaignStarts the AI Script for Campaign. Note: This command may have many subtle (but significant in number) changes to AI behaviour which may be desirable in some cases, but not in others.

start_townStarts the AI Script for town management.

transports_offComputer will not manage/build transports on its own.

check_transportsInforms computer to build transports on its own. If start_campaign was called, then 2 transports will be built, otherwise 5 will be built. The first transport is built at priority 80 and subsequent transports are built at priority 50. Protoss also trains up to 2 observers at priority 80. Used with header transports_off.

Build/Attack/Defense order commands

attack_add (byte) (military)Add %1(byte) %2(military) to the current attacking party. %1 (byte) can be at most 62, otherwise the command is ignored.In BWScriptEmulator this limitation will be removed.

attack_clearClear the attack data.

attack_doAttack the enemy with the current attacking party.

attack_preparePrepare the attack.

build (byte) (building) (byte)Build %2(building) until it commands %1(byte) of them, at priority %3(byte). The maximum value of %1(byte) is 30.In BWScriptEmulator this limitation will be removed.

player_need (byte) (building)If the player does not own %1(byte) number of %2(building), then build it at priority 80, otherwise ignore this opcode.This command is different from build because it is global and not local to the town.

prep_down (byte) (byte) (military)Add all %3(military) to the current attacking party except for %1(byte) of them, however it must send a minimum of %2(byte) of them.

call (block)Call %1(block) as a sub-routine. Only one call can be made in the game at all times from any computer player running a script.If an AI owned by player 1 makes a call, then player 2 makes a call, will override player 1's call and controls the flow of the return statement.Be sure that there is no wait command or blocking command inside the call to have it function correctly.In BWScript Emulator, this command will be fixed and function as it was intended.

enemyowns_jump (unit) (block)If enemy has a %1(unit), jump to %2(block).

stopStop script code execution. Often used to close script blocks called simultaneously.

time_jump (byte) (block)Jumps to %2(block) if %1(byte) normal game minutes have passed in the game.

[color=blue]try_townpoint (byte) (block)Jump to %2(block) when the AI owns %1 number of expansions.

Multiple threads commands

expand (byte) (block)Run code at %2(block) for expansion number %1(byte)

multirun (block)Run simultaneously code at %1(block).

Miscellaneous commands

create_nukeCreate a nuke. Should only be used in campaign scripts.The BWScript Emulator cannot emulate this opcode. It will be ignored.

create_unit (unit) (word) (word)Create %1(unit) at map position (x,y) where x = %2(word) and y = %3(word). Should only be used in campaign scripts.The BWScript Emulator cannot emulate this opcode. It will be ignored.

creep (flag)Builds structures(towers?) far if the flag is set to 4, or near if the flag is anything else.The creep command is used for expanding the zerg creep.

debug (block) (string)Show debug string %2(string) and continue in %1(block). (unsupported by scAIEditIII)The BWScript Emulator will send the string as a text message to all players.

define_max (byte) (unit)Define maximum number of %2(unit) to %1(byte).

give_moneyGives 2000 ore if ore is currently below 500 and gives 2000 gas if gas is currently below 500. This is executed immediately, the AI does not wait until it falls below 500 resources. This will be skipped entirely of no resource is below 500.In BWScript Emulator, this will use the cheat codes "whats mine is mine" and "breathe deep" four times in a row under the same conditions. This will not work in multiplayer.

nuke_pos (word) (word)Launch a nuke at map position (x,y) where x = %1(word) and y = %2(word). Should only be used in campaign scripts.

set_randomseed (dword)Set random seed to %1(dword). Note: This affects other scripts and should not be used.

StarEdit commands

clear_combatdataClears all AI attack data for all units in the location.

disruption_webOrders a Protoss Corsair to cast Disruption Web in the location.

enter_bunkerOrders units in the location to enter the closest bunker.

enter_transportOrders units in the location to enter the closest transport.

exit_transportOrders transports in the location to unload their units.

harass_locationAI Harass at selected location. (Needs definition)

junkyard_dogOrders the unit to run on "Junk Yard Dog" (similar to critter).

make_patrolOrders the units to patroll to the Generic Command Target.

move_dtOrders the computer to move all Dark Templars to the specified region.

nuke_locationOrders a computer player to nuke the selected location.

player_allyMakes all players in a specified location an ally of the trigger owner.

player_enemyMakes all players in a specified location an enemy of the trigger owner.

recall_locationOrders an Arbiter to use recall at this location.

sharedvision_off (player)Orders the specified player to unvision the trigger owner.The BWScript Emulator cannot emulate this opcode, however it can emulate the inverse, and the current player will unvision the specified player.

sharedvision_on (player)Orders the specified player to give vision to the trigger owner.The BWScript Emulator cannot emulate this opcode, however it can emulate the inverse, and the current player will share vision with the specified player.

value_areaCauses the computer to value a specified area higher than any other area. It may guard the area with units.

Unused commands

if_townsDoes not exist in memory.

scout_with (military)This command has no action associated with it and therefore cannot be used.In the BWScript Emulator, this command will correctly send the given military to scout the enemy.

List of unknown or unclear commandsUnknown purpose commandsNote: These are the most interesting commands to make research on. With the accurate opcode name list, they're now easier to decipher, but many still don't act as expected, or are still too obscure.

allies_watch (byte) (block)Expands at hardcoded expansion number %1 (byte) using %2 (block). Note: If %1 is < 8 then it is a player's start location, otherwise it is a map's base location. Does nothing if the expansion is occupied. The maximum value for %1 (byte) is 250.

capt_expandCauses the AI to expand using a default expansion block. Takes no parameter.The actual expansion block is unknown and needs research.

default_min (byte)Defines how much standing army (from defenseuse commands) will be placed at expansions. The greater the value, more units will be sent. If (byte) = 0, then it will send units only if the expansion is under attack

defaultbuild_offTurns off default_build. Note: "default build" is on by default.

fake_nukeResets the AI nuke timer. Behaviour is unknown.

max_force (word)Takes %1(word) as parameter. Unknown.

panic (block)If AI has not expanded yet and total unmined minerals in the mineral line are less than 7500, then it will expand using (block). If the AI has expanded before, the command triggers every time there are less than 7500 unmined minerals total in all owned bases, or there are less than 2 owned Refineries that are not depleted.

set_attacks (byte)The use of this command is unknown. Takes %1(byte) as parameter.

target_expansionThe use of this command is unknown. Takes no parameter.appeared in vanilla SC scripts. Looks like was a general "attack" command not necessarily expansions.Update: This only sets a flag. The actual effects from that flag are unknown.Update2: Only used with set_attacks, does nothing if the start_campaign opcode was executed.

build_bunkersBuilds up to 3 bunkers around the base (Terran only). Takes no parameters.

build_turretsBuilds up to 6 missile turrets around the base (Terran only). Takes no parameters.

A script shouldn't only use groundmap_jump in the beginning of the script. Since groundmap_jump is dynamic, you can always check if the enemy is on a different island, even if they may have started on the same land. Additionally, it is per-thread. If an expansion is made on an island, you can have that particular island expansion behave differently than the others.

You can call start_campaign any time. You can call start_campaign to change the behaviour of the AI at any time. Just remember that you can't undo this process.

anyway clearly capt_expand does other strange things, like increase spider mine placements area, and widen patrol area of observers and overlords. and it doesn't expand at all? Also I noticed that it didn't really do anything unless I put it in an expansion script.

The capt_expand command is explained in more detail in the old thread - see page 5. Have in mind that the command is stackable with itself and overuse may lead to some suicidal overlords/observers.capt_expand is also used to enable the "defenseuse_ga" and "defensebuild_ga" commands (see below).

The defensebuild_ga and defenseuse_ga are a bit...weird. I got them to work only when capt_expand is used. They trigger off:1. Enemy ground units outside the AI's base attacking an air unit that is passing over unreachable terrain (see above) on it's way into the base.2. Enemy ground units inside the AI's base attacking an air unit that is passing over unreachable terrain (see above) on it's way out of the base.

If Bunkers and Missile Turrets are build using only build_bunkers and build_turrets, they will not be rebuilt (if destroyed).

Each time a Bunker or a Missile Turret is build (or rebuild), a low priority place_guard command is run at the location of the structure, as follows:- Missile turrets have a Ghost guard spot.- Bunkers have a Ghost and a Siege Tank guard spot.Since these are both very low priority there is a chance of them being ignored/delayed if the AI is busy training other units.

nuke_rate (byte) determines the time in minutes between ordering a single ghost to use Nuclear Strike, provided there are a Ghost and a Nuke available.The AI may have more than 10 Nukes, but will still order Nuclear Strikes one at a time. Since the timer resets when the Ghost is ordered, and not when the Nuke actually launches, it is possible, with low timer to have multiple Nuclear Strikes.Default value is "0", and fake_nuke resets the timer whenever it is entered in the script.The Nuke is aborted if the ghost is disabled in any way during his way (not yet painting the target) - if killed,under stasis field/maelstrom... or if the ghost must board a transport to reach the destination (Note that if a target is available when landing it may still proceed with the Nuke).

create_nuke requires a Nuclear Silo owned by the AI, or it is ignored.

There is a slight mistake in try_townpoint 's description - it will jump to %2(block) if the AI does not yet own %1 number of expansions.

It is also nice to know that wait_force orders units to be trained, and then waits for them to finish training (saw that somewhere in the forum).

And lastly (if anyone at all cares), move_dt orders all Dark Templar(Hero) to attack-move to the specified region.

"It is also nice to know that wait_force orders units to be trained, and then waits for them to finish training (saw that somewhere in the forum)."so wait_force means you don't have to use the train command?

Is it possible to find out some of the commands that might be related to unit strengths? like max_force, eval_harass, harass_factor

guard_all forces the AI to defend all defensive structures and units around the map. In Campaign scripts, where pre-placed units and building are common, if said units (or buildings) are outside the perimeter of a baseand are attacked, they will be ignored (the AI will not send units to defend them) . By using guard_all all these units will be defended if attacked. The command identifies the locations which must be defended at the moment it is run in the script. Units or structures build after that do not count. Each location (unit or structure) that must be defended is considered as potential overlord/observer patrol point and/or spider mine placement spot.