Users browsing this thread: 1 Guest(s)
customize FA battle AI commands

#1
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
funny, i just realized that FA commands are actually the most complicated to edit or even understand...
Appearently the parameters are not used to jump to a pointed area of bank C2, they are used to select a certain animation to do instead.
so i tried to follow the whole thing with a debugger for a while(maybe around 500 lines of code)
aside the fact that near to C2/0700 there's a byte or two from the debug, which says another thing than the disassembly...
well i don't know how to figure out where the parameter comes in play or when the code actually picks the animation that will use for the command.

i'd like to do some custom stuff(edit or add commands) like doing vertical steps with monsters(only horizontal exist at the moment) or make flash the enemies with a blue flash(in the same way of red or yellow flashes)

and since i don't have a clue, i wonder if anyone knows something about FA commands code...


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#2
Posts: 81
Threads: 4
Thanks Received: 6
Thanks Given: 6
Joined: Nov 2009
Reputation: 14
Status
Weakness
You are correct in stating that they do not jump to a portion of C2; what they do is load custom animations from the zillions of animations (which are well documented in the wiki here). Things like the flashing yellow are basically hard-coded within the animations; to make it blue you'd have to write a whole new animation script and then expand the animation script pointer table, and make it so that FA could index those (it's been a while so I don't remember if the FA command can actually access the full list, but I suspect that the answer is a resounding 'no' as FA is normally only used for a small subset of animation scripts).

Also, I'm quite interested in all the code hacking of the monster attack scripts. As some of you may know, my first public FF6-related project was one to create an invert (or NOT) bit on the FC commands, so that you could check for the opposite condition of any condition that vanilla checks for. The intended usefulness is that since vanilla FF6 does not do any sort of "OR" condition for its FC commands, but does include an "AND" condition; that by NOT-ing the NOTs of ANDs, you could sort of work around it. Later I added the ability to check for the lack of statuses as well, so that you could target only those who do not have Float status, for instance (great for a massive Quake attack, so I thought).

Also, in working on Pandora's Box, we decided to increase the number of F1 targeting types. I remember that we coded it so that you can target whichever character has the highest or lowest current HP, MP, or max HP or MP. It does that simply by running a quick comparison and getting the one with the desired stats.

Alas, it has been many years since I worked on FF6 and hacking, so I am quite rusty on it all, but I find it fascinating that after all this time so many people are still in the scene.


I appreciate the prayers and good wishes. Those who don't know, I was diagnosed with stage 4 melanoma in 2019, and I have done well with the treatment, but eventually treatments stop working and you change.  I recently had a seizure at work, now I am healing but not able to work or really do much at all. The focus is just to get better. Again, thanks for the support and if I can help you I will.  I've forgotten more about this game than most people should ever learn, lol.
  Find
Quote  

#3
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
you mean all those animation who are in bank D0?
to be honest i believe after i know the way to implement new code and call it correctly with FA parameters, then it would be a piece o' cake for me to implement it. Where's the animation script pointer table, anyway? if i know that then there's a good change i even understand the way parameters are read and what they point at...

What a coincidence! about FC command i didn't have intention to add many personal custom checks(i'd rather go for import Edrin's ones) but among all the things my first intention was to make the NOT check on the result of the previous check, since i still have to start to deal with FC command i have no idea on how FC commands works, but when i reach that point i might be able to figure it out.

the "old great ones" did an excellent job in the past with FF6 rom hacking, now it's time that even new people have to contribute in expand knowledge and stuff, i feel like this is the best period ever for FF6 hacking scenario!  Kungfu!


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#4
Posts: 181
Threads: 3
Thanks Received: 26
Thanks Given: 4
Joined: Apr 2015
Reputation: 18
Status
None
I think this might be what you're looking for:

Code:
; pointers to misc. monster animation data
C2/E5D3:              .DW $E613, $E619, $E61F, $E625, $E62B, $E607, $E60D, $E631
C2/E5E3:              .DW $E637, $E613, $E601, $E5FB, $E5F5, $E5EF

; misc. monster animation data (ai command $FA, aka command $2B)
C2/E5EF:              .DB $00, $04, $0A, $16, $01, $FF
C2/E5F5:              .DB $00, $04, $EE, $15, $01, $FF
C2/E5FB:              .DB $00, $04, $E0, $15, $01, $FF
C2/E601:              .DB $00, $04, $D2, $15, $01, $FF
C2/E607:              .DB $00, $05, $46, $15, $01, $FE
C2/E60D:              .DB $00, $05, $38, $15, $01, $FE
C2/E613:              .DB $00, $04, $FC, $0E, $01, $FF
C2/E619:              .DB $00, $04, $EE, $0E, $01, $FF
C2/E61F:              .DB $00, $04, $E0, $0E, $01, $FF
C2/E625:              .DB $00, $04, $F2, $14, $01, $FF
C2/E62B:              .DB $00, $04, $E4, $14, $01, $FF
C2/E631:              .DB $00, $04, $7E, $15, $01, $FF
C2/E637:              .DB $00, $04, $70, $15, $01, $FF

; [ Execute Misc. Monster Animation (AI Command $FA, Command $2B) ]

