[FE7/FE6] Arch's Guide to Chapter Construction

Chapter 7: Tile Changes

A lot of this revision for the tutorial is just copy/pasting, reorganize, update. This section, however, needed a total revamp. It used to be that I taught people to assemble tile changes from a second text file (which is how I did it, until I realized you could just put them both in the same file).

First off, if you use Tiled, stop reading this and go read this instead.

For the rest of us, we’re doin’ this the hard way. I’ve gone ahead and modified the standard template to merge in tile changes. It’s incredibly simple to implement into your event files.

#define DISABLE_TUTORIALS
#include EAstdlib.event

EventPointerTable(EventTableID,Pointers)
EventPointerTable(TileChangeID,TileChanges) //This will write the tile changes to the Event Reference Array.


ORG StartOffset
Pointers:
POIN TurnEvents 
POIN TalkEvents 
POIN LocationEvents 
POIN MiscEvents
POIN TrapDataEM TrapDataHM
POIN BadENM BadEHM BadHNM BadHHM
POIN Good Good Good Good
POIN OpeningScene EndingScene

BadENM:
BadEHM:
BadHNM:
BadHHM:
UNIT

Good:
UNIT

TurnEvents:
OpeningTurnEvent(OpeningScene)
END_MAIN

TalkEvents:
END_MAIN

LocationEvents:
END_MAIN

MiscEvents:
CauseGameOverIfLordDies
END_MAIN


OpeningScene:
ENDA

EndingScene:
MoveToChapter(NextChapter)


TrapDataEM:
TrapDataHM:
ENDTRAP

MESSAGE Events end at offset currentOffset

TileChanges: //Now we just add our tile change list.
TileMapEnd

MESSAGE Tile changes end at offset currentOffset
//The map for this chapter is at offset: ????????

Now we’ve got to fill out that tile change list.

TileMap(tilechangeID,X1,Y1,L1,L2,TilePointer)

Things are pretty easy to understand. The tilechangeID works like an eventID, just for tile changes. Start at 0x00 for your first item and work your way downward. X1 is the top-left X value, Y1 is the top Y value (for destroyed villages, your coordinates won’t be the same as your events - the event specifies the gate, but the tile change has to start at the top left corner of the 3x3 village).

L1 is the length of the tile change on the X-axis. L2 is the length of the tile change on the Y-axis. TilePointer points to the list of tile changes.

So, now we have to list the tile changes. For this, we’ll need the reference tilesets.

We’ll do the basic village tile changes to demonstrate. In the FE7 folder of that archive, I’ve opened up 1C1D1E1F.png, the standard Fields tileset. Using the rows and columns as a guide, we’re going to write out our tile changes.

For the closed village gate, you’ll see that it’s in row 0E column 28 (for the skinny road tile, the wide road is at row 00 column 28).

SHORT 0x0E28

That simple. It’s just a matter of using the reference and writing it down. Then just fill out the TileMap macro for the list and you’re golden.

TileChanges:     
TileMap(0x00,14,12,1,1,VillageGate)
TileMap(0x01,13,10,3,3,VillageDestroyed)
TileMapEnd

VillageGate:
SHORT 0x0E28

VillageDestroyed:
SHORT 0x0E1C
SHORT 0x0E20
SHORT 0x0E24
SHORT 0x0E9C
SHORT 0x0EA0
SHORT 0x0EA4
SHORT 0x0F9C
SHORT 0x0FA0
SHORT 0x0F24

Manual Tile Changes

Tile changes generally trigger automatically: the game just knows. One such example where this is necessary are vertical doors. Ordinary horizontal doors will trigger a tile change automatically. Tile changes are generally handled by the game, but there are a few times when we need to force things (vertical doors, roof removal, etc.). Vertical doors require you to abandon the macro you’ve been using for doors up until now. You have to trigger the tile changes for the vertical door manually.

Here is the code we’ll use to do just that.

MAC1 tilechangeID status

For the status parameter, you’ll use 0x00 to force a tile change and 0x08 to reverse it. Here’s what our code should look like:

DOOR 0x00 DoorRemoval [X,Y] 0x10 //Using this instead of the macro to point to a scene
.....
DoorRemoval:
MAC1 0x03 0x00 //Triggers tile change 0x03
ENDA
1 Like