Page 1 of 2
old stuff
PostPosted: 25 Jan 2009, 14:02
by Nick
K made a new post concerning some old stuff.
In an old topic at the beginning of .dat discovery soms commands are still not found by now...
- Code:
% ATTACK_FACTOR
.REMOVE
0 RANGE
/ MISC
5 ADD_ATTACK_MAIN_POS
6 ADD_ATTACK_SUB_POS
[/quote]
Where do these commands come from? i would like to investigate this. especially the ATTACK_MAIN_POS and ATTACK_SUB_POS
Anyone can clear this up or tell from where they come?
PostPosted: 25 Jan 2009, 14:16
by merchant_992
http://kam.vanmeijeren.nl/forum/viewtopic.php?f=8&t=799&st=0&sk=t&sd=a
http://www.atfreeforum.com/knights/viewtopic.php?t=192&mforum=knights
I think this goes back on these 2 old topics? These are probably some old scripting codes which were never used in any missions. But it isn't known if they still work.
PostPosted: 25 Jan 2009, 14:33
by Nick
indeed. seems i posted on the dutch forum already about those commands. Just forgot that it was there...
But my question still remains... where do those commands come from? as they arent used in any mission.dat and it appears to the name it should have something todo with mission.dat files.
PostPosted: 25 Jan 2009, 15:35
by harold
You can see them in the exe.
PostPosted: 25 Jan 2009, 18:35
by kuba11100
Some time ago Litude discovered that !SET_AI_ATTACK_FACTOR 200 line is in the script of mission 17 TSK, but no one knows what exactly it does.
http://www.atfreeforum.com/knights/viewtopic.php?t=312&mforum=knights
PostPosted: 25 Jan 2009, 18:46
by Nick
ill take a look...
PostPosted: 25 Jan 2009, 20:09
by Nick
k well i got some news
I tested the command: !SET_AI_ATTACK_FACTOR 200
I did many tests almost any test thats possible... No effect at all

The command simple doesnt do anything. So i was at a point to give up.
Then i tryd something else on my feeling and I was right

What if it's !SET_AI_CHARACTER ATTACK_FACTOR 200
I tryd it no result at first. I tryd it with value 0 and this was when i saw a change...
When the command !SET_AI_CHARACTER ATTACK_FACTOR 0 is used the soldiers wont move from their places.
They attack when u get to them and archers still fire when comiin close. But they won't attack you if u like 2 tiles away from them. Even if u attack with an archer they will not attack you. for the 200; so if u pay atttention, when u attack the enemy on the bottom their troops on top of the map will also come, i guess thats the 200
I don't know the values of the command but as far as i know the command: !SET_AI_ATTACK_FACTOR 200 doesnt exist
the command !SET_AI_CHARACTER ATTACK_FACTOR 200 however works. Now is my question. How is this possible if the value in the .exe only contain !SET_AI_ATTACK_FACTOR? [EDIT: i see the value in the exe is ATTACK_FACTOR so the devs used the wrong scripting command in their own mission lol)
Anyway i wont test the values of the command cuz i have to study some more...
I'm not rly excited at the action of the command but now i know that maybe those other unused commands will maybe work, even as they arent used
PS: the test was done on a tactic mission with no defense positions
PostPosted: 25 Jan 2009, 20:41
by Nick
Next command revealed is RANGE
This command can be used in attacks
!SET_AI_ATTACK RANGE 140
If this is set in an attack the AI will only attack withing the range of 140 tiles
This command is extremely handy for defending.
For exemple:
- Code:
!SET_AI_ATTACK TYPE 2
!SET_AI_ATTACK TOTAL_AMOUNT 1
!SET_AI_ATTACK RANGE 50
!SET_AI_ATTACK TROUP_AMOUNT 0 0
!SET_AI_ATTACK TROUP_AMOUNT 0 1
!SET_AI_ATTACK TROUP_AMOUNT 0 2
!SET_AI_ATTACK TROUP_AMOUNT 0 1
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 1
[/quote]
The enemy will now send 1 troup of horses when u come too close to his base (starting point). This is a solution to the kite abusing. Pulling the enemy to your base
PostPosted: 25 Jan 2009, 23:19
by Nick
sry, no succes for
ADD_ATTACK_MAIN_POS
ADD_ATTACK_SUB_POS
tryd alot of possibilities...
Is there a way u can see in the exe how mana parameters these commands have? Or a guess. It would make it easier for me as for now it cal be anything :S
PostPosted: 26 Jan 2009, 12:39
by Litude
Next command revealed is RANGE
This command can be used in attacks
!SET_AI_ATTACK RANGE 140
If this is set in an attack the AI will only attack withing the range of 140 tiles
This command is extremely handy for defending.
For exemple:
- Code:
!SET_AI_ATTACK TYPE 2
!SET_AI_ATTACK TOTAL_AMOUNT 1
!SET_AI_ATTACK RANGE 50
!SET_AI_ATTACK TROUP_AMOUNT 0 0
!SET_AI_ATTACK TROUP_AMOUNT 0 1
!SET_AI_ATTACK TROUP_AMOUNT 0 2
!SET_AI_ATTACK TROUP_AMOUNT 0 1
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 1
[/quote]
The enemy will now send 1 troup of horses when u come too close to his base (starting point). This is a solution to the kite abusing. Pulling the enemy to your base[/quote]
Wow! :shock: So you mean that putting a TYPE 0 or TYPE 2 attack of this type and adding the range pretty much prevents sneaking into base? Now that could be a real problem solver! :)
PostPosted: 26 Jan 2009, 13:56
by Nick
yes it does

