Jump to content

Event Hacking for Dummies (2nd Edition)


Arch
 Share

Recommended Posts

  • Replies 56
  • Created
  • Last Reply

Top Posters In This Topic

Since your tutorial doesn't include movement in FE8, I thought I might share all the codes I know:

First we have the basic movement command. To move a character, simply write it like so:

_MOVE speed character [X,Y]

Moving units at a coordinate comes in two parts. First, you define the coordinates of the unit to move:

_SETVAL 0xB 0xYY00XX //the initial X and Y of the unit to be moved. The 0xB is a necessary component here.

Then follows the _MOVE command:

_MOVE speed 0xFFFE [X,Y] 

The speed is in hex. Higher values are faster, except for 0x0 which uses the default movement speed. X,Y is the destination.

You can chain these together to move multiple units at once (though the game can only have four moving units at any given instant).

Then there's _MOVE1 (yes, this is a little confusing - you can change the names in the raws file at least). This lets you move one character to another, though note that this code puts them directly on top of the target:

_MOVE1 speed Mover Target

Finally there's _MOVE2. This lets you move a character one tile in any direction.

_MOVE2 Speed Character Direction // 0x0 is left, 0x1 is right, 0x2 is down, 0x3 is up

Anyway, hope this helps.

Edited by Vennobennu
Link to comment
Share on other sites

Thanks for the notes, Venno. If there's anywhere else that doesn't support FE8, just let me know. I might just write up a chapter on understanding FE8 on its own if there's enough to mandate it (which, yes, I'm sure there is but I'm not too well-versed in FE8 events so help is definitely appreciated) and make notes for when FE8 users should flip to the chapter.

Also, does anyone have the code for Lightning? I have an old macro for it that uses CODE (what a throwback) and the bit I got from Eventiel just resets the game.

Link to comment
Share on other sites

An FE8-specific chapter would certainly be a good idea; there's lot of things that FE8 does differently - a lot of commands are split up into two parts like _MOVE, where you have to _SETVAL the change to be made, followed by the unit to change; the pointer table is set up differently; and there's a lot of commands in FE8 that have no equivalent in FE7. There is, for instance, a dedicated counting system so you don't need to mess around with Event ID's or conditional chains.

The PointerList, for instance:

PointerList:
POIN TurnBasedEvents
POIN CharacterBasedEvents
POIN LocationBasedEvents
POIN MiscBasedEvents
POIN Dunno1 Dunno2 Dunno3 Tutorial
POIN Traps1 Traps2
POIN Units Units_HM
POIN SkirmishUnitsAlly1 SkirmishUnitsAlly2 SkirmishUnitsAlly3
POIN SkirmishUnitsEnemy1 SkirmishUnitsEnemy2 SkirmishUnitsEnemy3
POIN BeginningScene EndingScene

While FE7 has four pointers for your units on Eliwood/Hector and Normal/Hard, FE8 has just two; one each for your party on Normal and Hard mode. And of course there are the pointers to FE8-exclusive stuff.

The counting system, as seen in C14 Ephraim, allows reinforcements to spawn for four turns regardless of the overall turn count:

label26://AREA event that lets reinforcements spawn twice on Normal and four times on Hard. ID 0xC
_0x0F21 0x200//Sets value to compare with as 0x2
//Hard Mode check:
_0x1927
_SETCONDITION2 0x0 0xC 0x0
_0x1922
_SETCONDITION 0x0 0xC 0x0
_0x0F21 0x400//If on Hard Mode, sets value at 0x4 instead
ENIF 0x0
//end Hard Mode things
_0x0221 0xD//Sets Event ID 0xD as unused
_0x0228 0x7
ENDA

label21://ID 0xD
_SETVAL 0x2 0x88C6584
CALL label30//Loads reinforcements; label30 leads to the standard reinforcement loader event
_0x0F23 0x0//Increments the counter by 1
_0x0221 0xD //Sets this event as unused
_0x0F20 0x0//Probably checks value of counter with value set by _0x0F21
_SETCONDITION2 0x0 0xC 0x0//If the value equals the value stored by _0x0F21...
_0x0229 0xD //...Set our Event ID as used
ENIF 0x0
_0x0228 0x7
ENDA

Compared to what FE7 does in Cogs of Destiny to replicate this, it's quite compact.

If I tried to list all the differences I'd be at this for a while, so I'll stop now.

Edited by Vennobennu
Link to comment
Share on other sites

If I tried to list all the differences I'd be at this for a while, so I'll stop now.

Please continue, hahah. Like I said, not all that well versed on FE8, so having a good chapter depends on what I hear from the people who actually event for it.
Link to comment
Share on other sites

Please continue, hahah. Like I said, not all that well versed on FE8, so having a good chapter depends on what I hear from the people who actually event for it.

Well alright then! Here's how the CHAI command functions in FE8. Like MOVE, it's split up into two commands: _0x3920 and _0x3921.

_0x3920 changes the AI of a unit based on its character ID. First you use _SETVAL 0x1 to define its new AI:

_SETVAL 0x1 0x44332211 //AI Bytes 4,3,2,1

Then you use _0x3920 to enact the change:

_0x3920 0xCC //Character ID to change

Take note that this will change the AI of all units with that character ID. You can thus cause an entire group of units to charge with one code, if they all share a character ID.

If that's not practical, we can use _0x3921 to change the AI of units by coordinates. It's a little more complicated, however...

First we use _SETVAL 0x1, but this time we use it to store the coordinates of the unit; then we define the new AI to use with _SETVAL 0x2 then we write _0x3921 0xFFFF, like so:

_SETVAL 0x1 0x020006 //The unit at [06,02] will have its AI changed
_SETVAL 0x2 0x10000 //The unit's new AI will be [0x0,0x0,0x1,0x0]
_0x3921 0xFFFF //Changes the AI of a unit from coordinates defined above

Now, if you want to change the AI of a whole lot of units at once, it's not necessary to repeat this over and over again. There's a way to define the coordinates of all the units you want to change, then change all of them at once. For each unit whose AI you want to change, set their coordinates with _SETVAL 0x1, followed by '_SAVEFORBATTLE':

_SETVAL 0x1 0x20006
_SAVEFORBATTLE
_SETVAL 0x1 0x30008
_SAVEFORBATTLE
//etc...

What _SAVEFORBATTLE does is place the value in memory slot 1 into a queue; the first one to be saved is the first to be read. This is important for other areas, but for now just now that this lets us store all these coordinates together.

Next, set the new AI with _SETVAL 0x2. Finally, we'll make all these changes at once with this loop:

AIChange:
ENIF 0x0
_0x0C44 0x1 0xD 0x0 // Checks if the queue is empty; if and only if it is, skip to ENIF 0x1
_0x0620 0x21 // I'm not sure what this does! Whatever it is, it's everywhere
_0x0722 0xB // Moves to the next set of coords
_0x3921 0xFFFF // The actual AI changer
ELSE 0x0 // If we're not done, go back up top
ENIF 0x1
ENDA

One more thing! If you want an enemy to go from a passive to an aggressive AI, make sure their fourth AI byte is empty. Setting it to 0x20, 'Stand Still', will mess up their targeting after the AI change and not allow them to attack after moving. You can see this problem with the Soldier near Gilliam in Chapter 1. Something like [0x3,0x3,0x9,0x0] works well for their starting AI.

Edited by Vennobennu
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...