C2/E63D: A0 02 00     LDY #$0002
C2/E640: B1 76        LDA ($76),Y
C2/E642: 8D FC E9     STA $E9FC       ; target monster
C2/E645: 88           DEY
C2/E646: B1 76        LDA ($76),Y     ; ai command $FA subcommand
C2/E648: C9 09        CMP #$09
C2/E64A: D0 0D        BNE $E659       ; branch if not $09 (play sound effect)
C2/E64C: C8           INY
C2/E64D: B1 76        LDA ($76),Y     ; sound effect
C2/E64F: 85 10        STA $10
C2/E651: C8           INY
C2/E652: B1 76        LDA ($76),Y
C2/E654: 22 EB 17 C1  JSL $C117EB     ; play animation sound effect
C2/E658: 6B           RTL
C2/E659: C2 20        REP #$20
C2/E65B: 0A           ASL
C2/E65C: AA           TAX
C2/E65D: BF D3 E5 C2  LDA $C2E5D3,X   ; pointer to misc. monster animation script
C2/E661: 85 8F        STA $8F
C2/E663: 7B           TDC
C2/E664: E2 20        SEP #$20
C2/E666: 80 49        BRA $E6B1

The third and fourth byte of the "misc. monster animation data" are the pointer to the animation data at D0/7FB2. For example, glowing red is AI command FA, subcommand 00. The misc. monster animation data is at C2/E613. So the animation data for glowing red is at D0/7FB2 + $0EFC = D0/8EAE.

If you want to edit the actual animation scripts, take a look at the "Battle Animations Scripts" doc on the wiki: https://www.ff6hacking.com/wiki/doku.php...s:doc:game. You can search for "Misc. Monster Animation" to find the one you're looking for. The pointer table for these scripts is at D1/EAD8.
  Find
Quote  
[-] The following 2 users say Thank You to Everything for this post:
  • Imzogelmo (05-05-2016), Tenkarider (05-05-2016)

#5
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma




THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#6
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
(05-04-2016, 04:22 PM)Imzogelmo Wrote: You are correct in stating that they do not jump to a portion of C2; what they do is load custom animations from the zillions of animations (which are well documented in the wiki here). Things like the flashing yellow are basically hard-coded within the animations; to make it blue you'd have to write a whole new animation script and then expand the animation script pointer table, and make it so that FA could index those (it's been a while so I don't remember if the FA command can actually access the full list, but I suspect that the answer is a resounding 'no' as FA is normally only used for a small subset of animation scripts).

Also, I'm quite interested in all the code hacking of the monster attack scripts. As some of you may know, my first public FF6-related project was one to create an invert (or NOT) bit on the FC commands, so that you could check for the opposite condition of any condition that vanilla checks for. The intended usefulness is that since vanilla FF6 does not do any sort of "OR" condition for its FC commands, but does include an "AND" condition; that by NOT-ing the NOTs of ANDs, you could sort of work around it. Later I added the ability to check for the lack of statuses as well, so that you could target only those who do not have Float status, for instance (great for a massive Quake attack, so I thought).

Also, in working on Pandora's Box, we decided to increase the number of F1 targeting types. I remember that we coded it so that you can target whichever character has the highest or lowest current HP, MP, or max HP or MP. It does that simply by running a quick comparison and getting the one with the desired stats.

Alas, it has been many years since I worked on FF6 and hacking, so I am quite rusty on it all, but I find it fascinating that after all this time so many people are still in the scene.

Have you checked out my Monster AI Upgrade patch? It was bugged when i first released it, but its been fixed and does a lot of these expansions, and left some room for more. The AI script is really interesting and fun to edit. And its really modular, so its easy to make changes without blowing up something else.

https://www.ff6hacking.com/forums/showth...p?tid=2673
  Find
Quote  

#7
Posts: 81
Threads: 4
Thanks Received: 6
Thanks Given: 6
Joined: Nov 2009
Reputation: 14
Status
Weakness
No, I had not seen that, but it looks pretty good.

Understand that the stuff we did was before any decent disassemblers (all hand-editing of in hex) and was at least 2 computers ago, so it's hard to simply relocate stuff. But for the FC-invert patch, what I did was make the 2nd byte's high bit an inversion bit, so that (for instance) if you wanted to do FC 07 xx xx, but instead wanted to check for the opposite condition, you'd enter it as FC 87 xx xx. Then I'd rotate out the top bit before the pointer table, and then if the carry was set (meaning the top bit had been set) then I'd flip the condition (true becomes false, and vice versa). It was pretty awesome, because the inefficiency in that area meant that I could do all that in place with some better branching. Basically you get twice as many conditions for free.

Later on, working on the Pandora's Box team, we went even more crazy with it, adding several F1 targetting methods, the ability to check for absence of statuses, etc... but that was well into the xkas era so development was faster and less buggy.

I'm glad to see that user Everything has commented. I wanted to give a big kudos for the dump file he made of those animations (yes, D0 bank is where they are located, and from his information you can see how it would be possible to make some new ones for the FA command if desired).

There are a handful of bugfixes that would require someone to modify those animation scripts, bugfixes which, to my knowledge, no one has yet undertaken, most likely due to the great many unknowns remaining in that script. This dump file of the animation scripts makes me confident that some resourceful person could write an editor for them, much like the editor for the event script, which would make adding or modifying the animation scripts much more palatable for those who are interested (for bug fixing or completely new scripts, either way).


I appreciate the prayers and good wishes. Those who don't know, I was diagnosed with stage 4 melanoma in 2019, and I have done well with the treatment, but eventually treatments stop working and you change.  I recently had a seizure at work, now I am healing but not able to work or really do much at all. The focus is just to get better. Again, thanks for the support and if I can help you I will.  I've forgotten more about this game than most people should ever learn, lol.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite