Chapter 6: Scene Construction (pt. 3)
Did you think you'd learned alllllll of the codes? Think again!
More Text Controls
This allows you to load another textID while preserving the current portraits in use. It becomes more significant once you learn conditions, for conversations where a segment depends on whether a character is alive, whether an event was completed, etc.
It's also possible to run events mid-conversation, by using the [LoadOverworldFaces] code in FEditor's text editor to specify the pause point, this tells the game to read events until a certain stop code is used.
MUSC 0x30 //game changes the music mid-song
SCRO //our certain stop code
The game will continue reading events after the SCRO once told to (either by another [LoadOverworldFaces] tag, you can have multiple SCROs, or the end of the text). This is useful for changing music mid-dialogue, moving units, etc.
Beyond those two, we have a few more codes to cover.
TEX6 bubble [XX,YY] textID
_ASM0x42 0x83181 //This is like REMA for TEX6, note that REMA doesn't work, that's why we have this.
The unique thing about TEX6 is the "bubble" parameter. There are four options generally used for this value. 0x0 displays text in a speech bubble on the map, it's just a standard speech bubble with text that you can place anywhere on the screen (it has no tail pointing to a speaker since no speaker mug appears). 0x1 displays the brown scroll bubble used for tutorial explanations and the like. For these two options, coordinates must be specified.
0x4 and 0x5 display the same backgrounds (0x4 speech bubble and 0x5 brown scroll) but automatically center them with the coordinates [0,0].
TEX8 text [XX,YY]
RETB //This is REMA's equivalent for TEX8.
TEX8 loads text with a brown-box in the background, like so. It only works with FE7 and FE8. In the .games this text box was displayed in the top right corner to designate location. But, as shown above, you really can use it for anything.
Scripted Movement & Other MOVE Codes
By adding another parameter to our MOVE code, we can have scripted movements.
MOVE charID MoveData
MOVE [X,Y] MoveData
Moves a character based on their specified "MoveData" (which is a pointer to the specifics of how you want the character to move). Naturally, GBAFE forces characters while moving to take the shortest route. If you'd like to move a character across a specific path, for whatever reason, this is how you do that. How exactly do we construct our "MoveData?"
MOMA left left left left
MOMA speed(0x1) left left notice
MOMA right right up up
MOMA down down down
This demonstrates all of the defined actions that you can assign. notice puts the exclamation mark above the unit's head, the directionals are all pretty self explanatory, speed adjusts the unit's movement speed, and highlight has the unit move in place for the specified amount of time.
There are still a few more codes to learn.
REPOS [X1,Y1] [X2,Y2] //Repositions character without movement based on set coordinates.
REPOS charID [X,Y] //Repositions based on the character.
MOVEMAINC [X,Y] //Moves main character, FE7 only.
MOVENEXTTO [X,Y] charID //The name explains it perfectly.
MOVENEXTTO charID charToMoveNextTo
Scripted Fight Sequences
Scripted battles are called with the FIGH code.
FIGH attacker defender FightData [Byte1,Byte2,Byte3,Byte4]
Pretty simple, right? Other than the bytes. For most scripted battles, you can just use $00000000 in lieu of the brackets. The bytes give special effects.
Byte1: By using an itemID, you can force the equip of a weapon. Sets "100 hit -- dmg -- crit" for ally, "-- hit -- dmg -- crit" for Other Ally/NPC/Enemy. You can use this to force a healing staff onto a unit for scripted healing scenes, for example, or to unleash the legendary story weapon in an epic scripted battle.
Byte2: Weapon durability remaining+1. Only if Byte1 has a value. Putting any value here other than 0x00 will cause Byte1 to be active... and show a non-existent sword item if Byte1 is "0x00".
Byte3: "WTF" to quote @shadowofchaos, who wrote up the explanation for these bytes.
Byte4: Anything other than 0x00 will cause the fight to go to "non-controlled" mode, as if you actually attacked with the attacker on a turn, and the stats are factored in if they will double...and critical, depending on the RNG.
Now all you need is your list of commands for the FightData parameter (which is a pointer to elsewhere in the event file).
BLDT //This will end the fight scene
Loading Other Maps
Sometimes, scenes in the openings and endings of chapters occur on maps that aren't the chapter's map. This is done with a simple event code, LOMA.
LOMA chapterID [X,Y]
LOMA's coordinates are actually a built-in CAM1 (which is quite handy). LOMA stands for LOad MAp, and (as you've probably guessed) it loads a specified map. The first parameter, chapterID, specifies the map to be loaded. We've already used this value for our MNCH code. LOMA loads maps based on the chapter they're associated with. Let's say I wanted to load Chapter 7's map (for some reason). The map value in the Chapter Data Editor is 0x26, but that's useless to LOMA. To load Ch7's map, we'd use 0x07 for our chapterID.
Back when I introduced MNCH, I also shared a macro for the ClearAllUnits code. That'll be useful here, too.
After you're finished with the map, for an OpeningScene you'll want to LOMA back to the main chapter.
Protip: The native GBAFE engine doesn't allow you to change the goal text mid-chapter. If you're looking for that effect, simply LOMA mid-chapter to a copy of the chapter with different values for the goal text. Since it's the same map, the units will stay in place and the chapter will carry on as though nothing happened, so long as you've got the same events and everything specified. This will undo any tile changes, although you can manually retrigger them yourself.
CGs will require some new codes, of course. The fades work like any other (FADI/FADU for black, FAWI/FAWU for white, in case you forgot).
This is the code to show CGs, which works similarly to the BACG code. Your cgID, of course, can be found in the CG Editor. We've also got a special text code for text bubbles over CGs.
TEXTCG textID 0x1
MORETEXTCG textID 0x1 //Because why not?
And some various transitioning codes to top it all off:
FROMBGTOCG cgID 0x2 //Fades in the CG; also works going from CG to another CG
FROMCGTOBG background 0x2
FROMCGTOMAP [X,Y] //The coordinates act as a built-in CAM1, like LOMA
You can insert your own custom CGs with one of FEditor's hidden little tools.
To wrap up our code dump, I've got two final ones for ya.
UNCM charID condition //Applies unit condition
UNCR charID condition //Reverses unit condition
0x01 = Invisible
0x02 = Greyed out
0x04 = Not in the status menu or unit data
0x10 = Rescuing
0x20 = Is being rescued
0x800 = In ballista
After a scripted fight, for instance, the attacker greys out automatically. To get his color back, you'll need a UNCR.
FIGH Gandolf Midir Fight $00000000
UNCR Gandolf 0x02
One of the more useful conditions is 0x04, which can be used to remove members of your party and force them back in. In the Elibian Nights source for Karel's Tale, UNCR is used to essentially revive Karel after a forced loss/kill in his series of boss battles. Others have used this condition for temporarily removing party members, and even pulling of FE8's Ch5x-esque chapters that shift parties entirely by UNCMing all of the units. They can be UNCR'd much later (as necessary), bringing them back into the party.