

Salamandre
Admirable
Omnipresent Hero
Wog refugee

posted December 16, 2014 08:18 PM 


I used this to get how more % our army is powerful:
;v7 our army AI value
;y9 neutrals army value
!!VRy10:Sv7*100:y9; set y10 to v7, multiply by 100 then divide by y9. Am I on the right way at least?
____________
All my Era II mods


AlexSpl
Responsible
Famous Hero

posted December 16, 2014 08:21 PM 


You may not even care about how powerful is your army. Just look at this simple maths:
a/b = c/d is equivalent to a*d = b*c.


Salamandre
Admirable
Omnipresent Hero
Wog refugee

posted December 16, 2014 08:24 PM 


Now even more confused. I started my script to match the doc file which says to find neutrals then our army AI values. Then set the percentage. Your first example on previous page uses maths operations i can't use in erm so I have to stick to this:
0 – 50% 7
50 – 67% 7
67 – 100% 6
100 – 150% 5
150 – 200% 4
> 200% 3
____________
All my Era II mods


AlexSpl
Responsible
Famous Hero

posted December 16, 2014 08:28 PM 

Edited by AlexSpl at 20:31, 16 Dec 2014.

For example,
V1 = Army_Power
V2 = Neutrals_Power
then
Quote: k < 0.5 then 7 stacks
0.5 <= k < 0.67 then 6 stacks
...
is equivalent to
V1/V2 < 1/2 then 7 stacks
1/2 <= V1/V2 < 67/100 then 6 stacks,
...
or
2*V1 < 1*V2 then 7 stacks,
1*V2 <= 2*V1 and 100*V1 < 67*V2 then 6 stacks,
and so on ...


Salamandre
Admirable
Omnipresent Hero
Wog refugee

posted December 16, 2014 08:33 PM 



AlexSpl
Responsible
Famous Hero

posted December 16, 2014 08:37 PM 


R4 = 41 tells you only that Deviation = 0. First, you should find the basic splitting.


Warmonger
Promising
Legendary Hero
fallen artist

posted December 16, 2014 08:37 PM 


Quote: The Splitting Problem
1. Find both Army_Power and Neutrals_Power. They are just the sum of AI values of all creatures in the corresponding armies. A powerful hero at your side doesn't change anything.
2. Find k = Army_Power / Neutrals_Power.
3. Determine the basic splitting:
k < 0.5 then 7 stacks
0.5 <= k < 0.67 then 6 stacks
0.67 <= k < 1 then 5 stacks
1 <= k < 1.5 then 4 stacks
1.5 <= k < 2 then 3 stacks
k >= 2 then 2 stacks
Note:
Here all the floating point numbers are of double precision, or type; sizeof(double) = 8 bytes.
4. Find the actual splitting:
1. R1 = a*x + b*y + c*z + d
2. R2 = R1 / 65536 (integer division here!)
3. R3 = R2 % 32768
3a. If R3 < 0 then R3 = R3 + 32767
4. R4 = R3 % 100 + 1
Where:
a = 1550811371
b = 935900487
c = 1943276003
d = 1120346418
Then,
if R4 <= 20 decrease the number of stacks by 1
if R4 >= 80 increase the number of stacks by 1 unless you have already 7.
Awesome, now we know everything.
Still, it looks like very elaborate way to solve a simple problem
____________
The future of Heroes 3 is here!


Salamandre
Admirable
Omnipresent Hero
Wog refugee

posted December 16, 2014 08:38 PM 


The basic splitting is 4 because of 200% power difference, according to document. Maybe he missed >=200, because I get 3 stacks.
@Edit: no, actually I get 2 stacks when attacking, wtf
____________
All my Era II mods


kicferk
Known Hero

posted December 16, 2014 08:40 PM 

Edited by kicferk at 20:42, 16 Dec 2014.

You got 3 stacks in game? That would hurt...
Try with 89, I hope you get 2 stacks.


AlexSpl
Responsible
Famous Hero

posted December 16, 2014 08:41 PM 

Edited by AlexSpl at 20:42, 16 Dec 2014.

Quote: The basic splitting is 3 because of 200% power difference.
According to my table, the basic splitting is 2 when k >= 200%. How many stacks do you see?


Salamandre
Admirable
Omnipresent Hero
Wog refugee

posted December 16, 2014 08:41 PM 


2, edited. What is the accurate table, please give me so I can add the calculations.
____________
All my Era II mods


AlexSpl
Responsible
Famous Hero

posted December 16, 2014 08:43 PM 


Quote: Still, it looks like very elaborate way to solve a simple problem
That's the reality when you have to deal with RNGs


Salamandre
Admirable
Omnipresent Hero
Wog refugee

posted December 16, 2014 08:46 PM 


k < 0.5 then 7 stacks
0.5 <= k < 0.67 then 6 stacks
0.67 <= k < 1 then 5 stacks
1 <= k < 1.5 then 4 stacks
1.5 <= k < 2 then 3 stacks
k >= 2 then 2 stacks
ok got it. Now going to write the thing.
____________
All my Era II mods


Salamandre
Admirable
Omnipresent Hero
Wog refugee

posted December 16, 2014 08:55 PM 


