Page 1 of 1

The Peasants Rebellion - Why doesn't the AI attack?

PostPosted: 23 Nov 2007, 16:53
by Litude
I admit, I'm no expert at scripting (despite writing a documentation on it :D). This thing I've always been wondering about is why the AI does not attack at all in The Peasants Rebellion campaign? Is the piece of script that normally triggers an attack missing (something like !ATTACK_POSITION or whatever it was called) from all missions in The Peasants Rebellion campaign, or?

It is obvious that the AI has unintentionally been made passive in the campaign. My proof is e.g. the second message that is sent to you on the fourth mission:
"You must, under all circumstances, protect the village in the south from enemy attacks."

Quite an easy task when they never attack, isn't it? :D It would theoretically be possible to remedy the situation, right?

PostPosted: 23 Nov 2007, 17:05
by merchant_992
Maybe it is just because TPR was a project with way too little time. So they hadn't the time to build in attacks.
And it should be possible to build in attacks. The engine can attack, just look at the TSK campaign.

PostPosted: 23 Nov 2007, 17:07
by Litude
Yeah, I guess it is so, but you don't happen to know the exact problem? I think !ATTACK_POSITION triggers these attacks and haven't found anything as of yet from TPR campaign, so is this the error?

EDIT:
Hmm, found something interesting:
"!SET_AI_ATTACK TYPE 2
!SET_AI_ATTACK TOTAL_AMOUNT 48
!SET_AI_ATTACK TAKEALL
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 0"
Could this be the script piece that does not work... :?: Need to do some tests!

PostPosted: 23 Nov 2007, 17:31
by merchant_992
I am not so good at scripting so I don't know that. If that is the only problem, it would be very careless work of joymania.

PostPosted: 23 Nov 2007, 17:44
by Litude
It's not like this would be the only careless thing they did in the game :D I think I found out the problem. There should be an attack position specified in that piece of the script, but it seems to be absent.

PostPosted: 23 Nov 2007, 17:46
by merchant_992
So just a few lines of text per mission, than would the whole campaign be a lot nicer.

PostPosted: 23 Nov 2007, 18:04
by Litude
Bah, I don't get it! Just figured out that this TARGET 2 value meant that it calculates the attack position from the start position... Oddly enough the start position exists so the problem has to be elsewhere... I hope someone experienced knows what the problem is (Merchator, Lewin, The Dark Lord, anyone? :D), or otherwise I will have to test it out myself.

Lewin to the rescue............ ;)

PostPosted: 24 Nov 2007, 00:45
by Lewin
Bah, I don't get it! Just figured out that this TARGET 2 value meant that it calculates the attack position from the start position... Oddly enough the start position exists so the problem has to be elsewhere... I hope someone experienced knows what the problem is (Merchator, Lewin, The Dark Lord, anyone? :D), or otherwise I will have to test it out myself.
Ok, my first suggestion would be to open the mission in my editor, click anywhere in the attack you are not sure about and then press CTRL+E. This will show you what that attack does, and let you change stuff. :)
BTW: Did anyone know about that feature? It's really useful.
For all you lazy people, I have done that. :wink: (with the bit that Litude posted)
The attack says that it will continue for the whole level (not a once off), and that it will attack the closest building from the start position, and that the attack will happen once the army size gets to 48 men total, and they will take all of there troops that are not in the front line. (protection the base)
The problem might be that the army never reaches 48, as there is not enough !SET_AI_DEFENSE commands telling them where to place groups. :(
It also might be that I am completely wrong about all this, :wink: I haven't tested everything, most of it is based off what Nick said.
So to fix it, you could make the number of men needed lower, or you could set more spots to place men for the AI. If you are still unsure, please post again and ask me. :wink:
!ATTACK_POSITION has nothing to do with that, it will make troops attack a building at the game start.
Oh, and if anyone is interested, I am now making the GUI!
Lewin.

Re: Lewin to the rescue............ ;)

PostPosted: 24 Nov 2007, 09:31
by Litude
The problem might be that the army never reaches 48, as there is not enough !SET_AI_DEFENSE commands telling them where to place groups. :(
Hmm... I think I already tried setting this AMOUNT to 1 and yet they didn't attack. Well, need to do some further tests!

EDIT:
Thanks to The Dark Lord, I finally figured this out. The TYPE 2 attack cannot be the first attack that the AI is supposed to do, or otherwise this piece of script will never work! I don't think your mission editor knows how to handle this, Lewin! :D