Jump to content

Some Events Command Questions in FE8


zhawhjw
 Share

Recommended Posts

eh...Thanks for helping me last time. So, it's me again................

I have some questions about the _SETCONDITION and _SAVEFORBATTLE. Actually, I have already went through the Vennobennu's topic. But still some thing I cannot figure out.

If i want to write a AREA event that making sure a certain character will get something and I write like:

label:

_SETVAL 0x2 0x1 //Loads Erika to slot 2?
_SETCONDITION 0x0 0xC 0x2 //chek value
// Events that occur if Unit is not Erika
ELSE 0x1 // another condition
ENIF 0x0 // event ID
// Events that occur if Unit 0xY is Erika
ENIF 0x1

ENDA

Am i right?

Also, how does the system make the "check value"? Does it check the value when I send my character to the coordinate?

The last question:

what exactly the _SAVEFORBATTLE do? I've seen it store the value what the _SETVAL loads in slot. Eh............ Can your guys give me an example about where to store the value and how does this code works?

Thank you! (Still sorry for unable to replying immediately! )

Link to comment
Share on other sites

Your first question:

The event is not quite complete; you need to load the character ID of the character triggering the AREA event so you can check it vs. Eirika's ID.

The command _0x2E21 will do this; the event will then look like this:

_SETVAL 0x2 0x1//0x2 is memory slot to use; 0x1 is character ID we check against
_0x2E21//Loads the character ID of the unit triggering the event to memory slot 0xC
_SETCONDITION 0x0 0xC 0x2//Checks if the values are not equal
//Event that occur if they are not equal
ELSE 0x1
ENIF 0x0
//Events that occur if the unit triggering the AREA event is Eirika
ENIF 0x1
ENDA 

_SAVEFORBATTLE is a little more complicated, I will get back to you on that. Also, in the future you should use the "Event Assembler Questions" thread for event questions.

Link to comment
Share on other sites

Your first question:

The event is not quite complete; you need to load the character ID of the character triggering the AREA event so you can check it vs. Eirika's ID.

The command _0x2E21 will do this; the event will then look like this:

_SETVAL 0x2 0x1//0x2 is memory slot to use; 0x1 is character ID we check against
_0x2E21//Loads the character ID of the unit triggering the event to memory slot 0xC
_SETCONDITION 0x0 0xC 0x2//Checks if the values are not equal
//Event that occur if they are not equal
ELSE 0x1
ENIF 0x0
//Events that occur if the unit triggering the AREA event is Eirika
ENIF 0x1
ENDA 

_SAVEFORBATTLE is a little more complicated, I will get back to you on that. Also, in the future you should use the "Event Assembler Questions" thread for event questions.

Oh! Thank you! And I will use that thread for my topic.

Link to comment
Share on other sites

Okay so here's the deal with _SAVEFORBATTLE; normally when you define the parameters for a command outside of the command itself, you just use _SETVAL. Like for the universal reinforcement events, you just use _SETVAL 0x1 (pointer to unit list) and then CALL the reinforcement event.

However, for events that want a whole bunch of parameters - such as a large, branching conversation tree, or a scripted battle, or a series of CHAI commands - that's not practical. What _SAVEFORBATTLE does is let you store an arbitrary number of parameters, four bytes each, to a single location, where the game can process each of them sequentially. Here's an example from Chapter 17:

[spoiler=Scripted battle]

_SETVAL 0xD 0x0
_SETVAL 0x1 0x1701
_SAVEFORBATTLE
_SETVAL 0x1 0x10F00
_SAVEFORBATTLE
_SETVAL 0x1 0x6401
_SAVEFORBATTLE
_SETVAL 0x1 0xFFFFFFFF
_SAVEFORBATTLE
FIG2 0xC0 0x8D 0x0

Each _SETVAL 0x1 / _SAVEFORBATTLE duo represents one attack in the battle; the FIG2 command processes each one in the order they were entered in. The FIG2 command will automatically wipe each value stored after it's done with it, but for some commands you'll have to do that yourself. That command is _0x0722 0xYY (_SAVEFORBATTLE's code is _0x0721); it moves the value stored in the second position to the first, the one in the third to the second, etc, and moves the value that was stored in the first position to 0x030004B8 + (0xYY*4).

Some commands that can make use of the values stored by _SAVEFORBATTLE are TEXTSHOW 0xFFFF, _03921 0xFFFF (a CHAI command for a unit on given coordinates).

Technical details on _SAVEFORBATTLE and its relatives:

$0800D918 - _SAVEFORBATTLE, _0x072X command; one parameter (halfword)
0720,0721,0722 - all else end immediately

0x0720 - Stores value from (parameter)th memory slot to the queue
- r0 = register in (parameter)th memory slot; branch to $0800D528

_SAVEFORBATTLE: stores input word to location at $030004F0 + (4*number of words already stored there)
0x0721 - r0 = value stored in mem. slot 0x1 and branches to $0800D528:
-r2 = $030004B8,r3 = $030004F0
-r1 = ldr[$030004EC] (number of values already stored)
-r1 = r3 + (r1*4); stores r0 (parameter) to this offset
-Adds 1 to the address at $030004EC (counter for how many values are stored)

0x0722 - r4 = parameter; branch to $0800D544:
Vanilla game only uses 0x2 and 0xB as params
-r5 = ldr[$030004F0]
-Subtracts 1 from value at $030004EC (# of registers stored)
-If =0 now, skip to end; else...
-Loop through all registers stored, shifting each back to the previous
-Then stores first register to (param*4) + $030004B8

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...