Looks like is working well, here is for test. I recommend Trainer mod for fast army modifications:
ZVSE
;right click on any monster to see its split.
!?CM0;
!!CM:P?y2/?y3/?y4; get location of click
!!OBy2/y3/y4:T?y5 U?y6;
!!FU&y5<>54:E;
!!MOy2/y3/y4:G?y7;
!!MA:Iy6/?y8;
!!VRy9:Sy7*y8; get AI value for stack
!!OW:A1/?y1;
!!FU&y1<0:E;
!!VRv7:S0; initialize v7
!!DO135892/0/6/1:Py1;
!!VRy10:Sv7*100:y9;
!!VRy11:S1550811371;
!!VRy12:S935900487;
!!VRy13:S1943276003;
!!VRy14:S1120346418;
!!VRy15:Sy11*y2;
!!VRy16:Sy12*y3;
!!VRy17:Sy13*y4;
!!VRy18:Sy15+y16+y17+y14;
!!VRy19:Sy18:65536;
!!VRy20:Sy19%32768;
!!VRy20&y20<0:+32767;
!!VRy21:Sy20%100+1;
!!VRy22&y10<50:S7;
!!VRy22&y10>=50/y10<67:S6; [read table]
!!VRy22&y10>=67/y10<100:S5;
!!VRy22&y10>=100/y10<150:S4;
!!VRy22&y10>=150/y10<200:S3;
!!VRy22&y10>=200:S2;
!!VRy22&y21<=20:1; [R4 final corrections]
!!VRy22&y21>=80:+1;
!!IF:Q1/21/y6/4^%Y22 stacks^;
!!CM:R0;
!?FU135892;
!!HEx1:C0/x16/?y1/?y2;
!!FU&y1<0:E;
!!MA:Iy1/?y3; get AI value
!!VRy4:Sy2*y3;
!!VRv7:+y4;
____________
All my Era II mods


AlexSpl
Responsible
Famous Hero

posted December 16, 2014 09:12 PM 

Edited by AlexSpl at 21:13, 16 Dec 2014.

Also, take care of the following cases:
1. You have 7 stacks according to the table, still you have to add 1 stack due to Deviation, just don't.
2. You have less creatures than stacks in the actual splitting. For example, 3 orcs cannot divide themselves to fit 7 stacks


Salamandre
Admirable
Omnipresent Hero
Wog refugee

posted December 16, 2014 09:22 PM 


Yeah I forgot, will add those checks for final, thanks.
The first case needs only one fix, but the second is a bit longer to do.
____________
All my Era II mods


AlexSpl
Responsible
Famous Hero

posted December 16, 2014 09:25 PM 


Why, just compare the number of neutrals with the number of stacks. If less, #stacks = #neutrals.


Salamandre
Admirable
Omnipresent Hero
Wog refugee

posted December 16, 2014 09:38 PM 


Sorry just being lazy, it was longer because I have to type a line instead of one character, both fixed.
ZVSE
;right click on monsters stack to get split
!?CM0;
!!CM:P?y2/?y3/?y4; get location of click
!!OBy2/y3/y4:T?y5 U?y6;
!!FU&y5<>54:E;
!!MOy2/y3/y4:G?y7;
!!MA:Iy6/?y8;
!!VRy9:Sy7*y8; get AI value for stack
!!OW:A1/?y1;
!!FU&y1<0:E;
!!VRv7:S0; initialize v7
!!DO135892/0/6/1:Py1;
!!VRy10:Sv7*100:y9;
!!VRy11:S1550811371;
!!VRy12:S935900487;
!!VRy13:S1943276003;
!!VRy14:S1120346418;
!!VRy15:Sy11*y2;
!!VRy16:Sy12*y3;
!!VRy17:Sy13*y4;
!!VRy18:Sy15+y16+y17+y14;
!!VRy19:Sy18:65536;
!!VRy20:Sy19%32768;
!!VRy20&y20<0:+32767;
!!VRy21:Sy20%100+1;
!!VRy22&y10<50:S7;
!!VRy22&y10>=50/y10<67:S6;[read table]
!!VRy22&y10>=67/y10<100:S5;
!!VRy22&y10>=100/y10<150:S4;
!!VRy22&y10>=150/y10<200:S3;
!!VRy22&y10>=200:S2;
!!VRy22&y21<=20:1; [R4 correction]
!!VRy22&y21>=80/y22<7:+1; [if less than 7, add 1]
!!VRy23:Sy7y22; [subtract splits # from neutral #]
!!VRy22&y23<0:Sy7; [set splits # to monster # if result <0 ]
!!IF:Q1/21/y6/4^%Y22 stacks^;
!!CM:R0;
!?FU135892;
!!HEx1:C0/x16/?y1/?y2;
!!FU&y1<0:E;
!!MA:Iy1/?y3; get AI value
!!VRy4:Sy2*y3;
!!VRv7:+y4;
____________
All my Era II mods


Salamandre
Admirable
Omnipresent Hero
Wog refugee

posted December 17, 2014 08:37 PM 


ok, here is a draft of how it will look when rightclick on monsters. it shows the number of stacks, it shows if there is upgraded stack, green number is total number of monsters, right number (110) is about monster stack's aggression (1/compliant, 10/savage).
I have no idea what other infos to add, anyway, both # infos are disabled by default, must configure ini file to show them because I consider cheat.


AlexSpl
Responsible
Famous Hero

posted December 17, 2014 08:44 PM 


It seems you have misplaced Grand Elves. They should be in the middle  [N/2], where N  number of stacks.


