Inserting Character/Generic Palettes with Buildfiles


#1

This tutorial assumes that you have a general knowledge of how to use EA and make buildfiles with it

Set up your palette buildfile manually

#Inserting A Palette
Inserting a character/generic class palette this can be done by using #incbin on a compressed palette hex dump

Insert with compressed hex dump `#incbin "CharaterPalette.dmp"`

The next step is to use macros to set your to the palette table
Here is the Definitions File

// Palette Definitions.txt
// Character & Gereric Class Palette Definitions File
#ifndef PalMacros
    #define PalMacros
    #ifndef PaletteTable
        #ifdef _FE6_
            #define PaletteTable 0x7FC004
        #endif
        #ifdef _FE7_
            #define PaletteTable 0xFD8004
        #endif
        #ifdef _FE8_
            #define PaletteTable 0xEF8004
        #endif
    #endif
    #ifndef BattleSpriteTable
        #ifdef _FE6_
            #define BattleSpriteTable 0x6A0008
        #endif
        #ifdef _FE7_
            #define BattleSpriteTable 0xE00008
        #endif
        #ifdef _FE8_
            #define BattleSpriteTable 0xC00008
        #endif
    #endif
    #define setPalette(index, palette) "PUSH; ORG (PaletteTable + index * 0x10); POIN palette; POP"
    //set the generic palette to a class animation
    #define setGenericPalette(index, genpal) "PUSH; ORG ((BattleSpriteTable - 0x4) + (index * 0x20)); POIN genpal; POP"
    
    //For FE8 palette Association
    #ifdef _FE8_
        #define CharClassTable $95E0A4
        #define CharPaletteTable $95EEA4
        //Set the palettes for the classes that with the same label in setCharPalette
        #define setCharPalette(char_id, trainee, base1, base2, promo1, promo2, promo3, promo4) "PUSH; ORG (CharPaletteTable + (char_id -1) * 7); BYTE trainee base1 base2; BYTE promo1 promo2 promo3 promo4; POP"
        //Set the classes for a character that will have character palettes, if in a class outside of this list, the generic palette will be used
        #define setCharClass(char_id, trainee, base1, base2, promo1, promo2, promo3, promo4) "PUSH; ORG (CharClassTable + (char_id - 1) * 7); BYTE trainee base1 base2; BYTE promo1 promo2 promo3 promo4; POP"
    #endif
#endif

#Setting a Generic Palette for a class animation
~ To be added later ~

#Setting a Character Palette
After inserting the palette as described above the next thing to do is put a pointer to the palette in the character palette table. This can be done with the macro setPalette(index, palette),

See Example
PersonPalette: //label to mark where the palette is inserted
#incbin "charpalette1.dmp" //insert palette

setPalette(0x1, PersonPalette) //put the pointer to PersonPalette into the palette table at entry 0x1

please note that the “index” is the number of the entry in the palette table reference. This number is used to tell the game which palette to use.

The next part is slightly different if you’re using FE8

FE6/FE7 For FE7 and FE6 the character palette is set in the character data table Each character gets 2 palettes, one for promoted classes and the other for unpromoted classes. If you change these numbers you change which palette is being used.
FE8 FE8 uses a different system for character palettes than the other two games. Each character gets 7 classes for which to use specific palettes. To set a character to have a character palette with a class, you set the class in one table and the palette in the other table at the same location. For example, look at the image above; Seth has paladin for his "first promotion" class and his paladin character palette for his "first promotion" palette. Through this you can see that you set the class and its matching palette for it to display in the game.

The macros setCharPalette and setCharClass are the buildfile versions of these tables. If you were to translate the image above into these macros it would be

//Seth's Palette Association Info
setCharClass(0x2, 0x0, 0x0, 0x0, 0x07, 0x0, 0x0, 0x0)
setCharPalette(0x2, 0x0, 0x0, 0x0, 0x3C, 0x0, 0x0, 0x0)

Please note that the generic palette for the class will be used if either of these conditions are met

  • if the palette for the class is set to 0x0
  • if the class the character is in is not one of the classes in the table

The Pal2EA method

Pal2EA is a tool made to generate EA files for character and generic palette insertion
This tutorial will mainly show examples on how to us pal2ea; refer to the readme for more detail on how to use the tool

