翔鹰帝国网|帝国时代论坛|帝国时代系列|神话时代
 找回密码
 注册翔鹰会员(昵称)
搜索
查看: 606|回复: 5

[交流] [UP1.5]最终微操 AI单位自动闪避己方投石车砲火

[复制链接]

15

主题

0

精华

1033

积分

伯爵

耕战
175
鹰币
580
天龙币
0
回帖
188
附庸关系0
 楼主| 发表于 2020-6-12 13:31:22 | 显示全部楼层 |阅读模式
本帖最后由 blazefires 于 2020-6-17 22:13 编辑

由於我的AI会产一堆投石车,所以AI必须学会闪避投石车砲火。
1. 这麽做将产生我方只有投石车在交战,其他单位形同挂机一样。
2. 对付其他AI很有效,我方战损将大幅下滑,但是对人类就不知道了,人类绝对会想办法钻进来,但是AI军队由於闪避时会往投石车方向撤退,等於变相保护投石车...(真的是这样子么)

;閃避己方投石車開始
(defrule
    (true)
=>
        (set-goal gl-index 0)
        (set-goal temp-goal 0)
)
(defrule
    (true)
=>
        (up-full-reset-search)
        (up-find-local c: mangonel-line c: 240)
        (up-remove-objects search-local object-data-target-id c:< 0)
        (up-get-search-state gl-local-total)
)
(defrule
    (up-compare-goal gl-local-total c:> 0)
=>
        (up-set-target-object search-local c: 0)
        (up-get-object-data object-data-reload-time temp-goal)
        (up-modify-goal temp-goal c:- 1200)
        (up-remove-objects search-local object-data-next-attack g:< temp-goal)
        (up-get-search-state gl-local-total)
        (up-modify-goal temp-goal g:= gl-local-total)
)
(defrule
    (up-compare-goal gl-local-total c:< 1)
=>
        (up-jump-rule 8)
)
(defrule
    (true)
=>
        (up-set-target-object search-local g: gl-index)
        (up-get-object-target-data object-data-point-x gl-target-point-x)
        (up-get-object-target-data object-data-point-y gl-target-point-y)
        (up-set-target-point gl-target-point-x)
        (set-goal temp-goal2 -1)
        (set-goal gl-data 0)
)
(defrule
    (or(up-object-target-data object-data-cmdid c:== 2)
        (up-object-target-data object-data-cmdid c:== 10))
        (up-modify-goal temp-goal2 c:= 1)
        (up-object-target-data object-data-type c:== town-center)
=>
        (up-jump-rule 5)
)
(defrule
        (goal temp-goal2 1) ;AI投石车砸建筑(城镇中心除外)时,周围单位自动回避
=>
        (up-full-reset-search)
        (up-filter-include 4 -1 -1 -1)
        (up-filter-exclude -1 -1 -1 siege-weapon-class)
        (up-filter-distance c: -1 c: 6)
        (up-find-local c: all-units-class c: 24)
        (up-remove-objects search-local object-data-target c:== villager-class)
        (up-remove-objects search-local object-data-target c:== monastery-class)
        (up-remove-objects search-local object-data-target c:== petard-class)
        (up-remove-objects search-local object-data-action c:== actionid-enter)
        (up-remove-objects search-local object-data-action c:== actionid-explore)
        (up-remove-objects search-local object-data-class c:== packed-trebuchet-class)
        (up-remove-objects search-local object-data-class c:== unpacked-trebuchet-class)
        (up-remove-objects search-local object-data-class c:== scorpion-class)
        (up-remove-objects search-local object-data-class c:== warship-class)
        (up-get-search-state gl-local-total)
)
(defrule
        (goal temp-goal2 -1) ;AI投石车砸树、敌军时,周围单位自动回避
=>
        (up-full-reset-search)
        (up-filter-include 4 -1 -1 -1)
        (up-filter-exclude -1 -1 -1 siege-weapon-class)
        (up-filter-distance c: -1 c: 3)
        (up-find-local c: all-units-class c: 14)
        (up-remove-objects search-local object-data-target c:== petard-class)
        (up-remove-objects search-local object-data-next-attack c:> 0)
        (up-remove-objects search-local object-data-action c:== actionid-enter)
        (up-remove-objects search-local object-data-action c:== actionid-explore)
        (up-remove-objects search-local object-data-class c:== packed-trebuchet-class)
        (up-remove-objects search-local object-data-class c:== unpacked-trebuchet-class)
        (up-remove-objects search-local object-data-class c:== scorpion-class)
        (up-remove-objects search-local object-data-class c:== warship-class)
        (up-get-search-state gl-local-total)
)
(defrule
        (up-compare-goal gl-local-total c:> 0)
=>
        (up-remove-objects search-local object-data-index g:!= gl-data)
        (up-set-target-object search-local c: 0)
        (up-get-point position-object gl-point-x)
        (up-lerp-tiles gl-point-x gl-target-point-x c: -2)
        (up-bound-point gl-point-x gl-point-x)
)
(defrule
        (up-compare-goal gl-local-total c:> 0)
        (up-path-distance gl-point-x 0 != 65535)
=>
        (up-target-point gl-point-x action-move -1 stance-defensive) ;TSA时,必须转防守姿态才能闪避,至於何时再转进攻姿态,请依照需求自行调整
)
(defrule
        (up-modify-goal gl-data c:+ 1)
        (up-compare-goal gl-data g:< gl-local-total)
=>
        (up-jump-rule -5)                ;遍例所有需要闪避的单位
)
(defrule
        (up-modify-goal gl-index c:+ 1)
        (up-compare-goal gl-index g:< temp-goal)
=>
        (up-jump-rule -11)              ;遍例所有投石车
)

这里提供最终成果实战:
1v1,阿拉伯,帝国战争,後帝开局,中型(6人地图),我方条顿vs极限波斯
补充: 极限难度下由於开局村民暴多,5分钟就能建成约15座城堡,非常适合战斗

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册翔鹰会员(昵称)

x

评分

参与人数 1耕战 +25 鹰币 +80 收起 理由
newtonerdai + 25 + 80 分享交流

查看全部评分

回复

使用道具 举报

15

主题

0

精华

1033

积分

伯爵

耕战
175
鹰币
580
天龙币
0
回帖
188
附庸关系0
 楼主| 发表于 2020-6-12 13:41:20 | 显示全部楼层
游侠、条武追击撤退大象,投石车往大象位置发砲,游侠、条武自动後撤
敌军大象走得过慢,依旧被重投给轰死
回复

使用道具 举报

15

主题

0

精华

1033

积分

伯爵

耕战
175
鹰币
580
天龙币
0
回帖
188
附庸关系0
 楼主| 发表于 2020-6-12 18:06:20 | 显示全部楼层
本帖最后由 blazefires 于 2020-6-12 18:10 编辑

思路忘记提了,很简单:

用DUC找出发炮瞬间的投石车,搜寻发炮点附近的己方军队,闪避、远离发炮地点

这样就不会再见到打建筑的军队被己方投石车K死了

城镇中心这个建筑则完全可以忽略,投石车无法对城镇中心周围的己方部队造成误伤
回复

使用道具 举报

183

主题

9

精华

2万

积分

教皇

耕战
3325
鹰币
14954
天龙币
0
回帖
1200

翔鹰建站十周年纪念章

附庸关系3
发表于 2020-6-13 13:40:50 | 显示全部楼层
哇,牛逼。
大致是横向远离投石车-投石车目标之间连线。
索引:
Userpatch 实用技术贴索引←点击进入
决定版精品贴大索引←点击进入

战役:
《 兔与豹》——柔弱奴隶公主  猛兽口中求生←点击进入
《敛由国的统一》←点击进入

殊途战役制作群 QQ: 616317226
翔鹰帝国Ⅱ:决定版交流群 QQ: 112822759
回复

使用道具 举报

15

主题

0

精华

1033

积分

伯爵

耕战
175
鹰币
580
天龙币
0
回帖
188
附庸关系0
 楼主| 发表于 2020-6-17 22:09:53 | 显示全部楼层
更新闪避系统的RP
6人地图,这次25分钟就拆光波斯家
回复

使用道具 举报

15

主题

0

精华

1033

积分

伯爵

耕战
175
鹰币
580
天龙币
0
回帖
188
附庸关系0
 楼主| 发表于 2020-6-17 22:10:00 | 显示全部楼层
本帖最后由 blazefires 于 2020-6-17 22:11 编辑

2
回复

使用道具 举报

本版积分规则

排行榜|小黑屋|翔鹰帝国

GMT+8, 2024-3-29 06:30 , Processed in 0.150386 second(s), 79 queries , File On.

Powered by Hawk Studio  QS Security Corp.® Licensed

Copyright © 2001-2023, Hawkaoe.net All Rights Reserved

快速回复 返回顶部 返回列表