You must be logged in to post messages.
Please login or register

Scenario Design and Discussion
Moderated by Sebastien, Mr Wednesday

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: Question on ai diplomacy
posted 04-22-02 04:27 PM CT (US)   
Is there any Ai rule that makes a computer player "notice" that another computer player is attacking him?

(defrule
("is being attacked by another CP") ; I need something here
=>
("some action takes place")
(disable-self)
)

The only such thing I know is the "town-under-attack" line, but that one is too specific for my purposes.

Any ideas?

Ingo

Replies:
posted 04-22-02 04:49 PM CT (US)     1 / 15  
So you mean not only if it's attacked in its town, but also anywhere in the map?

Hu seo þrag gewat, genap under nihthelm, swa heo no wære
"As for the comment made by eithyddyswcitwr, could you please post back with better grammar that we can all understand, thankyou."
Winner of Sul's Most Obvious Comment Award
Tsunami StudiosWildfire Games
The Frankish Throne (4.6)
posted 04-22-02 04:53 PM CT (US)     2 / 15  
Exactly.
posted 04-22-02 06:37 PM CT (US)     3 / 15  
Ingo, since your good with Ai ( Gyda's Challenge ) etc I'll send you an email about Ai later.. trying to get the computer to do certain specific things.. im totally new to ai and have been trying to learn it 2/3 days now.
posted 04-22-02 06:51 PM CT (US)     4 / 15  
You could try :

(defrule
(cc-players-unit-type-count-total 1 112 > 0)
=>
(chat-to-all "I think P1 is attacking me")
)

(defrule
(cc-players-unit-type-count-total 2 112 > 0)
=>
(chat-to-all "I think P2 is attacking me")
)

(defrule
(cc-players-unit-type-count-total 3 112 > 0)
=>
(chat-to-all "I think P3 is attacking me")
)

etc.

I'm not sure what the boundaries of what it detects are, but in essence it detects an enemy "missile" targetting one of your units. Unfortunately it has other meanings as well, which I think are the explosions for Demolition Ship Line, Petard and Saboteur.

Try it out, maybe it will trap some of the cases for you ?

Another possibility is if they start out allied to each other, then in order to attack it would need to change diplomacy first, which is detected using standard ai rules.

The problem with "town-under-attack" is that it doesn't tell you who is attacking. If you don't need to know exactly who, then setting your sn-maximum-town-size to the maximum size of the map might be a possibility as well, together with using town-under-attack. The only drawback is that this approach will cause all your units to rush to attack any enemy unit or building it sees, anywhere on the map, regardless of whether it has been attacked or not. Playing with diplomacy settings may get around this in a workable fashion depending on your requirements.

I think that if your starting diplomacy to the other comp player is "neutral", then maybe you won't attack him, but will respond to being attacked ?

All depends on what you are trying to achieve.

Feel free to email me (address in profile) more details if you wish, and I will see if I can find a way that suits your requirements.

EDIT

Oops, that should have been :

(defrule
(players-unit-type-count my-player-number 112 > 0)
=>
(chat-to-all "detected attack from ranged unit")
)

I do so enjoy these "senior moments"

/EDIT

[This message has been edited by Elite Raider (edited 04-22-2002 @ 08:34 PM).]

posted 04-23-02 12:10 PM CT (US)     5 / 15  
Thanks, Elite Raider!

(defrule
(players-unit-type-count my-player-number 112 > 0)
=>
(chat-to-all "detected attack from ranged unit")
(disable-self)
)

That part works perfectly for ranged attacks when I tried it; now I only need something that makes the comp discover that he is being attacked by melee units.

Here's what I want to do:
The human player leads an allied group of computer units through enemy territory. (Your allies are also allied to the enemy who will attack them.) The player must clear the path for his allies, and keep them out of all fighting. As soon as one of the allies gets hurt, the game is lost.

Ingo

posted 04-23-02 12:23 PM CT (US)     6 / 15  
I don't know. Maybe remove all hit points but one to that player's units, so if one is hurt it dies. Then you can detect the corpse with AI. Later you give them back their HP's.

But this won't work if there's any monk


Hu seo þrag gewat, genap under nihthelm, swa heo no wære
"As for the comment made by eithyddyswcitwr, could you please post back with better grammar that we can all understand, thankyou."
Winner of Sul's Most Obvious Comment Award
Tsunami StudiosWildfire Games
The Frankish Throne (4.6)
posted 04-23-02 04:59 PM CT (US)     7 / 15  
Good idea, Sukkit! An alternative to damaging the units could be to reduce their maximum hp to 1 with a negative "Change HP" effect, so that they have 1/1 hp each. Then even a monk would not be a problem (not sure if I'll include one anyway).

Maybe a combination with Elite Raider's line would be best... then the trigger could also go off if the allies are targeted with an arrow that misses them.

Ingo

posted 04-23-02 06:16 PM CT (US)     8 / 15  
That sounds like a very good approach, as the results would be far more dependable

Good suggestion Sukkit !

And yes, it does seem as though reducing the maximum HP alternative would work in a wider range of situations - all depends on what happens later on in the same scenario.

ANOTHER EDIT :/

btw Ingo, the allies could maybe check for any corpses with a single command (depending on your requirements), saving you some degree of coding and complexity :

(defrule
(players-unit-type-count my-player-number 911 > 0)
=>
(chat-to-all "Oops =)")
(disable-self)
)

This will detect any "unit effects" for that player - it is a group / summary-level id that covers all the corpses in the game. Alas, it also covers all the missiles / arrows as well, so would also trigger if one of the allies happened to have a ranged attack and used it. This may or may not fit in with what you want it to do. From a purist point of view I think the id is actually -89, but both work and both, in fact, point to the same accumulator as far as I can tell.

FYI, unit id 112 is actually the map-revealer that temporarily highlights any ranged unit that fires at you in the game.

[This message has been edited by Elite Raider (edited 04-23-2002 @ 06:49 PM).]

posted 04-24-02 06:16 PM CT (US)     9 / 15  
Funny how this game still keeps some surprises in store for me after almost three years.

You seem to know a lot of Ai secrets I never heard of, EliteRaider. Any more you'd like to share in here? That ranged missile stuff should not be any problem if the allies are allied to the bad guys, too.

Ingo

posted 04-25-02 10:37 AM CT (US)     10 / 15  
Question for Elite_Raider ?

Looking back your AI file "ER 0_90 EW" i think its most competitivity i ever play vs AI and it is also very storng other AI as well,like youknow.

But i like to ask is it possibility to modify that file > so it can carry-out "knight-rush" some other civ ofcourse,and it dont make too much economic upgrades because they slow that down. Maybe double bit-axe,gold-mining and forging, it also must be non-cheating AI.

This one you heard allready why Ai:files could send group a villegers after boar like they did vs. deer?

Well i am complete new to make AI-files so i never maked yet. but i am intresthing very much by that matter(AI:s). What is your opinion about your file?

Have fun all Jordan


ps. Do you have any "new" files?

[This message has been edited by Jordan (edited 04-25-2002 @ 11:17 AM).]

posted 04-25-02 10:36 PM CT (US)     11 / 15  
ER_70_BETA has a teutonic knight rush.
posted 04-26-02 05:09 AM CT (US)     12 / 15  
ER 0_70 actually focuses mainly on building an economy, rather than an out and out knight rush. It does attack with knights while doing this, hopefully to interfere with the opponents economy enough to give it the edge. It did form the basis for ER 0_90 EW, but the focus on economy from Feudal onwards was replaced by a focus on producing military and a new attack system. ER 0_90 EW is still the only AI I know of that researches spies - strange that no one seems to have picked up on that from the code by this time !
posted 04-26-02 05:49 AM CT (US)     13 / 15  
Well now...

I've been following this topic with great interest, and I'd like to ask a question myself.

Seeing that there are some Ai experts around here - could somebody explain to me how I can create a "busy" Ai file? Meaning: A farming computer, some lumberjacks and stuff, but no building and a passive military? I really need a thing like that for my campaign, but I can't seem to figure out how to do it myself. Thanks in advance...


Luke Gevaerts » Website · YouTube · Backloggery

"Some scientists claim that hydrogen, because it is so plentiful, is the basic building block of the universe. I dispute that.
I say there is more stupidity than hydrogen, and that is the basic building block of the universe." - Frank Zappa

OD · AoKH
posted 04-26-02 10:36 AM CT (US)     14 / 15  
You might try my passive Ai files in the Blacksmith: They have soldiers who don't roam around, and vills who farm and gather resources.
posted 04-26-02 11:34 AM CT (US)     15 / 15  
Righteyo... Thanks.

Luke Gevaerts » Website · YouTube · Backloggery

"Some scientists claim that hydrogen, because it is so plentiful, is the basic building block of the universe. I dispute that.
I say there is more stupidity than hydrogen, and that is the basic building block of the universe." - Frank Zappa

OD · AoKH
Age of Kings Heaven » Forums » Scenario Design and Discussion » Question on ai diplomacy
Top
You must be logged in to post messages.
Please login or register
Hop to:    
Age of Kings Heaven | HeavenGames