Advertisement
Pr0nogo

Untitled

Jun 13th, 2018
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.89 KB | None | 0 0
  1. ----TABLE OF CONTENTS
  2. I. Introduction
  3. II. attack_to
  4. III. attack_timeout
  5. IV. if_attacking
  6. V. issue_order
  7. VI. idle_orders
  8. VII. deaths
  9. VIII. misc commands
  10.  
  11. ----I. Introduction
  12. This command guide is designed to allow modders to use the new aiscript commands created by Neiv. Many of these commands are staples of high-end AI in the modern era. It is my
  13. 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
  14. to make compelling missions in SCBW. If you have any questions, feel free to contact me.
  15. -Pr0nogo
  16.  
  17. ----II. attack_to
  18. attack_to (X1 Y1) (X2 Y2)
  19. "Makes the AI prepare its attack in region 1 and target region 2"
  20.  
  21. Notes:
  22. 1) Using the latest version of SCMDraft allows users to view pathfinder regions.
  23. 2) Coordinates always go to the center of the region they belong to.
  24. 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
  25. placing a location will display its accurate location ID.
  26.  
  27. Example use cases:
  28. Regions are taken from Rebel Yell 10 - The Hammer Falls
  29.  
  30. attack_to (3566 1135) (3312 3535)
  31. The AI will prepare its attack inside the white base and target the region with the player's command center.
  32.  
  33. attack_to (1677 1102) (3087 3312)
  34. 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.
  35.  
  36. attack_to Loc.3 Loc.63
  37. 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.
  38.  
  39. ----III. attack_timeout
  40. attack_timeout timer
  41. "Sets the max attack preparation time"
  42.  
  43. `timer` specifies the max prep time in seconds.
  44.  
  45. Example use cases:
  46. attack_add 6 carrier
  47. attack_prepare
  48. attack_timeout 360
  49. attack_do
  50. attack_clear
  51. The AI will have a higher max prep time than default, increasing the likelihood that it fulfills the attack request.
  52.  
  53. attack_add 4 marine
  54. attack_prepare
  55. attack_timeout 30
  56. attack_do
  57. attack_clear
  58. 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().
  59.  
  60. ----IV. if_attacking
  61. if_attacking block
  62. "Jump to the desired block if the AI is preparing an attack"
  63.  
  64. Example use cases:
  65. :checkAttack
  66. wait 25
  67.  
  68. if_attacking checkAttack
  69. attack_add 3 marine
  70. attack_prepare
  71. wait 300
  72.  
  73. quick_attack
  74. attack_do
  75. attack_clear
  76. wait 1440
  77.  
  78. goto checkAttack
  79. The AI will prepare a small attack every 1440 frames if it's not preparing an attack elsewhere in the script. Useful for an area town that only has a barracks, for example.
  80.  
  81. :checkAttack2
  82. wait 25
  83.  
  84. if_attacking addAttack2
  85. goto checkAttack2
  86.  
  87. :addAttack2
  88. attack_add 3 marine
  89. wait_finishattack
  90. goto checkAttack2
  91. If the AI is preparing an attack, it will add 3 marines to the attack force.
  92.  
  93. ----V. issue_order
  94. issue_order order count unit_id (src_x src_y ~ src_r) (tgt_x tgt_y ~ tgt_r) tgt_unit_id flags
  95. `order` specifies the order that will be given to the unit.
  96. `count` specifies how many units will at most be ordered. Use `9999` for all units.
  97. `unit_id` specifies which unit type will be ordered. `229` has special meaning of "any unit".
  98. `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.
  99. `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.
  100. `tgt_unit_id` specifies the acceptable unit ID for targets, when targeting units. Again, 229 is special ID for "any unit".
  101. `flags` specifies some extra settings. They can be combined with '|'. See note 2 for more.
  102. -Enemies: Target enemy units
  103. -Own: Target own units
  104. -Allied: Target allied units (neutral units are always considered allied, even if they were owned by enemy and then given to a neutral player)
  105. -SingleUnit: Target only a single unit, even if there are multiple matches
  106. -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.
  107.  
  108. 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.
  109. -25: Drone build
  110. -30: SCV build
  111. -31: Probe build
  112. -36: Place addon
  113. -42: Unit morph
  114. -43: Building morph
  115.  
  116. Notes:
  117. 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
  118. 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.
  119. 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.
  120. There is also a bug that may be fixed eventually where units can target themselves (which will not do anything) if the unit matches both source and target filters, and "target own
  121. units" is enabled. Avoid doing that or be ready for unpredictable results.
  122. 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
  123. 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
  124. 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.
  125.  
  126. Example use cases:
  127. issue_order BuildingMorph 4 creep_colony Loc.39 Loc.39 sunken_colony 0
  128. 4 creep colonies at Location 39 will morph to sunken colonies if the player has enough resources.
  129.  
  130. issue_order Land 1 command_center Loc.5 Loc.2 Any 0
  131. 1 command center at Location 5 will land at Location 2 if there is sufficient space to land.
  132.  
  133. issue_order MoveToInfest 2 queen Loc.9 Loc.63 command_center Enemies|SingleUnit
  134. 2 queens at Location 9 will infest a command center at Anywhere if it is infestable.
  135.  
  136. ----VI. idle_orders
  137. idle_orders order rate max_per_target user_unit_id radius target_unit_id priority flags
  138. "Adds an idle order to the idle order list for the player"
  139.  
  140. `order` specifies the order that will be given to the unit.
  141. `user_unit_id` specifies the unit that will receive the order.
  142. `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.
  143. `rate` specifies how often the AI will (try to) send a unit to use the order. Specified in frames.
  144. `max_per_target` specifies how many units may simultaneously target a same unit with a idle order.
  145. `radius` is the maximum distance in pixels for which the AI will send its units from their idle position.
  146. `priority` specifies the priority. Higher priority is more important. Does not compete with stock AI commands such as `build` and `train`.
  147. `flags` specifies various targeting flags. They can be combined with '|'.
  148. -NotEnemies: Will not accept enemies as targets. Targeting enemies is enabled unless disabled with this.
  149. -Own: Will accept own units as targets
  150. -Allied: Will accept own units as targets
  151. -Unseen: Will accept unseen targets (i.e. uses maphacks instead of targeting only things that are visible to the player)
  152. -Invisible: Will accept undetected targets, and use the order on the ground near target.
  153. -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.
  154. -RemoveSilentFail: Like Remove, but won't show any warnings if nothing gets removed.
  155. -SpellEffects(effects): Target must have all of selected spell effects:
  156. `ensnare`, `plague`, `lockdown`, `irradiate`, `parasite`, `blind`, `matrix`, `maelstrom`
  157. -WithoutSpellEffects(effects): Target may not have any of selected spell effects
  158. -InCombat: Will accept targets that are targeting an enemy with an attacking order.
  159. -Hp: Will compare hit point values for acceptable targets.
  160. -Shields: Will compare shield values for acceptable targets.
  161. -Health: Will compare the sum of hit point and shield values for acceptable targets.
  162. -Energy: Will compare energy values for acceptable targets.
  163. -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.
  164. 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.
  165. Notes:
  166. 1) The target picking isn't perfect. It 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
  167. two or more separate groups of both, it may ignore one of the groups completely.
  168. 2) To disable the default AI behavior for the player, you can use DisableBuiltIn in `order` parameter (And leave everything else 0)
  169. 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.
  170. 4) Comparisons for Hp, Shields, Health, and Energy can be `LessThan`, `GreaterThan`, `LessThanPercent`, or `GreaterThanPercent`. Comparing shields will never be true if the unit
  171. has no shields.
  172. 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.
  173.  
  174. Example use cases:
  175. idle_orders dark_swarm 64 1 defiler 1200 zergling 60 Own|Allied
  176. every 64 frames, 1 idle defiler will attempt to dark swarm own or allied zerglings within 1200 pixels of the idle defiler.
  177.  
  178. idle_orders attack 64 3 infested_terran 1200 Group_Buildings 60 SpellEffects(Plague)
  179. 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.
  180.  
  181. idle_orders MoveToInfest 64 1 h_queen 2400 command_center 99 Hp(LessThanPercent 49)
  182. 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.
  183.  
  184. idle_orders PsiStorm 0 0 high_templar 5000 Group_Men, 99 Deathrattle
  185. 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.
  186.  
  187. idle_orders Feedback 480 2 dark_archon 1280 high_templar 70 Order(PsiStorm)
  188. 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.
  189.  
  190. idle_orders DisableBuiltin 0 0 0 0 0 0 0
  191. all standard idle (not retaliatory) spellcasts are disabled
  192.  
  193. ----VII. deaths
  194. deaths player comparison quantity unit block
  195. "Reads or writes data from the death table, and jumps if reading a true comparison"
  196.  
  197. `player` is zero-based, e.g. a value of `0` is player 1. `13` is current player.
  198. `comparison` is used to read or write from the death table. For reading, it can be AtLeast, AtMost, or Exactly. For writing, it can be Add, Subtract, or Set.
  199. `quantity` specifies the number of death data to read or write.
  200. `unit` specifies which unit's death data to interact with.
  201. `block` specifies the block in the aiscript to jump to if the comparison is true. Not used if writing data.
  202.  
  203. Example use cases:
  204. deaths 0 Exactly 1 probe phaseTwo
  205. if player 1 has suffered exactly 1 death of probe, jump to block phaseTwo
  206.  
  207. deaths 13 Set 119 arbiter phaseOne
  208. set current player's deaths of arbiter to 119
  209.  
  210. ----VIII. misc commands
  211. unstart_campaign
  212. "Sets the script class to melee regardless of game type"
  213.  
  214. under_attack value
  215. "Determines how aggressively the AI prioritizes defending"
  216.  
  217. `value` has three valid parameters.
  218. -0: AI will never take units from attack forces to defend.
  219. -1: AI will take units from attack forces to defend. Default behavior.
  220. -2: AI will almost never attack and keep all of its active units available for defense.
  221.  
  222. max_workers value
  223. "Sets the max number of workers a town can request"
  224.  
  225. `value` can go up to 255. Does not request workers, only allows/disallows them. Most often used with a value of `0` to stop area towns from requesting workers. A value of `0` will not prevent
  226. an AI from building gas structures on nearby geysers.
  227.  
  228. aicontrol value
  229. "Sets AI control behavior"
  230.  
  231. `value` can be one of the following:
  232. -dont_wait_request_resources: the AI will not wait for resources to fulfill a request, recycling them as it would any other request.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement