tankant 发表于 2013-9-14 16:14:45

AI语法求助贴,如何计算两个单位的和?

两个毫不相关的单位,比如要计算自己所有剑士跟弓箭手的和

tankant 发表于 2013-9-14 17:56:24

会了,利用UP函数

43 (defconst gl-chengzhenyang-num 0)
44 (defconst gl-muchangyang-num 0)
45 (defconst gl-yangshiti-num 0)
46 (defconst gl-yang-num 0)
47
48 (defrule
49 (true)
50 =>
51 (set-goal gl-yang-num 0)
52 (up-get-fact unit-type-count chengzhenyang-line gl-chengzhenyang-num)
53 (up-get-fact unit-type-count muchangyang-line gl-muchangyang-num)
54 (up-get-fact unit-type-count yangshiti gl-yangshiti-num)
55 (up-modify-goal gl-yang-num c:+ gl-chengzhenyang-num)
56 (up-modify-goal gl-yang-num c:+ gl-muchangyang-num)
57 (up-modify-goal gl-yang-num c:+ gl-yangshiti-num)
58 )
59
60 (defrule
61 (wood-amount > 100)
62 (up-compare-goal gl-yang-num < 20)
63 (can-train chengzhenyang-line)
64 =>
65 (train chengzhenyang-line)(train muchangyang-line)
66 )

血战平壤 发表于 2013-9-18 22:08:03

有点艰深。
页: [1]
查看完整版本: AI语法求助贴,如何计算两个单位的和?