tryd it... i set the range just far enough of 12 tiles away from the first defense soldiers of the enemy. Then i came with my crossbowman and suddenly a group of knights came kill it before i could get away or kite them
It's still possible to use normal attacks btw so it's a very handy command
- Code:
!SET_AI_CHARACTER TROUP_PARAM 0 12 4
!SET_AI_CHARACTER TROUP_PARAM 1 12 4
!SET_AI_CHARACTER TROUP_PARAM 2 12 4
!SET_AI_CHARACTER TROUP_PARAM 3 12 4
!SET_AI_ATTACK TYPE 1 // needed for the type 2
!COPY_AI_ATTACK 0
!SET_AI_ATTACK TYPE 2
!SET_AI_ATTACK TOTAL_AMOUNT 45
!SET_AI_ATTACK TAKALL
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 1
!SET_AI_ATTACK TYPE 2
!SET_AI_ATTACK TOTAL_AMOUNT 1
!SET_AI_ATTACK RANGE 53
!SET_AI_ATTACK TROUP_AMOUNT 0 0
!SET_AI_ATTACK TROUP_AMOUNT 1 0
!SET_AI_ATTACK TROUP_AMOUNT 2 0
!SET_AI_ATTACK TROUP_AMOUNT 3 1
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 2
[/quote]
I thought i had succes yesterday with the REMOVE command but i had to study so i will test tomorrow when my last exam is done :D
What i think REMOVE does is the following. Lets take the same code from above.
[code]
!SET_AI_CHARACTER TROUP_PARAM 0 12 4
!SET_AI_CHARACTER TROUP_PARAM 1 12 4
!SET_AI_CHARACTER TROUP_PARAM 2 12 4
!SET_AI_CHARACTER TROUP_PARAM 3 12 4
!SET_AI_ATTACK TYPE 1 // needed for the type 2
!COPY_AI_ATTACK 0
!SET_AI_ATTACK TYPE 2
!SET_AI_ATTACK TOTAL_AMOUNT 45
!SET_AI_ATTACK TAKALL
!SET_AI_ATTACK REMOVE 3 1 // they will take all avaible soldiers but will leave 1 group of horses avaible....
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 1
!SET_AI_ATTACK TYPE 2
!SET_AI_ATTACK TOTAL_AMOUNT 1
!SET_AI_ATTACK RANGE 53
!SET_AI_ATTACK TROUP_AMOUNT 0 0
!SET_AI_ATTACK TROUP_AMOUNT 1 0
!SET_AI_ATTACK TROUP_AMOUNT 2 0
!SET_AI_ATTACK TROUP_AMOUNT 3 1
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 2
[/quote]
When i continue the testing tomorrow i hope im true is this would be very great
PostPosted: 26 Jan 2009, 14:07
by The Dark Lord
RANGE will be useful! We can create aggressive enemies now. >: )
I might do some tests too. As I'm stubborn I can't believe it. xD
PostPosted: 26 Jan 2009, 14:10
by Nick
try to find out the main and sub pos as i'm unable to find it for now
PostPosted: 07 Feb 2009, 13:20
by The Dark Lord
I did some tests! And I found out some interesting stuff about RANGE. The first two tests prove something different though. It's about when the enemy attacks.
I did the other tests to figure out what, for example, RANGE 50 means: how far is it? how many tiles?
The answer is the following: multiply RANGE by 1.4, and you have the number of tiles. Here you can read what I did to find out:
48 soldiers from each type (12 in a group) in total. 24 of each type have defence importance 0, the other 24 have defence importance 1 (and thus are able to attack).
Test 1:
!SET_AI_ATTACK TYPE 0
!SET_AI_ATTACK TOTAL_AMOUNT 96
!SET_AI_ATTACK TROUP_AMOUNT 0 2
!SET_AI_ATTACK TROUP_AMOUNT 1 2
!SET_AI_ATTACK TROUP_AMOUNT 2 2
!SET_AI_ATTACK TROUP_AMOUNT 3 2
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 0
Nothing happened. This proves that only soldiers with defence importance 1 count in TOTAL_AMOUNT, because
!SET_AI_ATTACK TROUP_AMOUNT 0 2
!SET_AI_ATTACK TROUP_AMOUNT 1 2
!SET_AI_ATTACK TROUP_AMOUNT 2 2
!SET_AI_ATTACK TROUP_AMOUNT 3 2
means they will take 4*(2*12) = 96 soldiers when there are 100 available. There are 192 soldiers in total, but 96 of them have defence importance 0.
Test 2:
!SET_AI_ATTACK TYPE 0
!SET_AI_ATTACK TOTAL_AMOUNT 96
!SET_AI_ATTACK TROUP_AMOUNT 0 2
!SET_AI_ATTACK TROUP_AMOUNT 1 2
!SET_AI_ATTACK TROUP_AMOUNT 2 2
!SET_AI_ATTACK TROUP_AMOUNT 3 2
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 0
96 soldiers attacked. This proves test 1's proof.
Test 3:
!SET_AI_ATTACK TYPE 0
!SET_AI_ATTACK TOTAL_AMOUNT 96
!SET_AI_ATTACK RANGE 50
!SET_AI_ATTACK TROUP_AMOUNT 0 2
!SET_AI_ATTACK TROUP_AMOUNT 1 2
!SET_AI_ATTACK TROUP_AMOUNT 2 2
!SET_AI_ATTACK TROUP_AMOUNT 3 2
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 0
I first waited, but the enemy didn't attack at once, which means RANGE has at least some effect. Then I started walking, and they attacked when I was (according to my calculations) 53 tiles away.
Test 4:
!SET_AI_ATTACK TYPE 0
!SET_AI_ATTACK TOTAL_AMOUNT 96
!SET_AI_ATTACK RANGE 50
!SET_AI_ATTACK TROUP_AMOUNT 0 2
!SET_AI_ATTACK TROUP_AMOUNT 1 2
!SET_AI_ATTACK TROUP_AMOUNT 2 2
!SET_AI_ATTACK TROUP_AMOUNT 3 2
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 0
Now I wanted to see how far I could go before the enemy would attack me. One step... Another step... Hey! They're coming already! I was 70 tiles away at that time. This doesn't prove much, does it?
Test 5:
!SET_AI_ATTACK TYPE 0
!SET_AI_ATTACK TOTAL_AMOUNT 96
!SET_AI_ATTACK RANGE 50
!SET_AI_ATTACK TROUP_AMOUNT 0 2
!SET_AI_ATTACK TROUP_AMOUNT 1 2
!SET_AI_ATTACK TROUP_AMOUNT 2 2
!SET_AI_ATTACK TROUP_AMOUNT 3 2
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 0
This time I walked away from the enemy! And they didn't attack. So I walked back to my start position. Then I marched (carefully) forward... Two tiles... And the enemy attacked me. I quickly ran to the edge of the map. I noticed the hostile soldiers kept waiting at the place where I entered "their RANGE" before following me. This proves that RANGE 50 = 70 tiles?
Test 6:
!SET_AI_ATTACK TYPE 0
!SET_AI_ATTACK TOTAL_AMOUNT 96
!SET_AI_ATTACK RANGE 30
!SET_AI_ATTACK TROUP_AMOUNT 0 2
!SET_AI_ATTACK TROUP_AMOUNT 1 2
!SET_AI_ATTACK TROUP_AMOUNT 2 2
!SET_AI_ATTACK TROUP_AMOUNT 3 2
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 0
Notice I changed the RANGE this time. They attacked when I was 39 tiles away from them.
Test 7:
!SET_AI_ATTACK TYPE 0
!SET_AI_ATTACK TOTAL_AMOUNT 96
!SET_AI_ATTACK RANGE 40
!SET_AI_ATTACK TROUP_AMOUNT 0 2
!SET_AI_ATTACK TROUP_AMOUNT 1 2
!SET_AI_ATTACK TROUP_AMOUNT 2 2
!SET_AI_ATTACK TROUP_AMOUNT 3 2
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 0
Notice I changed the RANGE again. They attacked when I was 41 tiles away from them. But I was not sure if it really was 41, so I decided to do it again... But then it was 42 tiles... And I did some more tests, and in the end it was 56 tiles... For no reason I assumed the first tests were wrong... And I started to calculate:
70/50 = 1.4
39/30 = 1.3
56/40 = 1.4
So that would mean that you have to devide the number of tiles by 1.4 to discover the perfect RANGE. For my last test I decided to delete all enemy soldiers except one group of cavalry which I would place direct in front of me.
Test 8:
!SET_AI_ATTACK TYPE 0
!SET_AI_ATTACK TOTAL_AMOUNT 12
!SET_AI_ATTACK RANGE 15
!SET_AI_ATTACK TROUP_AMOUNT 0 0
!SET_AI_ATTACK TROUP_AMOUNT 1 0
!SET_AI_ATTACK TROUP_AMOUNT 2 0
!SET_AI_ATTACK TROUP_AMOUNT 3 1
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 0
I figured that if I entered RANGE 15, the scouts would attack me when I'd be 21 tiles away from them ( 1.4*15 = 21). And this was exactly what happened! To make sure it's not coincidence, I did one more test.
Test 8:
!SET_AI_ATTACK TYPE 0
!SET_AI_ATTACK TOTAL_AMOUNT 12
!SET_AI_ATTACK RANGE 20
!SET_AI_ATTACK TROUP_AMOUNT 0 0
!SET_AI_ATTACK TROUP_AMOUNT 1 0
!SET_AI_ATTACK TROUP_AMOUNT 2 0
!SET_AI_ATTACK TROUP_AMOUNT 3 1
!SET_AI_ATTACK TARGET 2
!COPY_AI_ATTACK 0
20*1.4 = 28
This test confirmed my theory.
PostPosted: 09 Feb 2009, 04:32
by Lewin
That you very much for this further research! It will help me implement this into my editor. I will probably do the conversion automatically, so users can type in 50 tiles and the editor will save the value 70 to the DAT file.
Thanks also for working out that only back line troops (importance 1) are counted in TOTAL_AMOUNT. I did not know that either, I thought the entire army was counted.
Have you done a test to see what Nick is talking about, acting strangely with more than 2 players? I would like to know what that is all about. I will test it myself as soon as I have the time, but if you already know the answer then it will save me time.
I am still not sure whether I should wait 0.9 for this. If I have time then I would like to, because it will surely be a useful feature!
Lewin.