Map Database  •  FAQ  •  RSS  •  Login

AI does not seem to attack

<<

Strangelove

User avatar

Crossbowman

Posts: 230

Joined: 30 Jul 2013, 06:32

KaM Skill Level: Fair

Post 03 Aug 2013, 19:42

AI does not seem to attack

Ok here we go again. Discovered the next problem while creating a map.

I am pretty much finish with this map and tried to set the attacks with the in the map-builder included tool, but somehow the AI does not attack at all. However, the 2nd AI is attacking if I tell her to. I tried setting several options and waited several hours, but the AI is just building up its defence to the limit.
Furthermore, if I set the 2nd AI to attack the Storehouse and they get interrupted by my troops, they just stand there, after they killed my units and do nothing at all. If i set "repeat" they suddely take all their troops of the same kind (for example mounted), even when I tell them to only mobilize 1 group.

Hope you guys get what I am sayin' lol. Feel free to ask!
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 03 Aug 2013, 19:52

Re: AI does not seem to attack

I will need more information. Can you post the script here, so I can take a look?
<<

Strangelove

User avatar

Crossbowman

Posts: 230

Joined: 30 Jul 2013, 06:32

KaM Skill Level: Fair

Post 03 Aug 2013, 20:03

Re: AI does not seem to attack

You do mean the static script i guess? Here you go.

The position is the one of the Storehouse.


EDIT: If thats not enough I can attach the map here.
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 03 Aug 2013, 20:14

Re: AI does not seem to attack

Nah I won't need the map. I'll take a look. (And edit this post once I figured it out. ;))

Edit:

About the first AI player:
Ok, the script is a bit chaotic, so I first combined some parts, with the following result:
  Code:
!SET_GROUP 15 97 168 5 7 14 !SET_AI_DEFENSE 97 168 5 0 15 0 !SET_GROUP 15 107 174 5 7 14 !SET_AI_DEFENSE 107 174 5 0 15 0 !SET_GROUP 19 114 167 5 5 10 !SET_AI_DEFENSE 114 167 5 1 15 0 !SET_GROUP 19 124 171 4 5 10 !SET_AI_DEFENSE 124 171 4 1 15 0 !SET_GROUP 15 117 176 5 7 14 !SET_AI_DEFENSE 117 176 5 0 15 0 !SET_GROUP 21 128 177 4 5 10 !SET_AI_DEFENSE 128 177 4 3 20 0 !SET_GROUP 21 99 156 5 5 10 !SET_AI_DEFENSE 99 156 5 3 20 0 !SET_GROUP 23 85 146 6 7 21 !SET_AI_DEFENSE 85 146 6 0 25 0 !SET_GROUP 17 89 146 6 5 10 !SET_AI_DEFENSE 85 146 6 0 25 0 !SET_GROUP 15 88 132 6 7 14 !SET_AI_DEFENSE 88 132 6 0 15 0 !SET_GROUP 19 97 145 5 5 10 !SET_AI_DEFENSE 97 145 5 1 15 0 !SET_GROUP 21 97 124 6 5 10 !SET_AI_DEFENSE 97 124 6 3 20 0 !SET_GROUP 17 101 165 5 5 5 !SET_AI_DEFENSE 101 165 5 2 15 1 !SET_GROUP 17 110 170 5 5 10 !SET_AI_DEFENSE 110 170 5 2 15 1 !SET_GROUP 17 124 167 4 5 10 !SET_AI_DEFENSE 124 167 4 2 15 1 !SET_GROUP 17 117 164 5 5 5 !SET_AI_DEFENSE 117 164 5 2 15 1 !SET_GROUP 17 93 131 6 5 10 !SET_AI_DEFENSE 93 131 6 2 15 1
The attack this player has to carry out is this one:
  Code:
!SET_AI_ATTACK TYPE 1 !SET_AI_ATTACK TOTAL_AMOUNT 60 !SET_AI_ATTACK TROUP_AMOUNT 0 1 !SET_AI_ATTACK TROUP_AMOUNT 1 0 !SET_AI_ATTACK TROUP_AMOUNT 2 1 !SET_AI_ATTACK TROUP_AMOUNT 3 1 !SET_AI_ATTACK COUNTER 0 !SET_AI_ATTACK TARGET 3 !SET_AI_ATTACK POSITION 16 230 !COPY_AI_ATTACK 0
This attack means that after 0/10th second, the AI will attack with at least 60 'free' soldiers, divided among 1 group melee, 1 group ranged and 1 group mounted units, and they will attack at (16, 230). However, there are no 60 'free' soldiers, and certainly not divided among 3 different groups. You see, the last number of !SET_AI_DEFENSE (either 0 or 1) represents how important a group is. If a defense position has importance 0, the units on that position will NEVER attack. Only units with importance 1 can attack. In your case, only ranged units. But even if you had enough defense positions with importance 1, the attack would still not be carried out because it is a TYPE 1 attack. TYPE 1 attacks only occur once. In other words, they will be carried out at the moment you command them to: COUNTER 0 --> immediately when the game begins. But there are not enough troops to do so. I recommend using a TYPE 2 or TYPE 0 attack, because these will repeat.
(Please note, there is a significant difference between TPR and KaM Remake: whereas in TPR, any attack will be carried out at or after the set COUNTER, KaM Remake ignores COUNTER for TYPE 0 ( ? ) and TYPE 2 attacks... This is also why, in some missions, the enemy attacks right away.)

