[FE8] What exactly is character unit struct byte 0x46 used for?

Teq’s doc says it’s “something about how many allies there are within 8-square radius”, but I’m curious if it’s ever safe to write and store data in like 0x47 seems to be.

I did some digging in Stan’s FE6 decomp and it seems to be used by AI when pillaging. Not sure where else it’s used or if it’s even still used in FE8.

Code I looked at:

2 Likes

Ah, I didn’t know about this. Looks like it’s used in FE8 too for something similar?

INSTRUCTION $10: Try Do Special Items; or moving towards looting point and loot
+00 | byte | fixed $10
+03 | byte | number of sucessful loots before advancing script (0 = no limit) (uses [Unit+46] byte)

From DOC/AiStuff.txt at master · StanHash/DOC · GitHub

I can’t fully understand what causes instruction $10 to run, but it looks like it’d only be read/written to if the unit is trying to steal stuff or use a special item? I guess it would be possible to make it so that this routine always returns 0 and skips the 0x46 stuff, but I can’t tell how to do that from there.

I think if you want to be confident that it’s safe to use, you need to spend a while playing the game with a break point on each unit’s +0x46 byte of unit struct.

1 Like