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

[求助] 方位AI

[复制链接]

14

主题

0

精华

1165

积分

伯爵

耕战
100
鹰币
320
天龙币
0
回帖
30
附庸关系0
 楼主| 发表于 2020-5-16 14:57:05 | 显示全部楼层 |阅读模式
本帖最后由 wangzhen 于 2020-5-16 15:11 编辑

(defconst ponit-x 101)
(defconst point-y 102)
(defconst gl-target-point-x 103)
(defconst gl-target-point-y 104)
(defconst gl-bianjie-x 105) ;边界
(defconst gl-bianjie-y 106) ;边界
(defconst gl-zuoshang-x 120) ;左上
(defconst gl-zuoshang-y 121) ;左上
(defconst gl-zuoxia-x 122) ;左下
(defconst gl-zuoxia-y 123) ;左下
(defconst gl-youshang-x 124) ;右上
(defconst gl-youshang-y 125) ;右上
(defconst gl-youxia-x 126) ;右下
(defconst gl-youxia-y 127) ;右下
(defconst time-now 42) ;计时器

(defrule
     (true)
=>

  (up-get-point position-center gl-point-x)
   (up-modify-goal gl-bianjie-x g:= gl-point-x)
   (up-modify-goal gl-bianjie-y g:= gl-point-y)           
   (up-modify-goal gl-bianjie-x c:* 2)
   (up-modify-goal gl-bianjie-y c:* 2)
   (up-modify-goal gl-bianjie-x c:- 1)
   (up-modify-goal gl-bianjie-y c:- 1)
   (up-modify-goal gl-zuoshang-x g:= gl-point-x)
   (up-modify-goal gl-zuoshang-y g:= gl-point-y)
   (up-modify-goal gl-zuoshang-x c:/ 2)
   (up-modify-goal gl-zuoshang-y c:/ 2)   
   (up-modify-goal gl-zuoxia-x g:= gl-point-x)
   (up-modify-goal gl-zuoxia-y g:= gl-point-y)
   (up-modify-goal gl-zuoxia-x c:/ 2)
   (up-modify-goal gl-zuoxia-y c:/ 2)     
   (up-modify-goal gl-zuoxia-y g:+ gl-point-y)
   (up-modify-goal gl-youshang-x g:= gl-point-x)
   (up-modify-goal gl-youshang-y g:= gl-point-y)
   (up-modify-goal gl-youshang-x c:/ 2)
   (up-modify-goal gl-youshang-y c:/ 2)
   (up-modify-goal gl-youshang-x g:+ gl-point-x)
   (up-modify-goal gl-youxia-x g:= gl-point-x)
   (up-modify-goal gl-youxia-y g:= gl-point-y)         
   (up-modify-goal gl-youxia-x c:/ 2)
   (up-modify-goal gl-youxia-y c:/ 2)
   (up-modify-goal gl-youxia-x g:+ gl-point-x)
   (up-modify-goal gl-youxia-y g:+ gl-point-y)
)


(defrule
       (game-time > 0)
=>

          (up-full-reset-search)
         (up-find-local c: 167 c: 1) ;167是unitID

         (up-get-search-state gl-local-total)
          (up-set-target-object search-local c: 0)

)        

(defrule
    (taunt-detected 1 1)
=>
         (up-get-point position-center gl-point-x)
        (up-get-point position-object gl-target-point-x)
        (enable-timer time-now 2)
        (acknowledge-taunt 1 1)
        
        )


(defrule
      (timer-triggered time-now)
          (up-compare-goal gl-target-point-x g:< gl-zuoshang-x)
          (up-compare-goal gl-target-point-y g:< gl-zuoshang-y)
        
=>
      (disable-timer time-now)
          (up-chat-data-to-all "方位:在左" g: gl-point-y)
)

(defrule
      (timer-triggered time-now)
          (up-compare-goal gl-target-point-x g:>= gl-point-x)
          (up-compare-goal gl-target-point-x g:< gl-youshang-x)
          (up-compare-goal gl-target-point-y g:<= gl-youshang-y)
=>
      (disable-timer time-now)
          (up-chat-data-to-all "方位:在左上" g: gl-point-y)
)

(defrule
      (timer-triggered time-now)
          (up-compare-goal gl-target-point-x g:< gl-point-x)
          (up-compare-goal gl-target-point-x g:>= gl-zuoshang-x)
         
          (up-compare-goal gl-target-point-y g:< gl-zuoshang-y)
=>
      (disable-timer time-now)
          (up-chat-data-to-all "方位:在左偏上" g: gl-point-y)
)

(defrule
      (timer-triggered time-now)
         
          (up-compare-goal gl-target-point-x g:<= gl-zuoshang-x)
          (up-compare-goal gl-target-point-y g:< gl-point-y)
          (up-compare-goal gl-target-point-y g:> gl-zuoshang-y)
=>
      (disable-timer time-now)
          (up-chat-data-to-all "方位:在左偏下" g: gl-point-y)
)

