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

[求助] 我的写的AI是不是格式不对?

[复制链接]

21

主题

3

精华

1万

积分

征服者

耕战
3476
鹰币
2266
天龙币
0
回帖
221

第十三届火箭筒杯季军

附庸关系9
 楼主| 发表于 2020-5-5 11:05:06 | 显示全部楼层 |阅读模式
  1. (defrule
  2.     (true)
  3. =>
  4.     (chat-to-all "AI ready")
  5.     (disable-self)
  6. )

  7. ;村民不动

  8. (defrule
  9.     (true)
  10. =>
  11.     (set-strategic-number sn-maximum-food-drop-distance 0)
  12.     (set-strategic-number sn-maximum-wood-drop-distance 0)
  13.     (set-strategic-number sn-maximum-gold-drop-distance 0)
  14.     (set-strategic-number sn-maximum-stone-drop-distance 0)
  15.     (disable-self)
  16. )

  17. (defrule
  18.     (true)
  19. =>
  20.     (set-strategic-number sn-percent-civilian-gatherers 0)
  21.     (set-strategic-number sn-percent-civilian-builders 0)
  22.     (set-strategic-number sn-percent-civilian-explorers 0)
  23.     (disable-self)
  24. )

  25. ;士兵不动

  26. (defrule
  27.     (true)
  28. =>
  29.     (set-strategic-number sn-task-ungrouped-soldiers 0)
  30.     (disable-self)
  31. )

  32. ;输入数字

  33. (defrule
  34. (taunt-detected 1 202)
  35. =>
  36. (acknowledge-taunt 1 202)
  37. (cc-add-resource wood 10)
  38. )

  39. (defrule
  40. (taunt-detected 1 203)
  41. =>
  42. (acknowledge-taunt 1 203)
  43. (cc-add-resource food 10)
  44. )

  45. (defrule
  46. (taunt-detected 1 204)
  47. =>
  48. (acknowledge-taunt 1 204)
  49. (cc-add-resource gold 10)
  50. )

  51. (defrule
  52. (taunt-detected 1 205)
  53. =>
  54. (acknowledge-taunt 1 205)
  55. (cc-add-resource stone 10)
  56. )

  57. (defrule
  58. (taunt-detected 1 206)
  59. =>
  60. (acknowledge-taunt 1 206)
  61. (cc-add-resource stone 20)
  62. )
复制代码

决定版,自定义AI,每次保存,打开游戏都会提示这个。文件在附件里。


;AI

(defrule
    (true)
=>
    (chat-to-all "AI ready")
    (disable-self)
)

;士兵不动

(defrule
    (true)
=>
    (set-strategic-number sn-task-ungrouped-soldiers 0)
    (disable-self)
)

;村民不动

(defrule
    (true)
=>
    (set-strategic-number sn-maximum-food-drop-distance 0)
    (set-strategic-number sn-maximum-wood-drop-distance 0)
    (set-strategic-number sn-maximum-gold-drop-distance 0)
    (set-strategic-number sn-maximum-stone-drop-distance 0)
    (disable-self)
)

(defrule
    (true)
=>
    (set-strategic-number sn-percent-civilian-gatherers 0)
    (set-strategic-number sn-percent-civilian-builders 0)
    (set-strategic-number sn-percent-civilian-explorers 0)
    (disable-self)
)

;驻扎单位

(defrule
    (true)
=>
    (up-gather-inside c: barracks c: 1)
    (up-gather-inside c: archery-range c: 1)
    (up-gather-inside c: stable c: 1)
    (disable-self)
)

;开始训练部队

(defrule
  (up-research-status c: 375 >= research-pending)
=>
  (enable-timer 1 2)
  (enable-timer 5 2)
  (enable-timer 8 2)
  (disable-self)
)

;兵营训练部队

(defrule
  (timer-triggered 1)
=>
  (disable-timer 1)
  (enable-timer 2 2)
  (train militiaman-line)
)

(defrule
  (timer-triggered 2)
=>
  (disable-timer 2)
  (enable-timer 12 2)
  (train spearman-line)
)

(defrule
  (timer-triggered 3)
=>
  (disable-timer 3)
  (enable-timer 4 2)
  (train 892)
)

(defrule
  (timer-triggered 4)
=>
  (disable-timer 4)
  (enable-timer 1 2)
  (train 1109)
)

;靶场训练部队

(defrule
  (timer-triggered 5)
=>
  (disable-timer 5)
  (enable-timer 6 2)
  (train archer-line)
)

