Events: Into the guts

Getting Started

Fair warning: While the concepts and general process outlined in this tutorial are not FE7-only, the specific things I’ll be telling you to do are. I’m actually making the actual prologue to my own project as I write this, so there’s no dummy data or whatever here.

In terms of setting up the map and all, I’m going to point you at Arch’s excellent explanation instead of explaining myself. Come back here once you’ve gotten that worked out!

The first thing you’ll want to do is copy down this template here. For you FE8 or FE6 hackers out there, there are other templates out there. Before you start tapping away, let’s go over some of the things in that file. We’ll start with the event file’s header, which contains things like the chapter’s pointer array and other various processing things that make our life easier.

[code]#ifndef FE7
ERROR This file is meant for FE7!
#endif

#define DISABLE_TUTORIALS
#include “EAstdlib.event”[/code]

These are assembler directives. You don’t need to worry about them for now (see technical notes if you want more).

EventPointerTable(EvID, Pointers)

Aha, here’s something you’ll want to change. Pointers is just a label to the pointer array referenced later in the code, don’t mess with that. EvID, however, is an index in the Chapter Data Table (please note that, although it may sound similar, this is not the same thing as the data in the chapter data editor in nightmare; you may have heard of this instead as the “Event References Table”). FE6 and FE8 users can find similar lists by looking at their appropriate Event Reference nightmare module (it’s probably named “Pointers.txt” or something). By looking through that list, we see that “Prologue Events” is at 0x6, so we change the line to read EventPointerTable(0x6, Pointers). Obviously, if you’re doing a chapter that’s not the prologue, you’ll use that chapter’s event slot. Moving on!

ORG offs

This is the offset of your code in the ROM. If you’re going to be a ROMhacker, you should figure out what that means; it’s where your code goes in the ROM. I like to use 0xD80000 as my event space (this was a habit instilled in me by reading Arch’s tutorials way back in the day), but you can consult the free space list for your respective game to find out where’s safe for you. Alternatively, you can write to expanded space (this is not the place to explain that), if that works for you.

// The pointer array for the chapter // Warning: Don't edit this! Pointers: POIN TurnEvents POIN TalkEvents POIN LocationEvents POIN MovementEvents POIN MapData MapData POIN Bad Bad Bad Bad POIN Good Good Good Good POIN OpeningScene EndingScene

The last part of note in the header is the pointer array for the chapter. You’ll notice that the line on top reads “Pointers”, which is mirrored in our EventPointerTable macro above. This is because we want the game to know that our chapter’s pointer table is here, instead of some other random place. I’ll explain what each of those words means in a bit. But first, on to the actual chapter writing!