how pal2ea works is you place all your palettes in a file then drag and drop the file onto the executable (or use the .py file if you prefer that)

#Generic Palettes
For our first example, let’s give the female mage in FE8 a generic palette

generic palette example
# gen{0x6C} "MageF"
//female mage generic palette, this line is a comment
5553FF7FFF6B1F4B2E198C5308430432187B5262293D392AA07A8055E03CA514 
5553FF7FFF6B1F4B2E199C5118419030187B5262293D392A3E01D5008F00A514 
5553FF7FFF6B1F4B2E19943310230C12187B5262293D392AC6330327E019A514 
5553FF7FFF6B1F4B2E19947110618C40187B5262293D392A3E3DD8306F24A514

Let’s break this down so that it’s easier to understand

  • # is the start of a new palette entry

  • gen{0x6C} means that we’re inserting the generic palette for class animation 0x6C, which is the female mage in fe8

  • // means a single line comment; everything between // and the newline will be ignored

  • the set of numbers at the end are the palette in hexadecimal. You can get this by copy pasting from a hex editor or using some tool like FERecolor or you can do it by hand if you’re a madman . Each line of hexadecimal represent a palette; the spacing doesn’t matter so long as you keep it as one palette per line.

#Character Palettes

Next we have character palette examples to look at. FE8 does character palettes differently so it will require it’s own example. we’ll but reusing the examples from the above section Set up your buildfile manually. The explanation will mostly be focused on FE8

FE6 and FE7 example
char{0x2B} "Eliwood Unpromoted" set{0x1, U}
5553FF7F9E631F4B392A5A001F2052009877D26ACB49737F6C7668618550A514
5553FF7FFF6B1F4B392A5A001F2052009877F36E2D565F4B5F221A001004A514

char{0x38) "Eliwood Promoted" set{0x1, P}
5553FF7F9E631F4B392A5A001F2052009877D26ACB49737F6C7668618550A514
5553FF7F9E631F4B392A5A001F2052009877F36E2D565F4B5F221A001004A514
FE8 character palette example ``` # char(0x3C) "Seth Paladin" set{0x2, 0x3, 0x7} 5553FF7FFF6F3C3BD131FF2FEF512939556F8F56C83D2329FB7FF2662C4EA514 5553FF7FFF6F3C3BD131FF2F1900520C556F8F56C83D2329FB7FF2662C4EA514 5553FF7FFF6F3C3BD131FF2F8A17A71A556F8F56C83D2329FB7FF2662C4EA514 5553FF7FFF6F3C3BD131FF2FF2554A3D556F8F56C83D2329FB7FF2662C4EA514 5553FF7FFF6F3C3BD131FF2FEF512939556F8F56C83D2329FB7FF2662C4EA514 ```
  • char(0x3C) means that the palette is being placed at entry 0x3C in the character palette table, which is Seth’s palette in FE8

  • "Seth Paladin" is the label given to this palette, it always best to go with something that will help you remember who/what the palette is for

  • set{0x2,0x3,0x7} is where it char differs from gen and it gets a bit more complicated. we need set because char only puts the palette in the character palette table; set _**assigns**_ the palette to the character so that it's visible in game.set` is basically a shorter was of updating these tables

the 0x2 is Seth’s character id and the 0x3 means the entry number 0x3 (remember that we start counting from 0 instead of 1 here) and 0x7 is the class (paladin in this case)

  • set works differently in FE6 and FE7. In set{0x1, U}, 0x1 represent’s eliwoods character id while U and P mean the unpromoted and promoted palettes repectively.

  • the hexadecimal palettes at the end are the same as the ones used in gen with one difference
    gen has 4 palettes in the order
1. Player
2. Enemy
3. NPC (green team)
4. Arena 4 (4th team in the arena)

char palettes have an extra palette at the end

1. Player
2. Enemy
3. NPC (green team)
4. Arena 4 (4th team in the arena)
5. Arena 1 (1st team in the arena)

#The Autofill feature
explanation coming soon


[EA] [WIP] A Guide To Inserting Everything Through EA
#2

Thank you so much!

I’ve been looking for something like this for a while.

With this, could we simply do something like setPalette(0x6D, thing) to insert a palette at an entry in the table that isn’t used?


#3

Yes you can use the setPalette macro to set a palette to an unused entry in the palette table.