About the second AI player:

Again, that's a mistake in Remake, as the attack repeats itself over and over again and Remake takes more and more troops to attack with (if I may guess: not the whole army comes at the same time, but the groups attack one by one until they all attack?). I see you used a TYPE 0 attack already. If this attack is meant to be an attack at the start of the game, I suggest creating a whole new AI player that only starts with the attacking army and nothing else. Let them attack and use a TYPE 2 attack with TAKE_ALL. Succes guaranteed. However, repeating attacks such as TYPE 0 or TYPE 2 attacks without TAKE_ALL will still be easy to stop as long as you kill 1 unit of the attack and then intercept them. They will then retreat to the AI's village until they have enough troops again (which is pretty soon if you only kill one unit, but if you use loads of towers and then use one unit to intercept, it will be very easy). I'm afraid it is impossible to deal with this using static scripts. If you really want to solve it, I refer to dynamic scripts, although that's far more complicated.
<<

Strangelove

User avatar

Crossbowman

Posts: 230

Joined: 30 Jul 2013, 06:32

KaM Skill Level: Fair

Post 03 Aug 2013, 20:55

Re: AI does not seem to attack

Wow and again you are my savior! I finally get it. I never understood the difference of "Front Line" and "Back Line". I tried just setting the Lancers to Backline and made them attack which worked. So I guess they only attack if they finished the have the told size. I will play around with that and see how it turns out, but i think i get it now!

About the 2nd and 3rd AI: They are just passive and wont attack. I just wanted to test something, thats why i told them to attack.

Thanks for the help again!
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 03 Aug 2013, 21:02

Re: AI does not seem to attack

You're welcome. Static scripts are a bit outdated, so I am glad my knowledge about them is still a bit useful. :P

A tip: you can set up 'clever' defences for the AI by playing with the importance and defence radius of defence positions. If a group that's guarding a defence position with importance 0 leaves that position, a group from a less important position will take over. So if you place defence positions with importance 0 at the entrances to the AI's village, the other soldiers will automatically help defend there. Of course you can also set a large defence radius, but this is not always possible due to the human player being too close (if the AI attacks and the human player is within the defence radius, the AI thinks that he is under attack and will send help to defend; even though this seems to be an attack :P).

Good luck!
<<

Strangelove

User avatar

Crossbowman

Posts: 230

Joined: 30 Jul 2013, 06:32

KaM Skill Level: Fair

Post 03 Aug 2013, 21:22

Re: AI does not seem to attack

Yeah I have noticed. :P I hope they include the defence positions and attacks in the dynamic script soon. I have to admit that I am not very good at programming either, but its still less confusing than the static one. :P

Thanks for your useful help and tips again! :)
<<

Lewin

User avatar

KaM Remake Developer

Posts: 3822

Joined: 16 Sep 2007, 22:00

KaM Skill Level: Skilled

ICQ: 269127056

Website: http://lewin.hodgman.id.au

Yahoo Messenger: lewinlewinhodgman

Location: Australia

Post 04 Aug 2013, 03:35

Re: AI does not seem to attack

In hindsight "front line" and "back line" are not good names, I shouldn't have called them that in my mission editor :P "Can attack" and "Can't attack" or something would probably result in less confusion. Maybe they should be renamed to this in the Remake editor? Front/back line has no other effect than whether or not they can attack.
<<

dicsoupcan

Moorbach's Guard

Posts: 1314

Joined: 12 Feb 2012, 21:36

KaM Skill Level: Fair

Post 04 Aug 2013, 03:47

Re: AI does not seem to attack

In hindsight "front line" and "back line" are not good names, I shouldn't have called them that in my mission editor :P "Can attack" and "Can't attack" or something would probably result in less confusion. Maybe they should be renamed to this in the Remake editor? Front/back line has no other effect than whether or not they can attack.
how about attack/defense?
You have enemies? Good. That means you've stood up for something, sometime in your life. ~ Winston Churchill
<<

Ben

User avatar

Former Site Admin

Posts: 3814

Joined: 08 Jan 2009, 23:00

Location: California - Pacific Time (UTC -8/-7 Summer Time)

Post 04 Aug 2013, 05:01

Re: AI does not seem to attack

I actually prefer Lewin's suggestion. It's more descriptive.
I used to spam this forum so much...
<<

Strangelove

User avatar

Crossbowman

Posts: 230

Joined: 30 Jul 2013, 06:32

KaM Skill Level: Fair

Post 04 Aug 2013, 07:02

Re: AI does not seem to attack

I do prefer Lewin's suggestion as well. Would've spared me a lot of trouble. :P
<<

dicsoupcan

Moorbach's Guard

Posts: 1314

Joined: 12 Feb 2012, 21:36

KaM Skill Level: Fair

Post 04 Aug 2013, 13:17

Re: AI does not seem to attack

fair enough, as long as it is more clear it is fine by me.

Oh and you might already know this, but if the ai messes up their positions check if autodefense is turned off. that worked for me.
You have enemies? Good. That means you've stood up for something, sometime in your life. ~ Winston Churchill

Return to “Map Design”

Who is online

Users browsing this forum: No registered users and 18 guests