[FE8] Jester's C/EA Tips and Tricks

New section: Multiple Defeat Quotes

READ ME

By default, units only have a singular defeat quote as opposed to multiple battle quotes.

The basic structure for the defeat quote struct is as follows, with a single msg linked to a unique pid or personal ID.

CONST_DATA struct DefeatTalkEnt gDefeatTalkList[] = {
    {
        .pid     = CHARACTER_ONEILL,
        .route   = CHAPTER_MODE_ANY,
        .chapter = 0x00,
        .flag    = EVFLAG_DEFEAT_BOSS,
        .msg     = 0x0917,
    },
}

Now, you may want a situation where characters say different things depending on who they are killed/defeated by. The solution is to create a new struct for gDefeatTalkList using the same structure as the gBattleTalkList struct.

Here, we have a pair of characters pidA and pidB and a pointer to a msg quote between them.

const struct DefeatTalkEntNew gNewDefeatTalkList[] = {
    {
        .pidA    = CHARACTER_ONEILL,
        .pidB    = CHARACTER_EIRIKA,
        .route   = CHAPTER_MODE_ANY,
        .chapter = 0x00,
        .flag    = EVFLAG_DEFEAT_BOSS,
        .msg     = MSG_DEFEAT_QUOTE_EIRIKA_ONEILL,
    },
    {
        .pidA    = CHARACTER_ONEILL,
        .pidB    = CHARACTER_SETH,
        .route   = CHAPTER_MODE_ANY,
        .chapter = 0x00,
        .flag    = EVFLAG_DEFEAT_BOSS,
        .msg     = MSG_DEFEAT_QUOTE_SETH_ONEILL,
    },
}

In order to make this work in-game, you need to replace the relevant function GetDefeatTalkEntry that references gDefeatTalkList and switch it out with the name of your new list. In addition, a few modifications are necessary to make it check for both pid’s.

    struct DefeatTalkEntNew* GetDefeatTalkEntry(u16 pidA) {
        const struct DefeatTalkEntNew* it;

        for (it = gNewDefeatTalkList; it->pidA != 0xFFFF; it++) {

            if (it->chapter != 0xff && it->chapter != gPlaySt.chapterIndex) {
                if (it->chapter != 0xfe || BattleIsTriangleAttack() != 1) {
                    continue;
                }
            }

            if (GetEventTriggerState(it->flag)) {
                continue;
            }

            if ((pidA == it->pidA) && ((GetUnit(gBattleActor.unit.index)->pCharacterData->number == it->pidB) || GetUnit(gBattleTarget.unit.index)->pCharacterData->number == it->pidB)) {
                return (struct DefeatTalkEntNew *)it;
            }
        }

        return NULL;
    }

The last thing to do is to create a new struct for defeat quotes now that we’ve substituted the .pid variable for .pidA and .pidB.

struct DefeatTalkEntNew {
             u16 pidA;
             u16 pidB;
    /* 02 */ u8 route;
    /* 03 */ u8 chapter;
    /* 04 */ u16 flag;
    /* 06 */ u16 msg;
    /* 08 */ EventScr * event;
};


7 Likes