Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.29 KB | None | 0 0
  1. ; group fill types.
  2. ; 0 = ranged
  3. ; 1 = infantry
  4. (defrule
  5. (true)
  6. =>
  7. (up-full-reset-search)
  8. (set-goal temporary-goal2 1) ; the current group we're looking at.
  9. (set-goal temporary-goal3 0) ; current group we're filling.
  10. (set-goal temporary-goal4 -1) ; current focus fire group we're looking at.
  11. (set-goal temporary-goal5 0) ; current remote loop index
  12. (set-goal gl-local-total 0)
  13. )
  14. ; stuff the group flags into a temp goal for use later.
  15. (defrule
  16. (goal temporary-goal2 1) ; ctrl group 1
  17. =>
  18. (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-one)
  19. )
  20. (defrule
  21. (goal temporary-goal2 2) ; ctrl group 2
  22. =>
  23. (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-two)
  24. )
  25. (defrule
  26. (goal temporary-goal2 3) ; ctrl group 3
  27. =>
  28. (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-three)
  29. )
  30. (defrule
  31. (goal temporary-goal2 4) ; ctrl group 4
  32. =>
  33. (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-four)
  34. )
  35. (defrule
  36. (goal temporary-goal2 5) ; ctrl group 5
  37. =>
  38. (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-five)
  39. )
  40. (defrule
  41. (goal temporary-goal2 6) ; ctrl group 6
  42. =>
  43. (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-six)
  44. )
  45. (defrule
  46. (goal temporary-goal2 7) ; ctrl group 7
  47. =>
  48. (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-seven)
  49. )
  50. (defrule
  51. (goal temporary-goal2 8) ; ctrl group 8
  52. =>
  53. (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-eight)
  54. )
  55. (defrule
  56. (goal temporary-goal2 9) ; ctrl group 9
  57. =>
  58. (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-nine)
  59. )
  60. ; setup ranged groups.
  61. (defrule
  62. (game-time > 5) ; give enough time to determine who's exploring or not.
  63. (goal temporary-goal3 0) ; filling ranged group
  64. (up-group-size g: temporary-goal2 < 40)
  65. (or(up-compare-flag temporary-goal4 != RANGED-UNITS)
  66. (up-compare-flag temporary-goal4 == RANGED-UNITS))
  67. (up-compare-flag temporary-goal4 != INFANTRY)
  68. =>
  69. (set-goal gl-split-goal 35)
  70. )
  71. (defrule
  72. (goal gl-split-goal 35)
  73. =>
  74. (up-full-reset-search)
  75. (up-set-group search-remote g: temporary-goal2)
  76. (up-filter-include 4 -1 -1 -1)
  77. (up-find-local c: all-units-class c: 240)
  78. (up-remove-objects search-local object-data-group-flag != -2)
  79. (up-get-search-state gl-local-total)
  80. (set-goal gl-split-goal 0)
  81. )
  82. (defrule
  83. (goal temporary-goal3 0) ; filling ranged group
  84. (up-compare-goal gl-local-total > 0)
  85. (up-compare-goal temporary-goal5 g:< gl-remote-total)
  86. =>
  87. (up-set-target-object search-remote g: temporary-goal5)
  88. (up-get-object-data object-data-id temporary-goal6)
  89. (up-add-object-by-id search-local g: temporary-goal6)
  90. (up-modify-goal temporary-goal5 c:+ 1)
  91. (up-reset-search 0 0 1 1)
  92. (up-jump-rule -1)
  93. )
  94. (defrule
  95. (goal temporary-goal3 0) ; filling ranged group
  96. (up-compare-goal gl-local-total > 0)
  97. =>
  98. (up-remove-objects search-local object-data-id g:== gl-scout-id)
  99. (up-remove-objects search-local object-data-range <= 2)
  100. (up-remove-objects search-local object-data-range >= 10)
  101. (up-remove-objects search-local object-data-action == actionid-explore)
  102. (up-clean-search search-local -1 search-order-asc)
  103. (up-get-search-state gl-local-total)
  104. )
  105. (defrule
  106. (goal temporary-goal3 0) ; filling ranged group
  107. (up-compare-goal gl-local-total > 0)
  108. =>
  109. (up-modify-group-flag 0 g: temporary-goal2)
  110. (up-reset-group g: temporary-goal2)
  111. (up-create-group 0 0 g: temporary-goal2)
  112. (up-modify-group-flag 1 g: temporary-goal2)
  113. (up-chat-data-to-all "(arch)Filling group %d" g: temporary-goal2)
  114. (up-chat-data-to-all "(arch)Found %d units to fill this group with." g: gl-local-total)
  115. )
  116. (defrule
  117. (goal temporary-goal3 0) ; filling ranged group
  118. (up-compare-goal gl-local-total > 0)
  119. (up-group-size g: temporary-goal2 > 0)
  120. (up-compare-flag temporary-goal4 != RANGED-UNITS)
  121. (up-compare-flag temporary-goal4 != INFANTRY)
  122. =>
  123. (up-modify-flag temporary-goal4 c:+ RANGED-UNITS)
  124. )
  125. (defrule
  126. (goal temporary-goal3 0) ; filling ranged group
  127. (up-compare-goal gl-local-total > 0)
  128. (up-group-size g: temporary-goal2 > 0)
  129. (up-compare-flag temporary-goal4 != FORM-UP)
  130. (up-compare-flag temporary-goal4 == RANGED-UNITS)
  131. =>
  132. (up-full-reset-search)
  133. (up-set-group search-local g: temporary-goal2)
  134. (up-target-point gl-null-x action-move -1 stance-no-attack)
  135. (up-modify-flag temporary-goal4 c:+ FORM-UP)
  136. (up-chat-data-to-all "Debug: formup (ranged) for group %d" g: temporary-goal2)
  137. )
  138. ; now we do the infantry group.
  139. (defrule
  140. (game-time > 5) ; give enough time to determine who's exploring or not.
  141. (goal temporary-goal3 1) ; filling infantry group
  142. (up-group-size g: temporary-goal2 < 40)
  143. (or(up-compare-flag temporary-goal4 != INFANTRY)
  144. (up-compare-flag temporary-goal4 == INFANTRY))
  145. (up-compare-flag temporary-goal4 != RANGED-UNITS)
  146. =>
  147. (up-full-reset-search)
  148. (up-set-group search-remote g: temporary-goal2)
  149. (up-find-local c: infantry-class c: 240)
  150. (up-remove-objects search-local object-data-group-flag != -2)
  151. (up-remove-objects search-local object-data-id g:== gl-scout-id)
  152. (up-get-search-state gl-local-total)
  153. )
  154. (defrule
  155. (goal temporary-goal3 0) ; filling ranged group
  156. (up-compare-goal gl-local-total > 0)
  157. (up-compare-goal temporary-goal5 g:< gl-remote-total)
  158. =>
  159. (up-set-target-object search-remote g: temporary-goal5)
  160. (up-get-object-data object-data-id temporary-goal6)
  161. (up-add-object-by-id search-local g: temporary-goal6)
  162. (up-modify-goal temporary-goal5 c:+ 1)
  163. (up-reset-search 0 0 1 1)
  164. (up-jump-rule -1)
  165. )
  166. (defrule
  167. (goal temporary-goal3 0) ; filling ranged group
  168. (up-compare-goal gl-local-total > 0)
  169. =>
  170. (up-clean-search search-local -1 search-order-asc)
  171. (up-remove-objects search-local object-data-class != infantry-class)
  172. (up-get-search-state gl-local-total)
  173. )
  174. (defrule
  175. (goal temporary-goal3 1) ; filling infantry group
  176. (up-compare-goal gl-local-total > 0)
  177. =>
  178. (up-modify-group-flag 0 g: temporary-goal2)
  179. (up-reset-group g: temporary-goal2)
  180. (up-create-group 0 0 g: temporary-goal2)
  181. (up-modify-group-flag 1 g: temporary-goal2)
  182. (up-chat-data-to-all "(inf)Filling group %d" g: temporary-goal2)
  183. (up-chat-data-to-all "(inf)Found %d units to fill this group with." g: gl-local-total)
  184. )
  185. (defrule
  186. (goal temporary-goal3 1) ; filling infantry group
  187. (up-compare-goal gl-local-total > 0)
  188. (up-group-size g: temporary-goal2 > 0)
  189. (up-compare-flag temporary-goal4 != RANGED-UNITS)
  190. (up-compare-flag temporary-goal4 != INFANTRY)
  191. =>
  192. (up-modify-flag temporary-goal4 c:+ INFANTRY)
  193. )
  194. (defrule
  195. (goal temporary-goal3 1) ; filling infantry group
  196. (up-group-size g: temporary-goal2 > 0)
  197. (up-compare-goal gl-local-total > 0)
  198. (up-compare-flag temporary-goal4 != FORM-UP)
  199. (up-compare-flag temporary-goal4 == INFANTRY)
  200. =>
  201. (up-full-reset-search)
  202. (up-set-group search-local g: temporary-goal2)
  203. (up-target-point gl-null-x action-move -1 stance-no-attack)
  204. (up-modify-flag temporary-goal4 c:+ FORM-UP)
  205. (up-chat-data-to-all "Debug: formup (inf) for group %d" g: temporary-goal2)
  206. )
  207. ; copy the result back into the group goals from temp-goal4.
  208. (defrule
  209. (up-group-size g: temporary-goal2 > 0)
  210. (goal temporary-goal2 1)
  211. =>
  212. (up-modify-goal gl-focus-fire-group-one g:= temporary-goal4)
  213. ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
  214. )
  215. (defrule
  216. (up-group-size g: temporary-goal2 > 0)
  217. (goal temporary-goal2 2)
  218. =>
  219. (up-modify-goal gl-focus-fire-group-two g:= temporary-goal4)
  220. ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
  221. )
  222. (defrule
  223. (up-group-size g: temporary-goal2 > 0)
  224. (goal temporary-goal2 3)
  225. =>
  226. (up-modify-goal gl-focus-fire-group-three g:= temporary-goal4)
  227. ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
  228. )
  229. (defrule
  230. (up-group-size g: temporary-goal2 > 0)
  231. (goal temporary-goal2 4)
  232. =>
  233. (up-modify-goal gl-focus-fire-group-four g:= temporary-goal4)
  234. ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
  235. )
  236. (defrule
  237. (up-group-size g: temporary-goal2 > 0)
  238. (goal temporary-goal2 5)
  239. =>
  240. (up-modify-goal gl-focus-fire-group-five g:= temporary-goal4)
  241. ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
  242. )
  243. (defrule
  244. (up-group-size g: temporary-goal2 > 0)
  245. (goal temporary-goal2 6)
  246. =>
  247. (up-modify-goal gl-focus-fire-group-six g:= temporary-goal4)
  248. ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
  249. )
  250. (defrule
  251. (up-group-size g: temporary-goal2 > 0)
  252. (goal temporary-goal2 7)
  253. =>
  254. (up-modify-goal gl-focus-fire-group-seven g:= temporary-goal4)
  255. ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
  256. )
  257. (defrule
  258. (up-group-size g: temporary-goal2 > 0)
  259. (goal temporary-goal2 8)
  260. =>
  261. (up-modify-goal gl-focus-fire-group-eight g:= temporary-goal4)
  262. ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
  263. )
  264. (defrule
  265. (up-group-size g: temporary-goal2 > 0)
  266. (goal temporary-goal2 9)
  267. =>
  268. (up-modify-goal gl-focus-fire-group-nine g:= temporary-goal4)
  269. ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
  270. )
  271. ; loop -- MAKE SURE THESE NEGATIVE JUMPS ARE UPDATED CORRECTLY.
  272. (defrule
  273. (up-compare-goal temporary-goal3 <= max-group-types) ; increase this later to make the loops easier.
  274. =>
  275. (up-modify-goal temporary-goal3 c:+ 1)
  276. (set-goal gl-local-total 0)
  277. (up-jump-rule -32)
  278. )
  279. (defrule
  280. (up-compare-goal temporary-goal3 >= max-group-types)
  281. (up-compare-goal temporary-goal2 <= 9)
  282. =>
  283. (set-goal temporary-goal3 0)
  284. (up-modify-goal temporary-goal2 c:+ 1)
  285. (set-goal gl-local-total 0)
  286. (up-jump-rule -33)
  287. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement