Basic Event Codes
Now we've got our arrays all worked out. The arrays tell the ROM where to look for our events, and how our events are triggered. Now it's time to actually code the events themselves. There is a lot to learn in the coming chapter, so be prepared.
Unit Loading & Manipulation
The first basic event I'll cover is loading units. Can't have a chapter without enemies and allies (and a few NPCs here and there), right?
The only parameter is a pointer to the unit data that you're trying to load. Let's provide an example, shall we?
Once you've gotten units onto the map, there are a variety of things one can do with them. Moving units is important to constructing scenes:
MOVE Char [XX,YY] //Moves character to specified coordinates.
MOVE [X1,Y1] [X2,Y2] //Moves character on the first set of coordinates to the tile specified by the second set of coordinates. Used to move generics.
In addition to this, one can add a 0x1 as a third parameter to force the unit to walk incredibly slowly.
Unit alliances are also manipulated through events.
Macros work for FE7 and FE8. These are used for changing alliances in recruitment conversations (or anti-recruitment conversations where allies become enemies/NPCs).
The next most-essential component of our chapters is text. I'm not going to go in-depth teaching actual text editing, this isn't the tutorial for that (besides, it's relatively simple anyways). Here are the codes you'll need to know for text.
These macros work for all three GBAFEs, and are in this tutorial because FE8 does some complicated stuff with even ordinary text. For beginners these macros should be enough. These macros load the text specified by "textpointer" and then clear the game's map of all mugs, text, and backgrounds.List of FE6 Backgrounds
, by ArchList of FE7 Backgrounds
, by NintenlordList of FE8 Backgrounds
, by Mage Knight 404
Fade-in, Fade-out & Darkness Manipulation
Now, the Text macros automatically fade to black when loading the background. This creates for a smooth transition. You can perform the fade-in and fade-out manually with relative ease.
FADI Time //Fade-in with black
FADU Time //Fade-out with black
FAWI Time //Fade-in with white
FAWU Time //Fade-out with white
Time is our only parameter here. I recommend 10 for normally-timed fades, and 5 for slower-fades. Anything above 10 looks sloppy to me, but you can experiment with what looks best to you (it's your game, not mine).
While the map is faded in, absolutely nothing will appear on-screen. You can take advantage of this to load units so that it appears that they were already on the map, change the map entire. Now, when the chapter is loaded it can either go straight to the map or go to darkness. This is a simple option in the Chapter Data Editor.
Opening with "black" gives you the option to load another map (start the chapter on a scenic map), load units so that they're on the map initially, etc. Once you've finished whatever you want to do with the opening darkness, a simple no-parameter code will dispel it.
Manipulating darkness is one of the ways to give your events that extra level of "polish." Play with it; it may seem somewhat trivial (I thought it was for some time), but you can be surprised how good your events can feel by using darkness to properly hide things.
Camera & Cursor Control
The camera is trained to automatically follow unit movement. It will focus on a moving unit as it moves.
CMOF //Turns off the camera's automatic follow.
CMON //Disables CMOF, turns the automatic follow back on.
The camera can be set to look at certain portions of the map quite easily, and this is commonly done.
CAM1 [XX,YY] //Focuses camera on tile XX,YY
CAM1 Char //Focuses camera on a certain character
And the final part of our exploration into camera & cursor control is...cursor control.
CURF [XX,YY] //Flash cursor on tile XX,YY
CURF Char //Flash cursor on specified character
Next to text and units, music is the third most important thing. It's also relatively simple to control.
This code simply starts playing the music. Not really much to explain. SongValues can be found here:FE6 Song ValuesFE7 Song ValuesFE8 Song Values
There are several simple codes to know when it comes to music.
MUsic ENd, fades out your music. Does not work with FE8!
MURE Time //No "Time" variable for FE6
MUS2 plays a song, but remembers where the previous song left off. MURE returns to that previous song, exactly where it stopped.
MUSI //Make music quieter
MUNO //Reverses MUSI, making music normal after MUSI's usage.
The comments explain all. MUSI and MUNO are used for Villages/Houses mostly, quieting the map music for those specific types of events. I'm certain they have other uses though.
Items & Money
The final section of this lesson on basic event codes is giving items. These codes are useful for villages and 'Talk' events,
ITGC Char Item //Gives item to character.
ITGV Item //Gives item to current character, used for villages.
ITGM Item //Gives item to the main lord.
Giving money is also useful for these sorts of events.
MONE 0x00 Amount
Once your event (village conversation, 'Talk' event, reinforcements, etc.) is over, you need to tell the game to stop reading for events. Just remember to end all of your events with the following code:
Opening & Ending Events
One final note about the opening and ending events. These events are just like every other event in terms of how they're composed (they use the same codes I've taught in this lesson). But, a few notes about them anyways.
Opening events in chapters with the preparations screen will need to end with this code, instead of ENDA.
This naturally only applies to FE7 and FE8, since FE6 loads the preparations screen before any events can run.
Ending events will need to use the following code to load the save screen and force the game to go to the next chapter.
The chapter is...well...the value of the chapter. You can find these values in the Chapter Data Editors for your respective version of GBAFE.