Page 49 of 50

Re: Crusade AI Project

Posted: Wed Aug 28, 2013 2:24 am
by Alevo1
For that I set food-timer1 to 48 and food-timer2 to 23 every time I press the villager button

Re: Crusade AI Project

Posted: Thu Aug 29, 2013 3:04 pm
by Campeador
Thanks for the info. I'll try to add it.

One thing. I have an error in the line
(up-modify-goal G-MAX-FARMS s:* sn-food-gatherer-percentage)

of this rule

Code: Select all

; Farm Building
(defrule
	(up-get-fact unit-type-count villager G-MAX-FARMS)
	(up-modify-goal G-MAX-FARMS s:* sn-food-gatherer-percentage)
	(up-modify-goal G-MAX-FARMS c:/ 100)
	(up-get-fact unit-type-count villager-fisherman G-MATH-1)
	(up-modify-goal G-MAX-FARMS g:- G-MATH-1)
	(up-get-fact unit-type-count villager-forager G-MATH-1)
	(up-modify-goal G-MAX-FARMS g:- G-MATH-1)
	(up-get-fact unit-type-count villager-hunter G-MATH-1)
	(up-modify-goal G-MAX-FARMS g:- G-MATH-1)
	(up-get-fact unit-type-count villager-shepherd G-MATH-1)
	(up-modify-goal G-MAX-FARMS g:- G-MATH-1)
	(building-type-count-total farm g:< G-MAX-FARMS)
=>
	(build farm)
)
The constant for the goal G-MAX-FARMS is defined. :P

Re: Crusade AI Project

Posted: Tue Sep 03, 2013 8:29 am
by Campeador
Apart from the previous error, I have anotehr quite similar in this line:
(up-modify-goal G-REAL-HOUSING-HEADROOM g:- G-MATH-1)

The whole rule is:

Code: Select all

(defrule
	(population-headroom < 5)
	(up-get-player-fact my-player-number housing-headroom 0 G-REAL-HOUSING-HEADROOM)
	(up-get-player-fact my-player-number up-resource-amount amount-queued-count G-MATH-1)
	(up-modify-goal G-REAL-HOUSING-HEADROOM g:- G-MATH-1)

	(up-get-player-fact my-player-number building-type-count-total house  G-MATH-2)
	(up-get-player-fact my-player-number building-type-count-total town-center  G-MATH-3)
	(up-modify-goal G-MATH-2 g:+ G-MATH-3)
	(up-modify-goal G-MATH-2 c:* 5)

	(up-get-player-fact my-player-number building-type-count-total castle  G-MATH-3)
	(up-modify-goal G-MATH-3 c:* 20)
	(up-modify-goal G-REAL-HOUSING-HEADROOM g:- G-MATH-2)
	(up-modify-goal G-REAL-HOUSING-HEADROOM g:- G-MATH-3)

	(up-compare-goal G-REAL-HOUSING-HEADROOM < 5)
	(up-pending-objects c: house == 0)
	(up-can-build 0 c: house)
=>
	(up-build house)
)
Does anyone have an answer? The idea of that line is just to substract the number of units who are being trained (goal G-MATH-1) to real goal who stores the housing headroom.

Re: Crusade AI Project

Posted: Tue Sep 03, 2013 9:44 am
by scripter64
The up-modify-goal/sn can only be in the Action part of the rule. It can't be used as a Fact, unfortunately.

Re: Crusade AI Project

Posted: Tue Sep 03, 2013 10:45 am
by Campeador
So my last two doubts were because a confunsion between facts and actions. What silly mistakes. :lol:

Errors resolved. I'll continue making my AI, at a slow rate :rolleyes: , and adding force drop and any other interesting suggestions that you make me.

P.D: The new power of the UP makes me feel like a newbie. B)

Re: Crusade AI Project

Posted: Wed Sep 04, 2013 4:36 am
by Campeador
Next request. I need a table with EVERY UP constants that I could need for my AI. I've copied some of them from The Horde and Barbarian, but I have them disorganized.

One consequence of it is that I had a bug because I used:
(defconst idle-type-villager 0)

and later the condition:
(unit-type-count-total idle-type-villager < 5)

That problem has been resolved, so don't worry for that. But a file with a complete collection of UP constants should make my scripting much easier, avoiding possible future problems. B)

Re: Crusade AI Project

Posted: Wed Sep 04, 2013 6:41 am
by Archon
Campeador wrote:But a file with a complete collection of UP constants should make my scripting much easier, avoiding possible future problems. B)
With UP there come a file called UserPatchConst.per that is exactly that.

Re: Crusade AI Project

Posted: Thu Sep 05, 2013 4:30 am
by Campeador
Hahaha. Thanks for the info, I didn't remember that small thing. :lol:

Just for curiosity. What use has idle-type-villager got? I can count idle villagers without it, but I have curiosity.

Re: Crusade AI Project

Posted: Sun Mar 09, 2014 11:27 am
by Campeador
Crusade has the same power, but I've updated it to 4.42b.

Difference? It is 1.c compatible again. None difference for UP and FE.

Re: Crusade AI Project

Posted: Sun Mar 09, 2014 12:31 pm
by scripter64
Campeador! Great to see you! :)