(defrule
      (timer-triggered time-now)
         
          (up-compare-goal gl-target-point-x g:< gl-zuoshang-x)
          (up-compare-goal gl-target-point-y g:> gl-point-y)
          (up-compare-goal gl-target-point-y g:<= gl-zuoxia-y)
=>
      (disable-timer time-now)
          (up-chat-data-to-all "方位:在左下" g: gl-point-y)
)

(defrule
      (timer-triggered time-now)
          (up-compare-goal gl-target-point-x g:> gl-youxia-x)
          (up-compare-goal gl-target-point-x g:<= gl-bianjie-x)
          (up-compare-goal gl-target-point-y g:> gl-youxia-y)
          (up-compare-goal gl-target-point-y g:<= gl-bianjie-y)
=>
      (disable-timer time-now)
          (up-chat-data-to-all "方位:在右" g: gl-point-y)
)

(defrule
      (timer-triggered time-now)
          (up-compare-goal gl-target-point-x g:>= gl-zuoxia-x)
          (up-compare-goal gl-target-point-x  g:< gl-point-x)
          (up-compare-goal gl-target-point-y  g:> gl-zuoxia-y)
          (up-compare-goal gl-target-point-y  g:< gl-bianjie-y)
=>
      (disable-timer time-now)
          (up-chat-data-to-all "方位:右下" g: gl-point-y)
)

(defrule
      (timer-triggered time-now)
          (up-compare-goal gl-target-point-x  g:<= gl-youxia-x)
          (up-compare-goal gl-target-point-x  g:> gl-point-x)
          (up-compare-goal gl-target-point-y  g:< gl-bianjie-y)
          (up-compare-goal gl-target-point-y  g:> gl-youxia-y)
=>
      (disable-timer time-now)
          (up-chat-data-to-all "方位:右偏下" g: gl-point-y)
)

(defrule
      (timer-triggered time-now)
          (up-compare-goal gl-target-point-x g:> gl-youshang-x)
          (up-compare-goal gl-target-point-x g:<= gl-bianjie-x)
          ;(up-compare-goal gl-target-point-y c:> 0)
          (up-compare-goal gl-target-point-y g:< gl-point-y)
          (up-compare-goal gl-target-point-y g:>= gl-youshang-y)
=>
      (disable-timer time-now)
          (up-chat-data-to-all "方位:在右上" g: gl-point-y)
)

(defrule
      (timer-triggered time-now)
          (up-compare-goal gl-target-point-x g:> gl-youshang-x)
          (up-compare-goal gl-target-point-x g:<= gl-bianjie-x)
         
          (up-compare-goal gl-target-point-y g:> gl-point-y)
          (up-compare-goal gl-target-point-y g:<= gl-youxia-y)
=>
      (disable-timer time-now)
          (up-chat-data-to-all "方位:在右偏上" g: gl-point-y)
)

(defrule
      (timer-triggered time-now)
          (up-compare-goal gl-target-point-x g:<= gl-bianjie-x)
          (up-compare-goal gl-target-point-x g:> gl-youshang-x)
          (up-compare-goal gl-target-point-y g:< gl-youshang-y)
=>
      (disable-timer time-now)
          (up-chat-data-to-all "方位:在上" g: gl-point-y)
)

(defrule
      (timer-triggered time-now)
          (up-compare-goal gl-target-point-x g:< gl-zuoxia-x)
          (up-compare-goal gl-target-point-y g:> gl-zuoxia-y)
          (up-compare-goal gl-target-point-y g:<= gl-bianjie-y)
=>
      (disable-timer time-now)
          (up-chat-data-to-all "方位:在下" g: gl-point-y)
)

(defrule
      (timer-triggered time-now)
          (up-compare-goal gl-target-point-x g:>= gl-zuoshang-x)
           (up-compare-goal gl-target-point-x g:< gl-youshang-x)
          (up-compare-goal gl-target-point-y g:>= gl-zuoshang-y)
          (up-compare-goal gl-target-point-y g:< gl-youxia-y)
=>
      (disable-timer time-now)
          (up-chat-data-to-all "方位:在中心附近" g: gl-point-y)
)

(defrule
      (timer-triggered time-now)
         
=>
      (disable-timer time-now)
         
)

回复

使用道具 举报

8

主题

0

精华

2645

积分

公爵

耕战
447
鹰币
1511
天龙币
0
回帖
111
附庸关系2
发表于 2020-5-16 15:00:17 | 显示全部楼层
感谢大佬!正好要用这个!
回复

使用道具 举报

本版积分规则

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

GMT+8, 2024-11-23 17:36 , Processed in 0.132221 second(s), 36 queries , File On.

Powered by Hawk Studio  QS Security Corp.® Licensed

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

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