(defrule
  (timer-triggered 6)
=>
  (disable-timer 6)
  (enable-timer 7 2)
  (train skirmisher-line)
)

(defrule
  (timer-triggered 7)
=>
  (disable-timer 7)
  (enable-timer 5 2)
  (train 73)
)

;马厩训练部队

(defrule
  (timer-triggered 8)
=>
  (disable-timer 8)
  (enable-timer 9 2)
  (train 1266)
)

(defrule
  (timer-triggered 9)
=>
  (disable-timer 9)
  (enable-timer 8 2)
  (train 827)
)

;攻城器械厂训练部队

(defrule
    (unit-type-count-total battering-ram-line < 4)
    (can-train battering-ram-line)
=>
    (train battering-ram-line)
)

;爆出兵建筑

(defrule
    (up-research-status c: 374 >= research-pending)
    (building-type-count barracks less-than 10)
    (can-build barracks)
=>
    (build-forward barracks)
)

(defrule
    (up-research-status c: 374 >= research-pending)
    (building-type-count archery-range less-than 3)
    (can-build archery-range)
=>
    (build-forward archery-range)
)

(defrule
    (up-research-status c: 374 >= research-pending)
    (building-type-count stable less-than 3)
    (can-build stable)
=>
    (build-forward stable)
)

(defrule
    (up-research-status c: 374 >= research-pending)
    (building-type-count siege-workshop less-than 2)
    (can-build siege-workshop)
=>
    (build-forward siege-workshop)
)

(defrule
    (up-research-status c: 374 >= research-pending)
=>
    (up-gather-inside c: barracks c: 0)
    (up-gather-inside c: archery-range c: 0)
    (up-gather-inside c: stable c: 0)
    (disable-self)
)

;进攻

(defrule
    (up-research-status c: 380 >= research-pending)
=>
    (attack-now)
    (enable-timer 50 20)
    (disable-self)
)

(defrule
    (timer-triggered 50)
=>
    (attack-now)
    (disable-timer 50)
    (enable-timer 50 20)
)

;自增资源

(defrule
    (food-amount <= 5000)
    (event-detected trigger 220)
=>
    (cc-add-resource food 5000)
)

(defrule
    (gold-amount <= 5000)
    (event-detected trigger 220)
=>
    (cc-add-resource gold 5000)
)

(defrule
    (wood-amount <= 5000)
    (event-detected trigger 220)
=>
    (cc-add-resource wood 5000)
)

;维持村民

(defrule
    (up-research-status c: 374 >= research-pending)
    (building-type-count town-center less-than 1)
    (can-build town-center)
=>
    (build town-center)
)

(defrule
    (up-research-status c: 374 >= research-pending)
    (unit-type-count-total villager < 10)
    (can-train villager)
=>
    (train villager)
)

;放哨

(defrule
    (up-research-status c: 373 >= research-pending)
=>
    (set-strategic-number sn-task-ungrouped-soldiers 1)
    (set-strategic-number sn-enemy-sighted-response-distance 5)
    (set-strategic-number sn-percent-enemy-sighted-response 100)
    (set-difficulty-parameter ability-to-dodge-missiles 100)
    (set-difficulty-parameter ability-to-maintain-distance 100)
    (disable-self)
)

本帖子中包含更多资源

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

x
![/url]
回复

使用道具 举报

15

主题

0

精华

1033

积分

伯爵

耕战
175
鹰币
580
天龙币
0
回帖
188
附庸关系0
发表于 2020-5-5 15:59:11 | 显示全部楼层
research-pending 是属於Userpatch的内容,你可能要去预读一下Userpatch.per档案
回复

使用道具 举报

183

主题

9

精华

2万

积分

教皇

耕战
3329
鹰币
16766
天龙币
0
回帖
1200

翔鹰建站十周年纪念章

附庸关系3
发表于 2020-5-5 17:37:05 | 显示全部楼层
同楼上,应该在AI开头先写一句:
(load "UserPatchConst")
然后在AI的文件群里加一个UserPatchConst.per的UP常数预定义档。
这样才能正常使用research-pending这些自定义常数名。
UserPatchConst文件可以去订阅Jacky_Lin的Beginner那个AI,在AI文件目录里能找到。
索引:
Userpatch 实用技术贴索引←点击进入
决定版精品贴大索引←点击进入

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

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

使用道具 举报

本版积分规则

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

GMT+8, 2024-11-23 16:05 , Processed in 0.141348 second(s), 47 queries , File On.

Powered by Hawk Studio  QS Security Corp.® Licensed

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

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