Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; group fill types.
- ; 0 = ranged
- ; 1 = infantry
- (defrule
- (true)
- =>
- (up-full-reset-search)
- (set-goal temporary-goal2 1) ; the current group we're looking at.
- (set-goal temporary-goal3 0) ; current group we're filling.
- (set-goal temporary-goal4 -1) ; current focus fire group we're looking at.
- (set-goal temporary-goal5 0) ; current remote loop index
- (set-goal gl-local-total 0)
- )
- ; stuff the group flags into a temp goal for use later.
- (defrule
- (goal temporary-goal2 1) ; ctrl group 1
- =>
- (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-one)
- )
- (defrule
- (goal temporary-goal2 2) ; ctrl group 2
- =>
- (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-two)
- )
- (defrule
- (goal temporary-goal2 3) ; ctrl group 3
- =>
- (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-three)
- )
- (defrule
- (goal temporary-goal2 4) ; ctrl group 4
- =>
- (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-four)
- )
- (defrule
- (goal temporary-goal2 5) ; ctrl group 5
- =>
- (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-five)
- )
- (defrule
- (goal temporary-goal2 6) ; ctrl group 6
- =>
- (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-six)
- )
- (defrule
- (goal temporary-goal2 7) ; ctrl group 7
- =>
- (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-seven)
- )
- (defrule
- (goal temporary-goal2 8) ; ctrl group 8
- =>
- (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-eight)
- )
- (defrule
- (goal temporary-goal2 9) ; ctrl group 9
- =>
- (up-modify-goal temporary-goal4 g:= gl-focus-fire-group-nine)
- )
- ; setup ranged groups.
- (defrule
- (game-time > 5) ; give enough time to determine who's exploring or not.
- (goal temporary-goal3 0) ; filling ranged group
- (up-group-size g: temporary-goal2 < 40)
- (or(up-compare-flag temporary-goal4 != RANGED-UNITS)
- (up-compare-flag temporary-goal4 == RANGED-UNITS))
- (up-compare-flag temporary-goal4 != INFANTRY)
- =>
- (set-goal gl-split-goal 35)
- )
- (defrule
- (goal gl-split-goal 35)
- =>
- (up-full-reset-search)
- (up-set-group search-remote g: temporary-goal2)
- (up-filter-include 4 -1 -1 -1)
- (up-find-local c: all-units-class c: 240)
- (up-remove-objects search-local object-data-group-flag != -2)
- (up-get-search-state gl-local-total)
- (set-goal gl-split-goal 0)
- )
- (defrule
- (goal temporary-goal3 0) ; filling ranged group
- (up-compare-goal gl-local-total > 0)
- (up-compare-goal temporary-goal5 g:< gl-remote-total)
- =>
- (up-set-target-object search-remote g: temporary-goal5)
- (up-get-object-data object-data-id temporary-goal6)
- (up-add-object-by-id search-local g: temporary-goal6)
- (up-modify-goal temporary-goal5 c:+ 1)
- (up-reset-search 0 0 1 1)
- (up-jump-rule -1)
- )
- (defrule
- (goal temporary-goal3 0) ; filling ranged group
- (up-compare-goal gl-local-total > 0)
- =>
- (up-remove-objects search-local object-data-id g:== gl-scout-id)
- (up-remove-objects search-local object-data-range <= 2)
- (up-remove-objects search-local object-data-range >= 10)
- (up-remove-objects search-local object-data-action == actionid-explore)
- (up-clean-search search-local -1 search-order-asc)
- (up-get-search-state gl-local-total)
- )
- (defrule
- (goal temporary-goal3 0) ; filling ranged group
- (up-compare-goal gl-local-total > 0)
- =>
- (up-modify-group-flag 0 g: temporary-goal2)
- (up-reset-group g: temporary-goal2)
- (up-create-group 0 0 g: temporary-goal2)
- (up-modify-group-flag 1 g: temporary-goal2)
- (up-chat-data-to-all "(arch)Filling group %d" g: temporary-goal2)
- (up-chat-data-to-all "(arch)Found %d units to fill this group with." g: gl-local-total)
- )
- (defrule
- (goal temporary-goal3 0) ; filling ranged group
- (up-compare-goal gl-local-total > 0)
- (up-group-size g: temporary-goal2 > 0)
- (up-compare-flag temporary-goal4 != RANGED-UNITS)
- (up-compare-flag temporary-goal4 != INFANTRY)
- =>
- (up-modify-flag temporary-goal4 c:+ RANGED-UNITS)
- )
- (defrule
- (goal temporary-goal3 0) ; filling ranged group
- (up-compare-goal gl-local-total > 0)
- (up-group-size g: temporary-goal2 > 0)
- (up-compare-flag temporary-goal4 != FORM-UP)
- (up-compare-flag temporary-goal4 == RANGED-UNITS)
- =>
- (up-full-reset-search)
- (up-set-group search-local g: temporary-goal2)
- (up-target-point gl-null-x action-move -1 stance-no-attack)
- (up-modify-flag temporary-goal4 c:+ FORM-UP)
- (up-chat-data-to-all "Debug: formup (ranged) for group %d" g: temporary-goal2)
- )
- ; now we do the infantry group.
- (defrule
- (game-time > 5) ; give enough time to determine who's exploring or not.
- (goal temporary-goal3 1) ; filling infantry group
- (up-group-size g: temporary-goal2 < 40)
- (or(up-compare-flag temporary-goal4 != INFANTRY)
- (up-compare-flag temporary-goal4 == INFANTRY))
- (up-compare-flag temporary-goal4 != RANGED-UNITS)
- =>
- (up-full-reset-search)
- (up-set-group search-remote g: temporary-goal2)
- (up-find-local c: infantry-class c: 240)
- (up-remove-objects search-local object-data-group-flag != -2)
- (up-remove-objects search-local object-data-id g:== gl-scout-id)
- (up-get-search-state gl-local-total)
- )
- (defrule
- (goal temporary-goal3 0) ; filling ranged group
- (up-compare-goal gl-local-total > 0)
- (up-compare-goal temporary-goal5 g:< gl-remote-total)
- =>
- (up-set-target-object search-remote g: temporary-goal5)
- (up-get-object-data object-data-id temporary-goal6)
- (up-add-object-by-id search-local g: temporary-goal6)
- (up-modify-goal temporary-goal5 c:+ 1)
- (up-reset-search 0 0 1 1)
- (up-jump-rule -1)
- )
- (defrule
- (goal temporary-goal3 0) ; filling ranged group
- (up-compare-goal gl-local-total > 0)
- =>
- (up-clean-search search-local -1 search-order-asc)
- (up-remove-objects search-local object-data-class != infantry-class)
- (up-get-search-state gl-local-total)
- )
- (defrule
- (goal temporary-goal3 1) ; filling infantry group
- (up-compare-goal gl-local-total > 0)
- =>
- (up-modify-group-flag 0 g: temporary-goal2)
- (up-reset-group g: temporary-goal2)
- (up-create-group 0 0 g: temporary-goal2)
- (up-modify-group-flag 1 g: temporary-goal2)
- (up-chat-data-to-all "(inf)Filling group %d" g: temporary-goal2)
- (up-chat-data-to-all "(inf)Found %d units to fill this group with." g: gl-local-total)
- )
- (defrule
- (goal temporary-goal3 1) ; filling infantry group
- (up-compare-goal gl-local-total > 0)
- (up-group-size g: temporary-goal2 > 0)
- (up-compare-flag temporary-goal4 != RANGED-UNITS)
- (up-compare-flag temporary-goal4 != INFANTRY)
- =>
- (up-modify-flag temporary-goal4 c:+ INFANTRY)
- )
- (defrule
- (goal temporary-goal3 1) ; filling infantry group
- (up-group-size g: temporary-goal2 > 0)
- (up-compare-goal gl-local-total > 0)
- (up-compare-flag temporary-goal4 != FORM-UP)
- (up-compare-flag temporary-goal4 == INFANTRY)
- =>
- (up-full-reset-search)
- (up-set-group search-local g: temporary-goal2)
- (up-target-point gl-null-x action-move -1 stance-no-attack)
- (up-modify-flag temporary-goal4 c:+ FORM-UP)
- (up-chat-data-to-all "Debug: formup (inf) for group %d" g: temporary-goal2)
- )
- ; copy the result back into the group goals from temp-goal4.
- (defrule
- (up-group-size g: temporary-goal2 > 0)
- (goal temporary-goal2 1)
- =>
- (up-modify-goal gl-focus-fire-group-one g:= temporary-goal4)
- ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
- )
- (defrule
- (up-group-size g: temporary-goal2 > 0)
- (goal temporary-goal2 2)
- =>
- (up-modify-goal gl-focus-fire-group-two g:= temporary-goal4)
- ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
- )
- (defrule
- (up-group-size g: temporary-goal2 > 0)
- (goal temporary-goal2 3)
- =>
- (up-modify-goal gl-focus-fire-group-three g:= temporary-goal4)
- ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
- )
- (defrule
- (up-group-size g: temporary-goal2 > 0)
- (goal temporary-goal2 4)
- =>
- (up-modify-goal gl-focus-fire-group-four g:= temporary-goal4)
- ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
- )
- (defrule
- (up-group-size g: temporary-goal2 > 0)
- (goal temporary-goal2 5)
- =>
- (up-modify-goal gl-focus-fire-group-five g:= temporary-goal4)
- ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
- )
- (defrule
- (up-group-size g: temporary-goal2 > 0)
- (goal temporary-goal2 6)
- =>
- (up-modify-goal gl-focus-fire-group-six g:= temporary-goal4)
- ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
- )
- (defrule
- (up-group-size g: temporary-goal2 > 0)
- (goal temporary-goal2 7)
- =>
- (up-modify-goal gl-focus-fire-group-seven g:= temporary-goal4)
- ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
- )
- (defrule
- (up-group-size g: temporary-goal2 > 0)
- (goal temporary-goal2 8)
- =>
- (up-modify-goal gl-focus-fire-group-eight g:= temporary-goal4)
- ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
- )
- (defrule
- (up-group-size g: temporary-goal2 > 0)
- (goal temporary-goal2 9)
- =>
- (up-modify-goal gl-focus-fire-group-nine g:= temporary-goal4)
- ;(up-chat-data-to-all "Copying result to %d" g: temporary-goal2)
- )
- ; loop -- MAKE SURE THESE NEGATIVE JUMPS ARE UPDATED CORRECTLY.
- (defrule
- (up-compare-goal temporary-goal3 <= max-group-types) ; increase this later to make the loops easier.
- =>
- (up-modify-goal temporary-goal3 c:+ 1)
- (set-goal gl-local-total 0)
- (up-jump-rule -32)
- )
- (defrule
- (up-compare-goal temporary-goal3 >= max-group-types)
- (up-compare-goal temporary-goal2 <= 9)
- =>
- (set-goal temporary-goal3 0)
- (up-modify-goal temporary-goal2 c:+ 1)
- (set-goal gl-local-total 0)
- (up-jump-rule -33)
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement