I'm curious as to what the presumed function of that instruction would be, PinkPuff, considering the fluidity of party slots?
I remember what I wanted as an event instruction now. It was, "reduce HP by XX."
I ended up putting some event-specific ASM in my hack to reduce party HP whenever a particular event occurs instead.
Wouldn't it make sense, for example, for the "Ouch!" event to reduce HP? That's not what I wanted it for, but it's a relatable example.
That's some good thinking there Chillyfeez, I personally would like the first option more you described by using an event instruction to do that.
Upon reflection, it wouldn't do what I wanted anyway.
The situation I'm thinking of is this:
Suppose you have a scenario involving the twins, but it could be done while Cecil is still a Dark Knight, or it could be done while he's a Paladin. Furthermore, you don't have any guarantees over who else might be in the party when the scenario is executed.
So I guess it would make more sense to have a function like,
"Change character graphic to DK Cecil if the 'became a paladin' flag is off, otherwise change character graphic to Paladin Cecil"
ACTUALLY!! How about this:
"If Flag XX is on, do the following YY actions; otherwise skip past them"
This will require disassembly of the Yes/No Option for optimal use, while I would assume that your method here would work, there is no YY option allowed here because the instruction only has a single variable and that would be some heavily advanced hacking to get the game to read another variable for event instruction. While if you tie it into the Yes/No Option of "If Flag XX is on keep following this event, if not, go to second event" would work much better I'd imagine.
So let's get to disassembling the Yes/No option and see how it works!
EAE9 - Show Message 1XX (Yes/No Box) F8
Or at least that was the plan, but this is doing so many functions I can't keep them straight, nor do I understand much about the graphics processing part, so I will skip to the important part to purely create another event instruction which can skip to the next event.
Alright, I understand now... that is rather simple and should be easy to manipulate. It looks like the game has a built in "check" there already, when the cursor is on Yes, it is 00 which means nothing special, all normal events proceed off of this. But when the cursor is on No, the game changes a certain value to 01 and through a series of code uses the game will skip to the next event through this instruction.
Here is what is being done...
$00/AC53 A5 8C LDA $8C [$00:068C] A:0011 X:3745 Y:00D0 P:envMxdiZC - Load A from 068C (Cursor Choice)
$00/AC55 85 DB STA $DB [$00:06DB] A:0001 X:3745 Y:00D0 P:envMxdizC - Store A in in Event Switcher
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
$00/EB00 A5 DB LDA $DB [$00:06DB] A:0000 X:0010 Y:00D0 P:envMxdiZC - Load A from Event Switcher.
$00/EB02 F0 07 BEQ $07 [$EB0B] A:0000 X:0010 Y:00D0 P:envMxdiZC - Branch if 00 past Event Switching.
----------------------------------------------------------------------------------
00/EB04 20 D2 E2 JSR $E2D2 [$00:E2D2] A:00FF X:006C Y:00D0 P:envMxdiZC - Jump to Event Switching Routine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
$00/E2D2 AE D3 09 LDX $09D3 [$00:09D3] A:0001 X:0010 Y:00D0 P:envMxdizC - Load X from Event Position
$00/E2D5 E8 INX A:0001 X:006B Y:00D0 P:envMxdizC - +1 X.
$00/E2D6 BF 00 82 12 LDA $128200,x[$12:826C] A:0001 X:006C Y:00D0 P:envMxdizC - Load Event Instruction ID.
$00/E2DA C9 FF CMP #$FF A:00FF X:006C Y:00D0 P:eNvMxdizC - Is it End Event?
$00/E2DC F0 04 BEQ $04 [$E2E2] A:00FF X:006C Y:00D0 P:envMxdiZC - If so, branch
----------------------------------------------------------------------------------------------------
$00/E2DE E8 INX A:00FF X:006C Y:00D0 P:envMxdiZC + 1 X
$00/E2DF 4C D6 E2 JMP $E2D6 [$00:E2D6] A:00FF X:006C Y:00D0 P:envMxdiZC - Jump (backwards) to E2D6 to +1 X again to look for the end of the event.
-------------------------------------------------------------------------------------------------------
$00/E2E2 8E D3 09 STX $09D3 [$00:09D3] A:00FF X:006C Y:00D0 P:envMxdiZC - Store X in Event Position
$00/E2E5 60 RTS A:00FF X:006C Y:00D0 P:envMxdiZC - Return
And that's all it seems to take. If the new instruction looks at an Event Flag instead of at a cursor position to use the same Event Switch code everything should work properly.
This would also be the way to set up branching paths in a way where Actions in addition to Yes/No Options could influence the course of gameplay
My thinking is to make this two-pronged...
Say I wanted a scenario where a battle could be won, but didn't have to be and the outcome would be the way the game would branch to two different scenarios. To The first would be this... "Is Characters 1-5 Dead?" IF so, play Event Switcher" That would accomplish this. Then in the code, do as you suggest; "Is Event Flag XX on? If so, branch to next event". In normal gameplay all characters can't be dead so the first part would never play, but that scenario can happen in events and event battles.
I will try an experiment shortly to see if I can put theory into practice...
Changing Event Instruction FC (Nothing) to (If All Characters are Dead move to next event)First thing is first, we will need to go to the Pointer Table and make sure that FC's instruction start is read properly, so change the 0000 at E33E to 71FD (free space at the end of Bank 0)
And it worked in such an easy manner, I'm somewhat shocked! I created a custom Event Instruction as a test using my "dead party" idea and it was flawless. It jumped to the next event once it saw that the entire party was dead and if a party member was alive it would not use the Event Switcher.
$00/FD71 BD 03 10 LDA $1003,x[$00:1003] A:00FD X:0000 Y:0002 P:envMxdiZc - Load Character 1's Status Byte 1.
$00/FD74 10 17 BPL $17 [$FD8D] A:0000 X:0000 Y:0002 P:envMxdiZc - If they are not dead, branch to End.
$00/FD71 BD 03 10 LDA $1003,x[$00:1003] A:00FD X:0000 Y:0002 P:envMxdiZc - Do this for the rest of the Slots.
$00/FD74 10 17 BPL $17 [$FD8D] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD76 BD 43 10 LDA $1043,x[$00:1043] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD79 10 12 BPL $12 [$FD8D] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD7B BD 83 10 LDA $1083,x[$00:1083] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD7E 10 0D BPL $0D [$FD8D] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD80 BD C3 10 LDA $10C3,x[$00:10C3] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD83 10 08 BPL $08 [$FD8D] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD85 BD 03 11 LDA $1103,x[$00:1103] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD88 10 03 BPL $03 [$FD8D] A:0080 X:0000 Y:0002 P:eNvMxdizc
$00/FD8A 20 04 EB JSR $EB04 [$00:EB04] A:0080 X:0000 Y:0002 P:eNvMxdizc - Jump to Subroutine (Event Switcher)
$00/FD8D 60 RTS A:0000 X:0000 Y:0002 P:envMxdiZc
That's all it took.
Now as for the rest of your idea Pinkpuff, that is a bit more complicated... while I can easily set F8's variable to act as an event flag searcher, I do not know how the game actually tells if an event flag is off or on in a numerical fashion since the Event Flags are booleans (I think that's the right term) and they comprise of much more than one byte. So how the game turns them on and off, I do not know. Once that is found though your idea would work fine.
Though there is another suggestion I would make...
I would suggest looking for Dark Knight Cecil or Paladin Cecil rather than holding to Event Flag dealings. It would be something as simple as above...
Look through the each slots. If the slot is Dark Knight Cecil keep on with the current event. If the slot is Paladin Cecil switch events. If neither, move on to the next slot.
Something like this would be really easy to build especially with all of the free space at the end of Bank 1, but from what you described the event would not be too terribly different. In such a case I think modifying the "Change Character Graphic" to look only at the two Cecil's (it doesn't ever use it for anything else in the default game) and using the pattern I mentioned above should do the trick.