01-06-2020, 02:05 PM
You've got to be careful with Zone Doctor. Whenever you insert or delete a line from it, the program tries to dynamically update EVERY pointer in the game. Unfortunately, this causes it to scrub all of the banks from the pointers (so if it was originally pointing to CC/334A, for example, it instead points to CA/334A). This WILL break your game, which is why you want to use Zone Doctor to set up a layout, then manually change the hex in a separate copy of the ROM.
The best way I've found to free up space in the event code is to simplify conditional events, the sort of things where it says "If <event bit> is <set/clear>, branch to <thing>". Do a search on this site for PowerPanda's "Cyan's Uneventful Dream", which you can use as a guide for this sort of adjustment. Once you've got the free space, you need to tell the event script to jump to it. To insert a jump, find a bit of code near the segment you want to interrupt, copy it into your freespace, and then replace it in the original location with "B2 ZZ YY 0X" where 0XYYZZ is the address of the freespace (X=0 is CA, X=1 is CB, X=2 is CC). Just make sure your freespace code ends with a return command "FE".
...That code might actually work for any ROM address over CA, so you could hypothetically jump to free space outside the editable area of ZoneDoctor if you like.
As for maintaining battle variables, I think you're going to need to trigger a formation change in the battle script rather than the event script, like with the Senior Behemoth fight. Even if you do that, though, a formation change will still refresh the Summon command. I think you'd need to make some serious changes to the C2 battle loop to overcome that. I can't advise you in that regard, the battle initialization stuff makes my head spin.
The best way I've found to free up space in the event code is to simplify conditional events, the sort of things where it says "If <event bit> is <set/clear>, branch to <thing>". Do a search on this site for PowerPanda's "Cyan's Uneventful Dream", which you can use as a guide for this sort of adjustment. Once you've got the free space, you need to tell the event script to jump to it. To insert a jump, find a bit of code near the segment you want to interrupt, copy it into your freespace, and then replace it in the original location with "B2 ZZ YY 0X" where 0XYYZZ is the address of the freespace (X=0 is CA, X=1 is CB, X=2 is CC). Just make sure your freespace code ends with a return command "FE".
...That code might actually work for any ROM address over CA, so you could hypothetically jump to free space outside the editable area of ZoneDoctor if you like.
As for maintaining battle variables, I think you're going to need to trigger a formation change in the battle script rather than the event script, like with the Senior Behemoth fight. Even if you do that, though, a formation change will still refresh the Summon command. I think you'd need to make some serious changes to the C2 battle loop to overcome that. I can't advise you in that regard, the battle initialization stuff makes my head spin.