寻找同类型血量最少单位
周期性判断(defconst time-ak 43)
;----------最少血单位
(defconst gl-xue 131);列表组里单位血量
(defconst gl-lostxue 132) 设定一个血量99
(defrule
(true)
=>
(up-find-local c: 167 c: 1)获得猎杀者单位
(enable-timer time-ak 2)
)
(defrule
(timer-triggered time-ak)
=>
(set-goal gl-unit-id-1)
(set-goal gl-local-total -1) 重置次数
(set-goal gl-local-last -1)
(set-goal gl-remote-total -1)
( set-goal gl-remote-last -1)
(set-goal gl-lostxue99) 设置初始值
(up-full-reset-search)
(up-find-local c: 167 c: 1)
(up-set-target-object search-local c: 0)
(up-get-point position-object gl-target-point-x)
(up-set-target-point gl-target-point-x)
(up-filter-distance c: -1 c: 5)
(set-strategic-number sn-focus-player-number 1)
(up-find-remote c: 83 c: 6) 猎杀对象
(up-get-search-state gl-local-total)记录次数
(disable-timer time-ak)
)
(defrule
(up-compare-goal gl-remote-total c:> 0)猎杀对象数量
=>
(up-set-target-object search-remote c: 0)
(up-get-object-data object-data-hitpoints gl-xue);获取列表对象单位血量
(up-get-object-data object-data-id gl-unit-id)
)
(defrule
(up-compare-goal gl-xue g:< gl-lostxue) 判断列表对象单位血量小于99
=>
(up-modify-goal gl-lostxue g:= gl-xue)将gl-lostxue保存单位血量
(up-remove-objects search-remote object-data-hitpoints g:> gl-lostxue) 移除大于gl-lostxue值的生命值
)
(defrule
(up-compare-goal gl-remote-total c:> 0)
(up-compare-goal gl-lostxue != 99 )
=>
(set-goal gl-lostxue99)
(up-target-objects 0 action-default -1 2) 让猎杀者攻击血量少单位 攻击姿态2或3防止乱跑
) 本帖最后由 newtonerdai 于 2020-5-20 22:35 编辑
我只用了一条规则就搞定了。。。
(defrule
(taunt-detected 1 9) ;(测试用)发出数字9后开始运行。
(up-timer-status 10 <= 1) ;10 = 定时器10号。<=1 :禁用或已触发
=>
(up-full-reset-search)
(set-strategic-number sn-focus-player-number 1)
(up-find-remote c: -1 c: 40) ;-1 = 任何单位。
(up-clean-search 2 10 1) ;2 = 远程搜索。10 = 当前HP。1 = 正序(血量最少排最前)
(up-remove-objects 2 -1 c:> 1);2 = 远程搜索。-1 = 索引。只保留前2个远程结果
(up-find-local c: -1 c: 40) ;-1 = 任何单位
(up-target-objects 0 0 -1 -1) ;第二个0 = 右键。
(enable-timer 10 2) ;10 = 定时器10号。2 = 两秒执行一次
)
谢谢解答 本帖最后由 chifeiyen 于 2020-5-24 12:16 编辑
请问要想让AI攻击血量最高的单位,应该改哪个数值呢?改成多少?
(up-target-objects 0 action-default -1 2)
这里的-1就是表示“血量最少单位”吗?那“血量最多单位”用什么数值表示?
我看到DE默认AI里的也有这条参数是 (up-target-objects 1 action-default -1 -1)
后面这个-1又是什么意思?
页:
[1]