I know what the growth rates for generic enemies are in FE5, and I have found them inside the game’s data with a hex editor. However I do not know how the game determines which enemy gets what set of growths. Does anyone know and how do I change it?
Have a few NMMs.
You’d edit and assign growths exactly the same you you’d do it in GBAFE. Each character (including generic enemies) has an entry in the character data table that governs their base stats, which’re added to their class bases, and growths which are used when leveling them.
Thanks, one more question. Enemies stats vary by +/-3, how can I change it so there is no variation to generic enemy stats and that they strictly follow the designated growths?
All offsets are unmapped
Change the $04s at
all to either $00 or $01 (setting them to $01 should roll for their first level, but don’t quote me on that)
$0A at $1AAAA
$02 at $1AAB8
in the same routine, but I haven’t messed with them, so your results with playing them may vary.
I haven’t done any real research into these, just found the routine because you asked.
Thanks, I tried it out and changed the $04s to $00, however enemy stats still have a very noticeable variation. I’ve also noticed that some enemy stats are affected by changing their growths in the character nnms specifically those like Manster Soldiers and Archers, but some don’t at all seem to indicate that connection like the Envoy enemies in chapter 5 (the ones Eyvel fights while gaurding Nanna).
You’ll need to show me some examples.
~I set all enemies to lv 20 to maximize the effect. I also be focusing only on the STR as an example so I don’t clutter things with numbers. Results are based off units in Ch5. This was done on a clean rom with a header.
~Here are the results of my tests on the $04 numbers. I did 3 trials each for the 5 Manster Archers surrounding the boss and 5 trials for the Mercenary in the center area.
Manster Archers ($04)
9, 6, 8
7, 5, 11
5, 13, 8
7, 8, 9
9, 10, 5
Manster Archers ($01)
6, 4, 6
6, 4, 11
9, 8, 6
4, 7, 7
5, 6, 11
Manster Archers ($00)
7, 7, 5
8, 9, 8
7, 8, 4
5, 6, 6
6, 8, 7
Envoy Mercenary ($04)
14, 14, 12, 15, 15
Envoy Mercenary ($01)
10, 8, 12, 12, 15
Envoy Mercenary ($00)
14, 12, 9, 16, 11
~As you can see there is no significant difference aside from perhaps the average being lower for $01 and $00, but that easily could be a result of not having enough trials. The main point is that the enemies, regardless of the change, still have a wide range of stat variation.
~Here are the results of me testing out growth changes. I did this test second so the $04s were still set to $00. I set STR growths to 150% with the default value having been 0%. I didn’t have to do much to see that it had no affect.
6, 8, 4, 4, 6
~Again, there’s no difference, if changing this part was suppose to alter enemy stats, than the STR should have seen an immediate skyrocket in value, especially with the Archers.
Try removing the header and go to those locations again.
Poking around a bit more, growths aren’t read by the autolevelling routine. I’ll do some more searching tomorrow, but it seems likely that you’ll need some asm to do what you want.
As suspected, the autolevelling function is quite a mess. To flag a unit for autolevelling, set their base HP to be one of a few specific values. These values specify which set of ‘growths’ to use when levelling a unit.
VAL HP STR MAG SKL SPD DEF BLD LUK MOV $FF 50 20 3 15 10 15 15 10 0 $FE 30 3 20 10 10 5 5 10 0 $FD 70 20 0 15 15 10 20 10 0 $FC 70 25 5 25 20 25 25 20 0 $FB 50 5 25 20 20 10 10 20 0 $FA 90 25 3 25 25 20 40 20 0 $F9 75 50 50 50 35 35 40 20 0 $F8 45 25 25 70 70 25 20 50 0 $F7 50 20 3 15 10 15 0 10 0
These growths are at $888246 (mapped, unheadered) and are preceded by a short pointer table with a pointer to each.
The formula the game uses to determine which pointer to the set of growths to use is:
(((val XOR $FF) + $01) << $01) + $888232
There’s quite a bunch more going on here, including the stuff I had you try before, which removes the initial variance. If you really want enemies that follow their growths, you’ll have to learn 65816 or wait for me to write a fix myself.
Quick fix: along with zeroing out the $04s and the $0A listed above (not the $02 though), write
00 7e 85 30 a9 15 51 85 2f ea ea ea ea ea ea ea ea ea ea ea ea ea
Original routine stuff
func_83AAE0 .al .xl jsl $83E033 ; clear $64-$6C - not used??? lda #$8882 ; upper part of table sta $30 lda $510A ; get negative number (base HP byte) eor #$FFFF inc ; NOT base HP and #$00FF asl tax lda $888232,x ; get lower pointer part sta $2F
func_83AAE0 .al .xl jsl $83E033 ; clear $64-$6C - not used??? lda #$7E00 sta $30 lda #$5115 ; $7E5115 start of growths in buf sta $2F nop nop nop nop nop nop nop nop nop nop nop nop nop
You could swap out that mess of
nops for a branch, but I wrote this fix in
straight binary and didn’t want to calculate the branch.
Unless I made a mistake, enemies should have their class base stats at level 1 and should gain stats based on their level thereafter. Arena enemies are going to be weak using the vanilla stats/growths.
Here’s a level 1 goon with 100 growths
and his level 10 companion
I’m working on a thing that’ll optionally add character bases, but it’ll take some freespace.
Thanks for all the help, managing enemy growths is now infinitely easier.
only one question i have, do generic bosses autolevel with this routine? Or do they simply use character and class bases.