Pr0nogo

Untitled

Jul 20th, 2019
688
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.54 KB | None | 0 0
  1. [[=]]
  2. [[size 4em]]**Extended AI Command Guide**[[/size]]
  3. [[/=]]
  4.  
  5. [[div style="position:fixed; LEFT: 5pt; TOP: 220pt; max-height: 600px; overflow-y: scroll; background: #FFF;"]]
  6. [[toc]]
  7. [[/div]]
  8.  
  9. ------
  10. [[=]]
  11. ++ [[size 1.2em]]**Introduction**[[/size]]
  12. [[/=]]
  13. This command guide is designed to allow modders to better understand the new aiscript commands created by Neiv and iquare. For the stock AI command list, refer to [http://pr0nogo.wikidot.com/rs-ai Nekron's document here].
  14. _
  15. Many of these commands are staples of high-end AI in the modern era. It is my hope that by writing this guide and shedding more light on the use cases of these new commands, more modders will pay closer heed to the designs of their AI and find more ways to make compelling missions in SCBW. If you have any questions, feel free to contact me.
  16. _
  17. You can download aise from [https://github.com/neivv/aise/releases Neiv's github].
  18. Other resources include the [https://mega.nz/#!LlZDGSza!QjeHYDusPopNFvqgo5yXQ8RbV3YjlsPEG0w-F2pu7EY expanded unitdef.txt file] (for use with PyAI) and the [https://mega.nz/#!Ho5SxaoC!ToXMGhkMOOwSBfZ7DYoRuMS5nYVcywbzcfKV7AxzMWE notepad++ highlighter] (automatically associates with .asc3 files, just rename your scripts with that extension).
  19. -Pr0nogo
  20. pronogo@hotmail.com, Pr0nogo#1940 on discord
  21.  
  22. ------
  23. [[=]]
  24. ++ [[size 1.2em]]**AI updates**[[/size]]
  25. [[/=]]
  26. The aiscript extension plugin, `aise`, features a swath of new commands by both Neiv and iquare. In addition to these new commands, certain core AI behaviors have been optimized and behave differently than in vanilla Starcraft.
  27. _
  28. **The request log**
  29. StarCraft's AI can only process one request (build, train, upgrade, tech) at a time. In vanilla SC, an AI will wait to satisfy its current request before proceeding to new ones, which often leads to scripts 'hanging' on a request it cannot fulfill. With aise, AI will immediately discard requests that it cannot fulfill, and re-add them every few seconds. This feature is colloquially referred to as a 'request recycler', and ensures that AI will not freeze on requests it can't satisfy.
  30. _
  31. **Limits and bugs**
  32. The following miscellaneous limits and bugs have been resolved in some way by aise:
  33. _
  34.  
  35. * Thread limit,
  36. * previously 100, now at least 8,000 (more may cause issues, and creating more than 100 threads in a single frame will cause issues)
  37. * Train bug,
  38. * explanation in Nekron's AI document, now considers units in eggs, cocoons, and archon mergings when checking if a request is satisfied
  39. * Guard crash,
  40. * explanation in Nekron's AI document, fixed completely
  41. * Calls,
  42. * previously more than 1 used in the same frame could crash, now works like a traditional call stack (can have multiple calls per player running simultaneously, can stack calls within calls)
  43. * Script file size limits,
  44. * previously 65kb, now aise commands (and goto) are not limited to jumping inside the first 65kb of space; this means that only vanilla commands are limited to 65kb
  45.  
  46. ------
  47. [[=]]
  48. ++ [[size 1.2em]]**attack_to**[[/size]]
  49. by Neiv
  50. [[/=]]
  51. //attack_to (X1 Y1) (X2 Y2)//
  52. "Tells the AI to prepare attacks in %1region, targeting the enemies closest to %2region"
  53. _
  54. __Notes:__
  55. **1)** Using the latest version of SCMDraft allows users to view pathfinder regions.
  56. **2)** Coordinates always go to the center of the region they belong to.
  57. **3)** Users can use locations with the syntax Loc.n, where n is the location ID. Location ID is zero-based, and `63` is Anywhere. Enabling the debug view in SCMDraft and deleting or placing a location will display its accurate location ID.
  58. **4)** iquare has created a version of attack_to called attack_to_deaths, which behaves identically to attack_to, but takes unit deaths as an argument for prep and attack regions. This is used in conjunction with plugin data that marks a region with a unit death, allowing more dynamic targeting.
  59. _
  60. __Example use cases:__
  61. Regions are taken from Rebel Yell 10 - The Hammer Falls
  62. _
  63. //attack_to (3566 1135) (3312 3535)//
  64. the AI will prepare its attack inside the white base and target the region with the player's command center.
  65. _
  66. //attack_to (1677 1102) (3087 3312)//
  67. the AI will prepare its attack near an empty expansion and target the region above the player's command center, where they are expected to build defenses.
  68. _
  69. //attack_to Loc.3 Loc.63//
  70. the AI will prepare its attack in location 3 (called `Staging 1` in the editor) and targets the region in the center of the map (Anywhere).
  71. _
  72. //deaths 8 Set 4910 0 blank//
  73. //deaths 8 Set 4719 1 blank//
  74. //deaths 8 Set 6096 2 blank//
  75. //deaths 8 Set 4912 3 blank//
  76. //attack_to_deaths 0 8 1 8 2 8 3 8//
  77. the AI will use player 8 deaths of marine and ghost for its prep region, and vulture and goliath base for its attack region. Ergo, the AI will prepare its attack at region 4910 4719 and select a target closest to region 6096 4912.
  78.  
  79. ------
  80. [[=]]
  81. ++ [[size 1.2em]]**attack_timeout**[[/size]]
  82. by Neiv
  83. [[/=]]
  84. //attack_timeout time//
  85. "Sets the maximum attack preparation time to %1time"
  86. _
  87.  
  88. * `timer` specifies the max prep time in seconds.
  89. _
  90. __Example use cases:__
  91. //attack_add 6 carrier//
  92. //attack_prepare//
  93. //attack_timeout 360//
  94. //attack_do//
  95. //attack_clear//
  96. the AI will have a higher max prep time than default, increasing the likelihood that it fulfills the attack request.
  97. _
  98. //attack_add 4 marine//
  99. //attack_prepare//
  100. //attack_timeout 30//
  101. //attack_do//
  102. //attack_clear//
  103. the AI will have a shorter max prep time than default, forcing the AI to commit to the attack very soon. No different than using wait 720 and quick_attack.
  104.  
  105. ------
  106. [[=]]
  107. ++ [[size 1.2em]]**issue_order**[[/size]]
  108. by Neiv
  109. [[/=]]
  110. //issue_order orderId quantity unitId (src_x src_y ~ src_r) (tgt_x tgt_y ~ tgt_r) tgtUnitId flags//
  111. "Issues %1orderId to %2quantity %3unitId in %4srcArea, targeting %6tgtUnitId in %5tgtArea, using %7flags for additional instructions"
  112. _
  113.  
  114. * `order` specifies the order that will be given to the unit.
  115. * `count` specifies how many units will at most be ordered. Use `9999` for all units.
  116. * `unit_id` specifies which unit type will be ordered. `229` has special meaning of "any unit".
  117. * `src_x`, `src_y` specify the point at which units to be ordered are searched, and `src_r` specifies the search radius. The search area is square shaped, like locations.
  118. * `tgt_x`, `tgt_y` specify the target point. If targeting units instead of terrain, `tgt_r` will specify the search radius for matching target units. See note 1 for more.
  119. * `tgt_unit_id` specifies the acceptable unit ID for targets, when targeting units. Use `Any` for "any unit".
  120. * `flags` specifies some extra settings. They can be combined with '|'. See note 2 for more.
  121. * -Enemies: Target enemy units
  122. * -Own: Target own units
  123. * -Allied: Target allied units (neutral units are always considered allied, even if they were owned by enemy and then given to a neutral player)
  124. * -SingleUnit: Target only a single unit, even if there are multiple matches
  125. * -EachAtMostOnce: Target each target at most once. If there are more units in the source area than there are targets, the remaining source units will not be issued an order.
  126. _
  127. Additionally, the following unit building orders are supported, and they take the unit type to be built in `tgt_unit_id`. See note 3 for more.
  128. * -25: Drone build
  129. * -30: SCV build
  130. * -31: Probe build
  131. * -36: Place addon
  132. * -42: Unit morph
  133. * -43: Building morph
  134. _
  135. __Notes:__
  136. **1)** Users can use locations with the syntax Loc.n, where `n` is the location ID. Location ID is zero-based, and `63` is Anywhere. Enabling the debug view in SCMDraft and deleting or placing a location will display its accurate location ID. If using a location, `src_r` can still be used as a square radius around the location.
  137. **2)** Enabling any of the first 3 flags makes the ordered units to target units instead of ground. If no valid targets can be found in the area, then the command will not do anything.
  138. **3)** When using any order that places buildings, such as 'SCV Build' or 'Land', the coordinates will not automatically be snapped to the building tile grid. The correct coordinates for placement are in the middle of unit's placement box. For example, building a command center at the top-left corner of the map would use coordinates 64, 48, as the placement box is 4x3 tiles (128x96 pixels). Locations appear to work correctly, as long as they've been snapped to the tile grid and have not moved through triggers.
  139. _
  140. __Example use cases:__
  141. //issue_order BuildingMorph 4 creep_colony Loc.39 Loc.39 sunken_colony 0//
  142. 4 creep colonies at Location 39 will morph to sunken colonies if the player has enough resources.
  143. _
  144. //issue_order Land 1 command_center Loc.5 Loc.2 Any 0//
  145. 1 command center at Location 5 will land at Location 2 if there is sufficient space to land.
  146. _
  147. //issue_order MoveToInfest 2 queen Loc.9 Loc.63 command_center Enemies|SingleUnit//
  148. 2 queens at Location 9 will infest a command center at Anywhere if it is infestable.
  149.  
  150. ------
  151. [[=]]
  152. ++ [[size 1.2em]]**idle_orders**[[/size]]
  153. by Neiv
  154. [[/=]]
  155. idle_orders order rate maxPerTarget userUnitId radius tgtUnitId priority flags
  156. "Adds %1orderId order to %3maxPerTarget %4userUnitId every %2rate frames at %7priority, targeting %6tgtUnitId unit types within %5radius from the caster, using %8flags for additional instructions"
  157. _
  158.  
  159. * `order` specifies the order that will be given to the unit.
  160. * `user_unit_id` specifies the unit that will receive the order.
  161. * `target_unit_id` specifies the unit that will be targeted by the user unit. Can also be `Any`, `Group_Men`, `Group_Buildings`, or `Group_Factories`. See note 3 for more.
  162. * `rate` specifies how often the AI will (try to) send a unit to use the order. Specified in frames.
  163. * `max_per_target` specifies how many units may simultaneously target a same unit with a idle order.
  164. * `radius` is the maximum distance in pixels for which the AI will send its units from their idle position.
  165. * `priority` specifies the priority. Higher priority is more important. Does not compete with stock AI commands such as `build` and `train`.
  166. * `flags` specifies various targeting flags. They can be combined with '|'. __Underlined flags are 1.16.1 only.__
  167. * -NotEnemies: Will not accept enemies as targets. Targeting enemies is enabled unless disabled with this.
  168. * -Own: Will accept own units as targets
  169. * -Allied: Will accept own units as targets
  170. * -Unseen: Will accept unseen targets (i.e. uses maphacks instead of targeting only things that are visible to the player)
  171. * -Invisible: Will accept undetected targets, and use the order on the ground near target.
  172. * -Remove: Instead of adding an idle order, removes one that matches the current declaration completely (excluding the `Remove` flag itself). Shows a warning if unsuccessful.
  173. * -RemoveSilentFail: Like Remove, but won't show any warnings if nothing gets removed.
  174. * -SpellEffects(effects): Target must have all of selected spell effects:
  175. * `ensnare`, `plague`, `lockdown`, `irradiate`, `parasite`, `blind`, `matrix`, `maelstrom`
  176. * -WithoutSpellEffects(effects): Target may not have any of selected spell effects.
  177. * -InCombat: Will accept targets that are targeting an enemy with an attacking order.
  178. * -Hp: Will compare hit point values for acceptable targets.
  179. * -Shields: Will compare shield values for acceptable targets.
  180. * -Health: Will compare the sum of hit point and shield values for acceptable targets.
  181. * -Energy: Will compare energy values for acceptable targets.
  182. * -Deathrattle: Will only receive the order when brought to 25% of max health (hp + shields) or 50% of health at the time the script executes the command, whichever value is smaller. Does not use the `count` or `rate` fields. Only executes if the unit was amidst executing a non-Deathrattle idle order. See note 5 for more.
  183. * -Self: Will compare following flags with its own state.
  184. * -Order: Target must have the selected order.
  185. * -Targeting: Target must be targeting one of the selected classes:
  186. * `Own`, `Enemy`, `Ally`, `Nothing` -- use `OtherUnit` for the user of the idle_order
  187. * -UnitFlags: Target must have all of the selected unit flags:
  188. * `Building`, `Addon`, `Air`, `Worker`, `Turret`, `FlyingBuilding`, `Hero`, `Regeneration`, `Animated Overlay`, `Cloakable`, `DualBirth`, `Powerup`, `ResourceDepot`, `ResourceContainer`, `Robotic`, `Detector`, `Organic`, `RequiresCreep`, `Unk40000`, `RequiresPsi`, `Burrower`, `Spellcaster`, `PermanentlyCloaked`, `Carryable`, `IgnoreSupplyCheck`, `MediumOverlays`, `LargeOverlays`, `CanMove`, `FullAutoAttack`, `Invincible`, `Mechanical`, `UnkProducesUnits`
  189. * -WithoutUnitFlags: Target must not have any of the selected unit flags.
  190. * -RandomRate: Replaces `rate` with a random number between a specified min and max value.
  191. * Syntax is RandomRate(min max)
  192. * -Hangar: Will compare subunit/ammo count for acceptable targets (Carrier, Reaver, Vulture, Nuke Silo).
  193. * -Count: Target must be adjacent to the specified number of units. Uses AtLeast/AtMost/Exactly.
  194. * Syntax is Count(operator quantity range playerId)
  195. * -Cargo: Will compare cargo amount for acceptable targets, e.g. Cargo(GreaterThan 3)
  196. * -__TileFlags:__ Target must be on the following kinds of tile:
  197. * `Walkable`, `Unbuildable`, `Creep`, `Ramp`
  198. * -__WithoutTileFlags:__ Target must not be on the selected kinds of tile.
  199. _
  200. __Notes:__
  201. **1)** The target picking prefers the closest unit it can find, and the logic works fine when the all order users/targets are roughly in same area, but if there are two or more separate groups of both, it may ignore one of the groups completely.
  202. **2)** To disable the default AI behavior for the player, you can use DisableBuiltIn in `order` parameter (And leave everything else 0)
  203. **3)** If `target_unit_id` is set to `Any`, the units just try to target anything they can even if its impossible, like trying to cast hallucination on buildings.
  204. **4)** Comparisons for Hp, Shields, Health, and Energy can be `LessThan`, `GreaterThan`, `LessThanPercent`, or `GreaterThanPercent`. Comparing shields will never be true if the unit has no shields.
  205. **5)** Deathrattle piggybacks off of previously-executed idle_orders commands and does nothing by itself. Think of it as a built-in retaliatory system for idle_orders spellcasts.
  206. _
  207. __Example use cases:__
  208. //idle_orders dark_swarm 64 1 defiler 1200 zergling 60 Own|Allied|NotEnemies//
  209. every 64 frames, 1 idle defiler will attempt to dark swarm own or allied zerglings within 1200 pixels of the idle defiler.
  210. _
  211. //idle_orders attack 64 3 infested_terran 1200 Group_Buildings 60 SpellEffects(Plague)//
  212. every 64 frames, up to 3 idle infested terrans will attempt to attack any enemy unit afflicted with plague within 1200 pixels of the idle infested terran.
  213. _
  214. //idle_orders MoveToInfest 64 1 h_queen 2400 command_center 99 Hp(LessThanPercent 49)//
  215. every 64 frames, 1 matriarch will attempt to infest enemy command centers that have less than 49% health within 2400 pixels of the idle matriarch.
  216. _
  217. //idle_orders PsiStorm 0 0 high_templar 5000 Group_Men, 99 Deathrattle//
  218. any high templar executing an idle order will attempt to retaliate if brought below the hp threshold by casting psi storm on enemy men within 5000 pixels.
  219. _
  220. //idle_orders Feedback 480 2 dark_archon 1280 high_templar 70 Order(PsiStorm)//
  221. every 480 frames, up to 2 idle dark archons will attempt to feedback hostile high templar that have been ordered to cast psi storm within 1280 pixels.
  222. _
  223. //idle_orders Consume 500 1 defiler 240 zergling Own|NotEnemies|Hp(LessThanPercent 25)|Self(Energy(LessThanPercent 50))//
  224. every 500 frames, 1 idle defiler will attempt to consume own zerglings with less than 25% life in 240 pixels if the caster has less than 50% energy.
  225. _
  226. //idle_orders DisableBuiltin 0 0 0 0 0 0 0//
  227. all standard idle (not retaliatory) spellcasts are disabled
  228.  
  229. ------
  230. [[=]]
  231. ++ [[size 1.2em]]**deaths**[[/size]]
  232. by Neiv
  233. [[/=]]
  234. //deaths playerId operator quantity unit block//
  235. "%2operator (read/write) %3quantity %1playerId's %4unitId deaths, jumping to %5block if true"
  236. _
  237.  
  238. * `playerId` can be 0-21. See note 1 for more.
  239. * `operator` can be AtLeast, AtMost, or Exactly for reading; Add, Subtract, Set, or Randomize for writing. Read comparisons can have the suffix _Call to call the specified block if true, or the suffix _Wait to wait for the comparison to be true before continuing script execution (does not jump or call).
  240. * `quantity` specifies the number of kills to compare or write.
  241. * `unit` specifies the units to use when comparing or writing. Accepts multiple entries with `|`.
  242. * `block` specifies the block in the aiscript to jump to if the comparison is true. Not used if writing data.
  243. _
  244. __Notes:__
  245. **1)** All `player` fields are zero-based and accept the following values:
  246. _
  247.  
  248. * 0-11 - Players 1-12
  249. * 13 - Current player
  250. * 14 - Foes
  251. * 15 - Allies
  252. * 17 - All players
  253. * 18-21 - Force 1-4
  254. _
  255. __Example use cases:__
  256. //deaths 0 Exactly 1 probe phaseTwo//
  257. if player 1 has suffered exactly 1 death of probe, jump to block phaseTwo
  258. _
  259. //deaths 13 Set 119 arbiter phaseOne//
  260. set current player's deaths of arbiter to 119 (and do not jump)
  261. _
  262. //deaths 4 Randomize 3 fleet_beacon blank//
  263. randomize player 5's fleet beacon deaths within a range of 0-2
  264.  
  265. ------
  266. [[=]]
  267. ++ [[size 1.2em]]**bring_jump**[[/size]]
  268. by iquare
  269. [[/=]]
  270. //bring_jump playerId operator quantity unit area block//
  271. "%2operator (read/write) %1playerId's %3quantity of %4unitIds in %5area, jumping to %6block if true"
  272. _
  273.  
  274. * `playerId` can be 0-21.
  275. * `operator` can be AtLeast, AtMost, or Exactly (includes _Call and _Wait).
  276. * `quantity` specifies the number of units to compare for.
  277. * `unit` specifics which unit to compare for. Can be combined with "|" where a matching quantity of any combination of the specified units will be a true comparison.
  278. * `region` specifies the region (or location with `Loc.n`) to search for the units.
  279. * `block` specifies which block in the aiscript to jump to if the comparison is true.
  280. _
  281. __Example use cases:__
  282. //bring_jump 4 Exactly 0 infested_command_center (367 4334) requestHatchery//
  283. if player 5 brings exactly 0 infested command centers to the specified region, jump to block.
  284. _
  285. //bring_jump 13 AtLeast 1 Group_Factory Loc.63 defendFactory//
  286. if current player brings at least 1 factory-class structure to anywhere, jump to block.
  287. _
  288. //bring_jump 18 AtLeast 30 goliath|siege_tank|science_vessel Loc.63 adaptMech//
  289. if force 1 brings at least 30 of the selected units to anywhere, jump to block.
  290.  
  291. ------
  292. [[=]]
  293. ++ [[size 1.2em]]**create_script**[[/size]]
  294. by Neiv
  295. [[/=]]
  296. //create_script block playerId area town resarea//
  297. "Runs %1block for %2playerId in %3area, attaching to %5resarea
  298. %4town: 0 (no town) or 255 (current town)"
  299. _
  300.  
  301. * `block` is the thread that will run in the newly-created thread
  302. * `playerId` specifies the player that owns the thread. Only accepts 0-7, and 255 for current player.
  303. * `area` specifies the precise coordinates the thread will be run at. Radius is in pixels. Can also accept locations through Loc.n~R. The center of this value acts as the town center if a town is created in the block.
  304. * `town` specifies whether to use no town (0) or the current town (255). Any other value does nothing. Using town 255 in a thread that has no attached town is identical to using town 0.
  305. * `resarea` specifies which resarea the thread will attach to. A value of 0 tells the script to not attach to any specific resarea, but will still mine from nearby resources if allowed.
  306. _
  307. __Notes:__
  308. **1)** To inherit values from the current thread, use the following values (this is identical to multirun):
  309. * //create_script block 255 (65534 65534) 255 0//
  310. _
  311. __Example use cases:__
  312. //create_script expand3 255 (1251 3894~24) 0 14//
  313. create a thread for current player at the specified coordinates; use code in expand3, don't use current town, and attach to resarea 14.
  314. _
  315. //create_script cannonRush 4 Loc.24 255 0//
  316. create a thread for player 5 using the bounds of location 24; use code in cannonRush, use current town, and don't attach to any resarea.
  317.  
  318. ------
  319. [[=]]
  320. ++ [[size 1.2em]]**player_jump**[[/size]]
  321. by iquare
  322. //1.16.1 only//
  323. [[/=]]
  324. //player_jump string block//
  325. "Compares player names in-game to %1string, jumping to %2block if reading a true comparison"
  326. _
  327.  
  328. * `username` is the text to match. Must be a complete match, not case sensitive.
  329. * `block` specifies which block in the aiscript to jump to if the comparison is true.
  330. _
  331. __Example use cases:__
  332. //player_jump nekron killnekron//
  333. if the player's username matches `nekron`, jump to block.
  334.  
  335. ------
  336. [[=]]
  337. ++ [[size 1.2em]]**kills**[[/size]]
  338. by iquare
  339. //(mostly) 1.16.1 only//
  340. [[/=]]
  341. //kills player1 player2 operator quantity unit block//
  342. "%3operator (read/write) %1player1's %4quantity kills of %2player2's %5unitId, jumping to %6block if true"
  343. _
  344.  
  345. * `player1` specifies the player to compare kill counts with.
  346. * `player2` specifies the player to compare kill counts against.
  347. * `operator` can be AtLeast, AtMost, or Exactly for reading (includes _Call and _Wait); Add, Subtract, Set, or Randomize for writing.
  348. * `quantity` specifies the number of kills to compare or write.
  349. * `unit` specifies the units to use when comparing or writing. Accepts multiple entries with `|`.
  350. * `block` specifies which block in the aiscript to jump to if the comparison is true.
  351. _
  352. __Notes:__
  353. **1)** As the kills table is several times larger than the deaths table, it can be used instead of deaths for variables.
  354. **2)** Though the bulk of this command's functionality is only usable in 1.16.1, you can still read values you've written elsewhere when writing scripts for 1.2. You will not be able to track kills in-game.
  355. _
  356. __Example use cases:__
  357. //kills 1 17 AtLeast 10 mutalisk|devourer|guardian buildAir//
  358. if player 2 kills at least 10 of the specified units owned by any player, jump to block.
  359. _
  360. //kills 18 19 AtLeast 2 Group_Buildings warnPlayer//
  361. if force 1 kills at least 2 buildings owned by force 2, jump to block.
  362.  
  363. ------
  364. [[=]]
  365. ++ [[size 1.2em]]**supply**[[/size]]
  366. by iquare
  367. [[/=]]
  368. //supply playerId operator quantity supplyType unitId race block//
  369. "%2operator (read/write) %1playerId's %3quantity %4supplyType of %6race, jumping to %7block if true
  370. %4supplyType: Provided, Used, Max, InUnits
  371. %5unitId: 0, unless %4supplyType set to InUnits"
  372. _
  373.  
  374. * `operator` can be AtLeast, AtMost, Exactly (includes _Call and _Wait), Set, Add, Subtract, or Randomize.
  375. * `supplyType` can be Provided, Used, Max, or InUnits. When writing supply, you must use Max.
  376. * `units` is used only if `supplyType` is set to InUnits. `0` otherwise. Compares supply of the specified units.
  377. * `race` can be Terran, Zerg, Protoss, Any_Total, or Any_Max. When writing, you cannot use the last two.
  378. _
  379. __Example use cases:__
  380. //supply 18 AtLeast_Call 54 InUnits battlecruiser Terran adaptBattlecruiser//
  381. if force 1 has at least 54 terran supply used by battlecruisers, call the block.
  382. _
  383. //supply 13 Set 250 Max 0 Terran blank//
  384. sets current player's max terran supply to 250.
  385.  
  386. ------
  387. [[=]]
  388. ++ [[size 1.2em]]**time**[[/size]]
  389. by iquare
  390. [[/=]]
  391. //time operator quantity timeType block//
  392. "Using %1operator, compare game time to %2quantity %3timeType, jumping to %4block if true
  393. %3timeType: Frames, Minutes"
  394. _
  395.  
  396. * `operator` can be AtLeast, AtMost, or Exactly (includes _Call and _Wait).
  397. * `timeType` can be Frames or Minutes. Minutes are normal-speed game minutes, as with time_jump.
  398. _
  399. __Example use cases:__
  400. //time AtLeast 7200 Frames startScript//
  401. if at least 2.5 real minutes have passed, jump to block.
  402.  
  403. ------
  404. [[=]]
  405. ++ [[size 1.2em]]**resources**[[/size]]
  406. by iquare
  407. [[/=]]
  408. //resources playerId operator resourceType quantity block//
  409. "%2operator (read/write) %1playerId's %4quantity %3resourceType, jumping to %5block if true
  410. %3resourceType: Ore, Gas, Any"
  411. _
  412.  
  413. * `resourceType` can be Ore, Gas, or Any. When reading, `Any` requires either Ore or Gas to be true. When writing, `Any` writes to both resource types.
  414. * `operator` can be AtLeast, AtMost, Exactly (includes _Call and _Wait), Set, Add, Subtract, or Randomize.
  415. _
  416. __Example use cases:__
  417. //resources 14 AtMost_Call Ore 350 startHarass//
  418. if Foes have 0-350 minerals, call the block.
  419. _
  420. //resources 0 Add Any 200 blank//
  421. add 200 ore and gas to player 1's resources.
  422. _
  423. //resources 13 AtMost_Wait Any 500 techUp//
  424. pause script execution until current player has at least 500 Ore or Gas
  425. ------
  426. [[=]]
  427. ++ [[size 1.2em]]**remove_[request]**[[/size]]
  428. by iquare
  429. [[/=]]
  430. //remove_[requestType] quantity unitId townId//
  431. "removes %1quantity of %2unitId from %3townId's request log"
  432. _
  433.  
  434. * `requestType` can be build. More types are not yet implemented.
  435. * `requestedUnit` is the unit requested by the [requestType] command, e.g. `build 1 command_center`.
  436. * `townId` can be 0-254, as set by set_id, or 255 to use the current town. See misc commands for more info. The town id must be set even when using a value of 255.
  437. _
  438. __Example use cases:__
  439. //remove_build 2 nuclear_silo 0//
  440. remove 2 nuclear silo requests from town 0.
  441.  
  442. ------
  443. [[=]]
  444. ++ [[size 1.2em]]**guard**[[/size]]
  445. by iquare
  446. [[/=]]
  447. //guard unitId area quantity retrainingCount priority//
  448. "Requests %3quantity %1unitId guards at %3area and %5priority, retraining them %retrainingCount times
  449. %4deaths - 0 for infinite"
  450. _
  451.  
  452. * `location` can be (PosX PosY) or Loc.n.
  453. * `deaths` can be 0-255, with 255 being the max value, 1 being never remake, and 0 being remake infinitely.
  454. _
  455. __Example use cases:__
  456. //guard goliath (1353 4966) 1 3 40//
  457. requests 1 goliath at the specified coordinates at priority 40 and remakes the guard 3 times
  458.  
  459. ------
  460. [[=]]
  461. ++ [[size 1.2em]]**base_layout**[[/size]]
  462. by iquare
  463. //1.16.1 only//
  464. [[/=]]
  465. //base_layout structureId operator area quantity townId priority//
  466. "%2operator (set/remove) %3area for %4quantity %1structureId in %5townId at %6priority"
  467. _
  468.  
  469. * `operator` can be Set or Remove.
  470. * `area` can be (PosX PosY)~R or Loc.n~R. If all locations are occupied, the AI will build normally.
  471. * `townId` can be 0-254, as set by set_id, or 255 to use the current town. The town id must be set even when using a value of 255.
  472. * `priority` only competes with base_layout slots fo the same unitId.
  473. _
  474. __Example use cases:__
  475. //base_layout supply_depot Set (48 3040) 1 1 50//
  476. //base_layout supply_depot Set (80 2880) 1 1 50//
  477. //base_layout supply_depot Set (112 2944) 1 1 50//
  478. the AI will prioritize the three specified locations for depots in town 1
  479. _
  480. //base_layout command_center Remove (384 2608) 1 13 50//
  481. the AI will no longer prioritize the specified location for command centers in town 13
  482.  
  483. ------
  484. [[=]]
  485. ++ [[size 1.2em]]**load_bunkers**[[/size]]
  486. by iquare
  487. [[/=]]
  488. //load_bunkers area unitId unitQuantity bunkerUnitId bunkerId priority//
  489. "Requests %3unitQuantity %2unitId for %5bunkerId %4bunkerUnitIds in %1area at %6priority"
  490. _
  491.  
  492. * `unitId` and `unitQuantity` specify what number of which units will be staffed in the bunker.
  493. * `bunkerUnitId` specifies which bunker-type unit or structure will accept the specified units.
  494. * `bunkerId` specifies which bunker specifically will accept the specified units. e.g. the first bunker a player uses should use a `bunkerId` of 1. This value is player-specific.
  495. _
  496. __Notes:__
  497. **1)** This command does not request units; it only orders eligible units to enter the bunker.
  498. **2)** Units are eligible if they are not in a transport, bunker, attack wave, or defense force. Units that are assigned to other AI tasks or killed prior to reaching their bunker are removed from the bunker's list.
  499. **3)** The `bunkerUnitId` field accepts any unitId for the purpose of mods that add bunker functionality to other unitIds.
  500.  
  501. __Example use cases:__
  502. //load_bunkers (1234 5678) h_marine 3 bunker 1 50//
  503. bunker at the specified point will order up to 3 eligible hero marines at priority 50
  504.  
  505. ------
  506. [[=]]
  507. ++ [[size 1.2em]]**reveal_area**[[/size]]
  508. by iquare
  509. //1.16.1 only//
  510. [[/=]]
  511. //reveal_area playerId area time flags//
  512. "Reveals %2area for %1playerId, lasting %3time frames and using %4flags for reveal type"
  513. _
  514.  
  515. * `area` can be Loc.n, coordinate, or coordinate~radius.
  516. * `time` is in frames. A value of 0 is permanent.
  517. * `flag` can be RevealFog. A proper reveal flag is being investigated but may not be possible.
  518. _
  519. __Example use cases:__
  520. //reveal_area 1 Loc.3 0 RevealFog//
  521. permanently reveals fog in location 3 for player 2
  522.  
  523. //reveal_area 4 (1234 4321)~32 360 RevealFog//
  524. reveals fog for 15 seconds in a 32-pixel radius around the specified point for player 5
  525.  
  526. ------
  527. [[=]]
  528. ++ [[size 1.2em]]**bank_data**[[/size]]
  529. by iquare
  530. [[/=]]
  531. //bank_data operator quantity category key block//
  532. "%1operator (read only) %2quantity of %3category's %4key, jumping to %5block if true
  533. Use save_bank(string) and load_bank(string) to save or load external files"
  534. _
  535.  
  536. * `operator` is a comparison, like other jump commands (deaths, kills, bring_jump, etc).
  537. * `category` and `key` are string labels for variables.
  538. * `block` only jumps if reading a true comparison.
  539. _
  540. __Notes:__
  541. 1) Use save_bank string and load_bank string to save and load external files.
  542. 2) External files are stored as binary data. On 1.16.1, they are stored in a folder called `save`, in the mod's directory. On 1.2+, they are stored in Documents\Starcraft.
  543. _
  544. __Example use cases:__
  545. //load_bank survivorCount//
  546. //bank_data AtLeast 1 map1 marineCount createMarine//
  547. load data, and if key `marineCount` in category `map1` is at least 1, jump to block.
  548.  
  549. //bank_data Add 1 map1 marineCount createMarine//
  550. //save_bank survivorCount//
  551. add 1 to key `marineCount` in category `map1` and save the data.
  552.  
  553. ------
  554. [[=]]
  555. ++ [[size 1.2em]]**lift_land**[[/size]]
  556. by iquare
  557. //1.16.1 only//
  558. [[/=]]
  559. //lift_land unitId quantity sourceArea targetArea sourceTown targetTown hpValue//
  560. "Orders %2quantity %1unitIds at %3sourceArea in %5sourceTown to lift off and land at %4targetArea, transferring to %6targetTown once landing is complete; retreats back to %3sourceArea if dropped below %7hpValue before the landing completes"
  561. _
  562.  
  563. * `sourceTown` and `targetTown` read values set by set_id.
  564. * `hpValue` orders the unit to retreat to its source location if its hp drops below the specified percentage.
  565. _
  566. __Notes:__
  567. **1)** Retreating structures will embark again once repaired.
  568. **2)** If destroyed while in transit, assuming the structure is rebuilt in the sourceArea, the replacement structure will also attempt to land at the targetArea.
  569. **3)** Town ownership does not change until the structure lands at the targetArea.
  570. **4)** Ensure you use a large enough sourceArea to pick up the structures you want, or the AI will be told to transfer nothing.
  571. _
  572. __Example use cases:__
  573. lift_land command_center 1 Loc.4 (1234 4321) 1 3 50
  574. orders one command center owned by town 1 at location 4 to move to the specified coordinates and change ownership to town 3, retreating if brought under 50% life.
  575.  
  576. ------
  577. [[=]]
  578. ++ [[size 1.2em]]**queue**[[/size]]
  579. by iquare
  580. [[/=]]
  581. //queue quantity unit_id factory_id townId modifier area priority//
  582. "Queues %1quantity %2unitId from available %3factoryId in %4townId in %6area at %7priority."
  583. _
  584.  
  585. * `modifier` can be `Local` or `Global`. Local requests are town-specific.
  586. _
  587. __Notes:__
  588. **1)** The command rechecks every 30 frames until enough slots become available, queuing as many as possible until the specified amount have been queued.
  589. **2)** `townId` is only used if `modifier` is set to `Local`.
  590. **3)** If `modifier` is set to `Local` and `townId` specifies a nonexistent town, the command will not fire and an error message will print.
  591. _
  592. __Example use cases:__
  593. //queue 3 h_marine barracks 2 local Loc.63 80//
  594. queues 3 hero marines using only town 2's barracks
  595.  
  596. ------
  597. [[=]]
  598. ++ [[size 1.2em]]**unit_name**[[/size]]
  599. by iquare
  600. //1.16.1 only//
  601. [[/=]]
  602. //unit_name playerId unitId area string operator//
  603. "%5operator (write only) %1playerId's names of %2unitIds in %3area to %4string"
  604. _
  605.  
  606. * `string` is a text string that replaces the stat_txt.tbl entry; use <32> for a space.
  607. * `operator` can be Set or Remove. Using Remove will reset the string ID used by the specified units.
  608. _
  609. __Example use cases:__
  610. //unit_name 0 command_center Loc.63 Dominion<32>Command<32>Center Set//
  611. sets the name of all player 1 command centers at anywhere to the specified string
  612.  
  613. ------
  614. [[=]]
  615. ++ [[size 1.2em]]**defense**[[/size]]
  616. by iquare
  617. [[/=]]
  618. //defense quantity unitId defenseType defenseDirection1 defenseDirection2//
  619. "Adds %1quantity %2unitId to the AI's %3defenseType list when defending %4defenseDirection1 units from %5defenseDirection2 attackers"
  620. _
  621.  
  622. * `defenseType` can be `Build` or `Use`. Build counts as a request.
  623. * `defenseDirection` parameters can be `Ground` or `Air`.
  624. _
  625. __Example use cases:__
  626. //defense 1 marine build ground air//
  627. adds 1 marine to the list of units the AI builds when its ground units are attacked by air units
  628.  
  629. ------
  630. [[=]]
  631. ++ [[size 1.2em]]**replace_unit**[[/size]]
  632. by iquare
  633. //1.16.1 only//
  634. [[/=]]
  635. //replace_unit unitId1 unitId2//
  636. "Permanently replaces most requests of %1unitId1 with requests of %2unitId2"
  637. _
  638. __Notes:__
  639. **1)** This command only replaces requests for commands hooked in aise. Currently, defenseuse, defensebuild, wait_train, and wait_force are not supported by this command.
  640. _
  641. __Example use cases:__
  642. //replace_unit goliath marine//
  643. permanently replaces all supported goliath requests with marine requests
  644.  
  645. ------
  646. [[=]]
  647. ++ [[size 1.2em]]**container_jump**[[/size]]
  648. by iquare
  649. [[size 0.8em]][[span style="color: indianred"]]not in current aise build![[/span]][[/size]]
  650. [[/=]]
  651. //container_jump resourceType operator quantity area block//
  652. "Using %2operator, compares %1resourceType of resource containers in %4area, jumping to %5block if reading a true comparison"
  653. _
  654. __Notes:__
  655. **1)** Unlike in resources and resarea_jump, container_jump gets the total of Ore and Gas when using Any.
  656. _
  657. __Example use cases:__
  658. //container_jump Ore AtLeast_Wait 2000 Loc.4 blank//
  659. pause script execution until at least 2000 minerals are present in location 4
  660. _
  661. //container_jump Any AtMost 1000 Loc.12 expandStart//
  662. if at most 1000 minerals and gas are present at location 12, jump to block
  663.  
  664. ------
  665. [[=]]
  666. ++ [[size 1.2em]]**local_jump**[[/size]]
  667. by iquare & Pr0nogo
  668. [[size 0.8em]][[span style="color: indianred"]]not in current aise build![[/span]][[/size]]
  669. [[/=]]
  670. //local_jump townId operator quantity unitId block//
  671. "%2operator (read-only) %3quantity of %4unitId assigned to %1townId, moving to %5block if true"
  672. _
  673. __Example use cases:__
  674. //local_jump 255 AtLeast_Call 1 cybernetics_core plusDragoon//
  675. if the town this command is executed in owns a cybernetics core, call the block
  676. _
  677. //local_jump 12 AtLeast_Wait 12 scv blank//
  678. pause script execution until a player has at least 12 SCVs assigned to a town with ID 12
  679.  
  680. -----
  681. [[=]]
  682. ++ [[size 1.2em]]**resarea_jump**[[/size]]
  683. by iquare & Pr0nogo
  684. //1.16.1 only//
  685. [[size 0.8em]][[span style="color: indianred"]]not in current aise build![[/span]][[/size]]
  686. [[/=]]
  687. //resarea_jump townId operator resareaId resourceType quantity block//
  688. "%2operator (read-only) %1townId's %3resareaId and %5quantity %4resourceType, moving to %6block if true"
  689. _
  690. __Notes:__
  691. **1)** If %3resareaId does not match the town's resarea, the command will return false. Use a value of 255 for current resarea.
  692. _
  693. __Example use cases:__
  694. //resarea_jump 255 AtLeast 255 Ore 1000 plusZealot//
  695. if current town's resource area has at least 1000 minerals in its connected fields, jump to block
  696. _
  697. //resarea_jump 255 AtLeast 5 Ore 2 expo5Layout//
  698. if current town's resource area is 5 (and has at least 2 minerals in its connected fields), jump to block
  699. _
  700. //resarea_jump 4 AtMost_Wait 255 Gas 800 blank//
  701. pause script execution until town 4's resource area has at most 800 gas in its connected geysers
  702.  
  703. ------
  704. [[=]]
  705. ++ [[size 1.2em]]**misc commands**[[/size]]
  706. [[/=]]
  707. ------
  708. +++ **unstart_campaign**
  709. by Neiv
  710. "Takes no value"
  711. Sets the script class to melee regardless of game type
  712. +++ **under_attack**
  713. by Neiv
  714. //under_attack value//
  715. "Sets AI defense behavior to %1value"
  716. _
  717. `value` has three valid parameters.
  718. * 0: AI will never take units from attack forces to defend.
  719. * 1: AI will take units from attack forces to defend. Default behavior.
  720. * 2: AI will almost never attack and keep all of its active units available for defense.
  721. +++ **max_workers**
  722. by Neiv
  723. //max_workers value//
  724. "Allows AI to have %1value workers"
  725. _
  726. `value` can go up to 255. Thsi command does not request workers; it only allows/disallows them. Can be used with a value of `0` to stop area towns from requesting workers. A value of `0` will not prevent an AI from building gas structures on nearby geysers. This command can be used to supersede the global worker limit of 30, but the worker limit is reduced every time the AI expands, so it is advisable to write your desired max_workers value at the beginning of every expansion thread.
  727. +++ **aicontrol**
  728. by Neiv
  729. //aicontrol value//
  730. "Sets general AI behavior to %1value"
  731. _
  732. `value` can be one of the following:
  733. * dont_wait_request_resources: the AI will not wait for resources to fulfill a request, recycling them as it would any other request if it doesn't have the resources to satisfy it. Turn off with 'wait_request_resources'.
  734. * dont_build_gas: the AI will not build gas extraction structures automatically. Accepts requests. Turn off with 'build_gas'.
  735. * no_retaliation: the AI's spellcasters will not retaliate with spells when attacked. Also disables aggressive casts when spellcasters are added to attacks. Turn off with 'retaliation'. 1.16.1 only.
  736. * dont_focus_disabled: the AI's units will not focus enemy units disabled by maelstrom or lockdown. 1.16.1 only. Turn off with 'focus_disabled'.
  737. * unit_mover_enabled: the AI will ignore own and allied unit collision when placing buildings. Useful to prevent AI from failing to build properly. Turn off with 'unit_mover_disabled'. 1.16.1 only. [[span style="color: indianred"]]Not in current aise build![[/span]]
  738.  
  739. +++ **wait_rand**
  740. by iquare
  741. //wait_rand minFrame maxFrame//
  742. "Pauses script execution for a random amount of frames between %1minFrame and %2maxFrame"
  743. _
  744. `value1` is the minimum number of frames for which the script will pause, while `value2` is the maximum.
  745. +++ **random_call**
  746. by iquare
  747. //random_call chance block//
  748. "Calls %2block %1chance/256 times"
  749.  
  750. `chance` is out of 256, so 128 would be 50%
  751. +++ **upgrade_jump**
  752. by iquare
  753. //upgrade_jump playerId operator upgradeId upgradeQuantity block//
  754. "%2operator (read/write) %1playerId's %3upgradeId %4upgradeQuantity, jumping to %5block if true"
  755.  
  756. Can also write upgrade data with Set, Add, Subtract, and Randomize operators. Can use _Call and _Wait for reading.
  757. +++ **tech_jump**
  758. by iquare
  759. //tech_jump playerId operator techId techLevel block//
  760. "%2operator (read only) %1playerId's %3techId %4techLevel, jumping to %5block if true"
  761. _
  762. Can use _Call and _Wait for reading. 0 for available, 1 for researched.
  763. +++ **attack_rand**
  764. by iquare
  765. //attack_rand minQuantity maxQuantity unitId//
  766. "Adds a random amount of %3unitId between %1minQuantity and %2maxQuantity"
  767. +++ **set_id**
  768. by iquare
  769. //set_id variable//
  770. "Assigns %1variable to the current town"
  771. _
  772. `variable` can be 0-255. Must be unique across all players. Commands interacting with town ids can be used in scripts owned by players that don't own the specified town, e.g. a script owned by player 1 can modify the requests of a script owned by player 2 with remove_[request].
  773. +++ **set_free_id**
  774. by iquare - [[span style="color: indianred"]]not in current aise build![[/span]]
  775. //set_free_id//
  776. "Assigns a free town ID to the current town; takes no parameters"
  777. +++ **print**
  778. by iquare
  779. //print string//
  780. "Prints %1string for all players, also playing transmission.wav"
  781. +++ **attacking**
  782. by iquare
  783. //attacking operator block//
  784. "%1operator (read only) current AI's attacking state, jumping to %2block if true"
  785. _
  786. `operator` can be True, False, True_Call, False_Call, True_Wait, and False_Wait.
  787. _
  788. [[collapsible show="+ if_attacking" hide="- if_attacking"]]
  789. **if_attacking**
  790. by Neiv
  791. //if_attacking block//
  792. Jump to the desired block if the AI is preparing an attack
  793. Outmoded by `attacking`.
  794. [[/collapsible]]
  795. +++ **ping**
  796. by iquare -- //1.16.1 only//
  797. //ping PosX PosY color//
  798. "Pings %1posX %2posY on the minimap for all players, using %3color"
  799. _
  800. Unlike other commands, ping has two separate location fields, for x and y coordinates.
  801. `color` is numerical, where 0 = red, 1 = blue, etc. Currently, colors past 15 (cyan by default) do not work, and custom colors via a modified tminimap.pcx are not supported.
  802. +++ **unit_avail**
  803. by iquare
  804. //unit_avail playerId operator availability unitId block//
  805. "%2operator (read/write) %1playerId's %3availability of %4unitId, jumping to %5block if true
  806. %3availability: Enabled, Disabled"
  807. _
  808. `operator` can be Exactly, Set, or Randomize.
  809. `availability` can be Enabled or Disabled.
  810. _
  811. __Example use cases:__
  812. //unit_avail 0 Set Enabled siege_tank blank//
  813. sets player 1's siege tank availability to enabled
  814. +++ **tech_avail**
  815. by iquare
  816. //tech_avail playerId operator, techId, presetStatus, block//
  817. "%2operator (read/write) %1playerId's %3techId %4presetStatus, jumping to %5block if true"
  818. _
  819. `operator` can be Exactly, Set, or Randomize.
  820. `presetStatus` can be Enabled, Disabled, or Researched. If you want to wait for a tech to be researched, use tech_jump instead.
  821. +++ **remove_creep**
  822. by iquare -- //1.16.1 only//
  823. //remove_creep area//
  824. "Instantly removes creep in %1area"
  825. _
  826. `area` can be Loc.n or PosX PosY~R.
  827. +++ **max_build**
  828. by iquare -- //1.16.1 only//
  829. //max_build townId unitId quantity//
  830. "Sets the maximum %2unitId that can be requested by %1townId"
  831. _
  832. Used to limit AI to a max number of structures, particularly useful when requesting supply structures in expansions as these requests are cloned in the main town.
Add Comment
Please, Sign In to add comment