Avatar / Tactician / My Unit

Avatar / Tactician / My Unit

Overview

This allows in-game customization of a character.
mGBA_5rS2Gpq2gQ

Display whichever options you want players to customize:

Make your choices and enjoy your self-insert, or become a bad archer.
mGBA_8tE7EZSu96

The portraits here are with permission from Garytop. Their excellent artwork can be found here:

Setting Up

Download the avatar folder using gitzip or by downloading the whole repo.

1. Prepare your portraits

Summary

  • Your avatar portraits should share the same palette order for hair and skin. E.g. If Corrin’s lightest colour of hair uses pal index 7, then Robin’s lightest hair colour also needs to be index 7.

  • They do not need to have identical colours, but certain colours will be replaced ingame depending on your setup.

  • Often 1, 2, and 3 are skin colours, while 7, 8, and 9 are hair colours. (Add 1 if using FEBuilder’s palette editor, as it counts from 1 instead of 0.)

  • For each character (and optionally hairstyle), name your images as NameA_01, NameA_02, NameB_01, NameB_02, etc. and put them into the portrait_hairstyles folder.

Without multiple hairstyles:

With multiple hairstyles:

  • Copy your base character, create any recolours, and put them into portrait_recolours.

  • These recolours will be applied to all your avatar portraits ingame.

  • Warning: Each image in portrait_hairstyles and portrait_recolours will use a global flag, which can add up quickly.

  • Run GetPals.bat or GetPals.py, which makes GeneratedInstaller.event based on the portraits you’ve put into these folders. It also tells you how many global flags you’re using. You only need to edit GeneratedInstaller.event if you want to add more to DynamicPortraitTable (more on that later) or PortraitPalReplacements, which allows changing specific colours of portraits if the corresponding flag is on.

PortraitPals(0x101, 0x103, 0xC1, rgb(31, 31, 25), rgb(31, 25, 16), rgb(29, 19, 12), skip, skip, skip, skip, skip, skip, skip, skip, skip, skip, skip, skip)
(For mugs 0x101 - 0x103, overwrite colour IDs 1, 2, and 3 if flag 0xC1 is on. This is the skin tone being changed.)

2. Prepare your rom

Summary

  • In Installer.event, edit #define StartingMug 0x101 to whatever ID you started with.

  • If the UnInstall SkillSystems RandomMugs patch is available to install, then do so:

  • If you have Scraiza’s DynamicPortraits installed, uninstall it:


    (It will be installed with this hack.)

  • If you want to keep what you have for DynamicPortraits, then open the editor, double click the Selected Address box, then Dump Displayed List to EA format and save this.

  • Delete the PUSH, ORG, and POP lines, and copy the rest into the end of DynamicPortraitTable in GeneratedInstaller.event.

3. ReplaceText

Summary

Having the #include "ReplaceText/Installer.event" line adds pronoun text control codes. (If you don’t want it, comment out this line with // and change the definitions for the flags to 0, e.g. #define TheyPronounFlag 0.)

By writing [them] in your dialogue, it’ll become them, him, or her ingame based on the player’s choice of pronoun.



Also adds these codes to make conditional dialogue easier:
[ifFlagXXX][endif] // replace XXX with flag e.g. 0B0 is casual mode
[ifAliveXX][endif] // replace XX for 01 for Eirika
[ifDeadXX][endif]
[ifMissingXX][endif]

Feel free to add more pronouns or find other uses for control codes that vary the text based on global flags.

4. Configure Installer.event

Summary

There are some definitions and labels that you may wish to edit.

StartingFlag is the global flag you want to start at, and it’ll use subsequent flags for each character, hairstyle, and recolour you have. Running GetPals tells you how many flags you’re using and overwrites GeneratedInstaller.event.

AvatarClasses lets you choose which classes your avatar can start as. I recommend loading your avatar unit in a wimpy class before calling this menu.

AssetBonusPerStat and FlawLossPerStat allow you to choose how much each stat should be adjusted by when choosing an asset/flaw.

