FF6 Hacking
Conditional Battle Palettes - Printable Version

+- FF6 Hacking (https://www.ff6hacking.com/forums)
+-- Forum: Discussion Forums (https://www.ff6hacking.com/forums/forum-5.html)
+--- Forum: Magitek Research Facility (https://www.ff6hacking.com/forums/forum-9.html)
+--- Thread: Conditional Battle Palettes (/thread-2182.html)



Conditional Battle Palettes - B-Run - 05-30-2013

Per the request of Gi Nattak, here is how to add a condition to setting your battle palettes (in this case, Kefka in the WoR and Edgar as Gerad).

All you need is 35 free bytes of code.
Code:
XX/0000:    AD941E        LDA $1E94        (load event bits)
XX/0003:    2910        AND #$10        (in WoR?)
XX/0005:    F017        BEQ    $001E        (Branch if it isn't)
XX/0007:    E01500        CPX #$0015        (is this Kefka?)
XX/000A:    F00F        BEQ $001C        (Branch if it is)
XX/000C:    E00400        CPX #$0004        (is this Edgar?)
XX/000F:    D00D        BNE $001E        (Branch if it isn't)
XX/0012:    AD981E        LDA $1E94        (load event bits)
XX/0014:    2940        AND #$40        (have we recruited Edgar?)
XX/0016:    D006        BNE    $000E        (Branch if not)
XX/0018:    A901        LDA #$04        (Set palette ID to 01)
XX/001A:    6B            RTL    
XX/001B:    A901        LDA #$01        (Set palette ID to 01)
XX/001D:    6B            RTL    
XX/001E:    BF2BCEC2    LDA $C2CE2B,X    (Pull palette ID from table in C2 for sprite X)
XX/0022:    6B            RTL

Then you just have to call this instead of simply calling the battle palette data from the table.

Replace:
Code:
C1/3E20:    BF2BCEC2    LDA $C2CE2B,X    (Pull palette ID from table in C2 for sprite X)

with this:
Code:
C1/3E20:    22XXXXXX    JSR $XXXXXX        (Where $XX/XXXX is the location of the code we just entered)

That's all there is to it. You can set as many conditionals as you want, based on any data in the RAM, create a separate table for your characters to look from, or statically set each one with only minor changes to the code. If anyone wants a specific condition, let me know, but I would encourage you to try tweaking the code first yourself.

It's good to be ASM-ing again.


RE: Conditional Battle Palettes - Gi Nattak - 05-30-2013

Woo-hoo! Thank you very much Edrin! I will be trying this out tonight. =)

One other place I wanted a sprite battle palette change, would be for Edgar in the battle with the tentacles in the WoR, so he would remain in his 'Gerad' palette for the battle then afterwords switched back to his original one. Seems like using this code but for Edgar and using different event bits would work for that as well eh?


RE: Conditional Battle Palettes - Angelo26 - 05-30-2013

I would assume it would be trickier for edgar...on second thought, no...as long as you find an event bit related an event with Gerad in it, it should be fine and adding a couple more lines of code.

Great job, Edrin :p


RE: Conditional Battle Palettes - B-Run - 05-31-2013

updated for Kefka and Gerad.


RE: Conditional Battle Palettes - Gi Nattak - 06-29-2013

I finally got around to testing this out in my hack, and I realize I must have forgotten to say that I need Kefka to be on palette 1 and Gerad palette 4. >_< I see it has them using the same palette here for the conditional. I hope there is an easy tweak to the code that can be done to have it like that instead? I tried adding an A901 under the 'is this kefka' line, but it still read the palette code after it which I changed to A904 for Gerad. If it matters any, Kefka's palette change happens before Gerads.

Besides that it works like a charm!


RE: Conditional Battle Palettes - SSJ Rick - 06-29-2013

nice job

that'll be really interesting especially with kefka man hell yeah its gonna be great


RE: Conditional Battle Palettes - B-Run - 06-29-2013

Fixed, I just did it by logic, I didn't plug it back in and test but it should work. If not let me know.


RE: Conditional Battle Palettes - Gi Nattak - 06-29-2013

Works perfect, thank you very much sir! =)

I notice one little thing here to edit you may have forgotten to change:
XX/0018: A901 LDA #$04 (Set palette ID to 01)

Should be listed as A904 (Set palette ID to 04)
Thanks to the correct LDA #$04 though I was able to tell right away XD