Various options can be hidden by changing IsXAvailable to 0 instead of 1. E.g.

IsFlawAvailable:
WORD 0 // Players cannot choose a flaw

5. Insert & Test

Summary

Make sure you have the latest ColorzCore in Febuilder/App/Event Assembler.
image

In advanced editorsinsert ea, choose Installer.event.

In the folder with your rom, romname.event_assembler.sym should appear. Open it and ctrl+f StartBmAvatar.

image
Copy the address (in my case, it’s 09E428CD) and use it in your events to start the avatar menu.


Finally, test it ingame and only save your rom when you’re satisfied with the results.

Enjoy!

54 Likes

Haiiii. I believe I’ve neverr replied in a FEU thread. Anyway.
I thank you soo much for this, I’ve been working on a rom with an avatar and I had this dilemma with the portrait customization. You’re my savior. Thanks again.

3 Likes

First of all, this is amazing!

Also. I wanna ask something a bit technical:
Would it not be easier to store the portrait, palette, and pronoun values as Counters instead of Global Flags? Because Counters are not Binary. Or are they not stored globally?

Alternatively, would it be possible to remove BWL data, and store the Avatar values in that newly allocated space?

3 Likes

Global flags is the most convenient way for most people. If you’re low on flags, you can just expand them:

Summary

https://github.com/Veslyquix/Pokemblem/blob/1.20/EngineHacks/Necessary/ExpandedModularSave/NewFlag.asm

Ems:
DeclSaveChunk($2229, PokemblemRamSize, SavePokeSuspend, LoadPokeSuspend)

And there are some definitions in customdefinitions.event.

If you aren’t sure how to do this, make a question thread about it.

7 Likes

Ah, you’re loading the different portraits manually. This makes sense, but I still wonder if there’s a way to be more dynamic about it if the palette slots are consistent, not only for skins and hairs, but so different weapons have their colors in battle animations.

Either way, this is still very cool.

This hack doesn’t touch battle animation palettes. I’m not sure what patches there are related to that, but each hair / skin colour uses a global flag, which should make it easy to use with any relevant patches.

In case it wasn’t clear - different characters and their hairstyles each use a portrait. But recolours of hair / skin do not use more portraits in your rom, as having every combination of character, hair style, hair colour, and skin colour would be way too many. It applies each recolour to your avatar portraits if the associated flag is on, and it can handle multiple flags at once to change the hair, skin, eye, etc. colour simultaneously.

1 Like

If the portrait palette is applied dynamically, would it then be possible to also dynamically apply palettes to Battle Anims, corresponding to the same flags?

1 Like

This is a really awesome thing to have! But for some reason I can’t seem to get it to work properly.
I installed the patch with the standard things that were already in there with FEbuilder to a clean rom without any changes made to it but when going into the “Portrait” option, I can’t change anything. I just have female Corrin with the brown skin as the only option.

From what I understand is that you are supposed to be able to change the look while on the option with the left and right arrow keys. But when pressing them, nothing really happens.

If this helps maybe it can be related to something I thought about:

  • I didn’t set Eirikas portrait to the first Corrin portrait. I forgot that when I run the rom. But I think that this only matters for the dynamic portrait patch at the end.
  • My FEBuilder is outdated. I use a version from april 9, 2025. Maybe that can be a factor. Then I have to try using it with a newer version.
1 Like

@Nathan you’re right, I was able to reproduce that behaviour in another environment. I’m not sure why it was working fine on my testing rom and not all roms, but I’ve resolved the issue now. It was to do with the % modulo operator. (It’s always %!)

3 Likes

Sounds like typical math problems you encounter in school :rofl:
But glad to help! Is the code already updated or can it simple be changed in my own files by editing a line?

1 Like

Not much changed, but you’ll need to overwrite C_code.lyn.event

You can ctrl+a and copy this file below and paste it over c_code.lyn.event in notepad.

https://raw.githubusercontent.com/Veslyquix/ASM/refs/heads/main/Avatar/C_Code.lyn.event

1 Like