Users browsing this thread: 1 Guest(s)
In-battle RAM editor code

#1
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
Hi!  Hello 
Well, the time has come: time to submit the important code i'm using for CotG i was talking about, the code is a battlescript AI expansion
(i use/expand FB command for it) that introduces(aside some Edrin's AI expansion command, since BG/BGM change kinda fits with the whole code)
a bunch of extra FB subcommands that are somehow an in-battle RAM editor console, with the right combination of commands i think you can basically edit ANY POSSIBLE RAM VALUE calling commands from an enemy AI and that means all RAM, SRAM as well(i don't know much about other types or subset of the RAM, but who knows how to deal with them should be able to deal with that) and, while you can do potentially anything in-battle, that also can involve some stuff outside battle, well maybe even more than "some stuff"... 

Warning:
1) this is not a patch, which means you have to download the file i'm linking below, and read it to pick the code raw hex and paste it in your rom 
    with an hex editor... well i tried my best to make it user-friendly to copy-paste, there's the address and everything you need to manually patch it. 
    the reason is
    - i'm lazy and have few time to dedicate to this effort, heh... despite i consider myself a perfectionist i'm not it that much afterall;  Finger
    - let's just say there's no need to do that, the file i linked tries to be user-friendly but the use of my code is the exact opposite, unlike FF3usME 
      is not a toy which anyone can use for lulz or serious stuff(and any shade in the middle), you DEFINITELY need to know how to deal with
      ASM/raw hex or it's just a bomb ready to explode, so the target of this "tool" is a niche of a niche of FF6 hackers, so no need to ask me how to
      paste it in a ROM: being able to do that on your own is kinda a prerequisite in order of being able to use the code properly;
    - the target of this code is easily someone who already dealt enough with ASM and/or implemented patches/custom code in their ROM(and yeah,
       probably he might already have started his own hack project since a while) which means there are very few chances there isn't ANY single 
       conflict with his edited ROM, that's a good reason to just check the file, addresses and pointers inside it and move their position into 
       a free space inside their ROM;

2) making an outstanding tutorial is out of scope, still i think the file and this OP should be enough to allow an interested FF6 ASM hacker to being 
    able to use the code well enough to start experimenting with it;

3) even me i'm far from knowing how to use the tool perfectly, some people among us is probably more suited to use this tool than me, that's a 
    very good reason to use this thread to also share any interesting use of this code that any of you might be able to discover(like for example doing 
    some impressive stunt with VRAM) ah, if that happens, don't share it only on Discord ot it will be buried from following posts! ;

4) the code assumes that the ROM you're using is headered and expanded to at least 4mb(if it's bigger than 4mb it doesn't change anything),
     yet if you're an headerless fanatic or something you can still avoid to adapt your ROM, but be aware of all the changes to my code you need to do
     in that case;

5) add/subtract operations shouldn't be able to recognize a carry flag situation on their own, pay attention to that!


Here's the link to the file with code and stuff:    
Download


Starting from here i'll describe the structure i created and some possible use of it.

Key battle variables:
Code:
4 (1DC9)  3EB4    // this value is the target of most of the instructions
5 (1DCA)  3EB5
6 (1DCB)  3EB6    // involved only in ROM operations 
7 (1DCC)  3EB7    // read values are stored here
8 (1DCD)  3EB8   // support variable(don't remember but maybe it's used in case read value is 2 bytes long)

starting from command 16, instructions will use battle variable 4 and 5 as a 2 bytes address(little endian order)
 in case of a long address even battle variable 6 will be used(still little endian order)

example:   
Code:
             |var 4| var 5 | var 6|
     ------------------------------
     value   | 00  |   00  |  F1  |   -> the address is 310200 in hex editor(it subtracts 0xC00000 to the value
                                                           and adds 0x000200 of the header)

you're probably gonna use commands 11-13 to configure manually the address


All my custom commands: (11-23)
Code:
- custom command(11) - Big set var 004   // F8 AI command assignment sucks(max 3F to make room to add/subtract)
    the third byte of the command(what i call the argument) is the value you assign to battle var 004, which this time is a value from 00 to FF

- custom command(12) - Big set var 005         
   
- custom command(13) - Big set var 006

- custom command(14) - Big set var 007       

- custom command(15) - Big set var 008

commands 11-15 main use is write the address for the next commands(read, write, jump, ecc  to/from RAM/ROM) 

Code:
- custom command(16) - Write on RAM                // assignment in other words
    write the argument in the RAM value indicated from battle var 004 and 005

- custom command(17) - Read from RAM       // store the value of the offset to battle variable 7 (1DCC)  3EB7
                       // argument is meaningless i think

- custom command(18) - add to RAM value   
   many of those commands work like command 16, what changes is the operation made on the RAM value pointed from battle vars

- custom command(19) - subtract to RAM value   

- custom command(1A) - OR operation to RAM value   // bit = 0 no effect; bit = 1 set bit

- custom command(1B) - AND operation to RAM value  // bit = 0 clear bit; bit = 1 no effect

- custom command(1C) - ASL/LSR operation to RAM value  // bit 0 = 0 ASL(molt by 2); else LSR(div by 2)

- custom command(1D) - Read from ROM          // store the value of the offset to battle variable 7 (1DCC)  3EB7
          // argument is meaningless i think

- custom command(1E) - long jump to whatever   // WARNING: it's easy to crush the game if you don't use it 
        //  properly, it's suggested to jump back with "5C 08 1F C2" at the end of the code you jumped at, 
        //  otherwise it's up to you finding a different solution
        //  argument is meaningless, unless you require it as parameter in the function you'll jump at      
     well, the code allows you to do a bunch of stuff but it's quite bulky, it might actually be a problem with AI bytes available if you heavily rely on it...
     this command can help you avoid that issue: if you know the code you're gonna use is long and possibly used many times, then you might 
     consider tossing that block of code somewhere in the expanded ROM and just jump there with this command, i'm DEFINITELY sure 
     you won't run out of space  :)

- custom command(1F) - transfer 3EB7 to RAM(battle variable 7 value)
                          // argument is meaningless i think
     assign battle var 007 value to RAM value address indicated in battle vars

- custom command(20) - add 3EB7 to RAM value
                 // argument is meaningless i think

- custom command(21) - subtract 3EB7 to RAM value
                 // argument is meaningless i think

- custom command(22) - 3EB7 OR RAM value
                    // argument is meaningless i think

- custom command(23) - 3EB7 AND RAM value
                    // argument is meaningless i think



Here's some application of my code:  (most of them are soft changes, you can do MUCH more with it)

a) flashback screen mode



hex code:
Code:
310200:           -> flashback mode   // as example for command(1E) - long jump to whatever
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF 
->
08 C2 10 A2 00 00 86 18 A2 00 02 86 1A 22 42 B4 
C2 EE 8A 62 7B AA BD 80 7F 9D AD 81 E8 E0 80 00 
D0 F4 28 5C 08 1F C2 
      
AI script:
Code:
[script #-1]   ; orig idx=0, "Guard", nb. bytes=29
F0 EE EE EF    ; Rand. spell: Battle or Battle or Special
FC 15 00 00    ; If VAR000 has all the following bit cleared: 0
F9 01 00 00    ; VAR000 set bit: 0
F3 00 00       ; Text: " Good ol' times!<D>"
FB 11 00       ; ???
FB 12 00       ; ???
FB 13 F1       ; ???
FB 1E 00       ; ???
FF             ; End first wave of attack
FF             ; End



b) colosseum battle mode 



AI script:
Code:
[script #-1]   ; orig idx=0, "Guard", nb. bytes=36
F0 EE EE EF    ; Rand. spell: Battle or Battle or Special
FC 15 00 00    ; If VAR000 has all the following bit cleared: 0
F9 01 00 00    ; VAR000 set bit: 0
F3 00 00       ; Text: " Colosseum mode!<D>"
FB 11 97       ; ???
FB 12 3A       ; ???
FB 16 01       ; ???
FF             ; End first wave of attack
FC 12 0C 00    ; If following monster is/are dead: #3, #4
F3 01 00       ; Text: " Colosseum mode off!<D>"
FB 16 00       ; ???
FF             ; End

[Image: 3d0gqypp7ci02i8zg.jpg]
Oh, i just noticed that zombie status while in Magitek will cause some weirdness, like controllable zombie(which perhaps aims like a zombie)
Since some people asked for colosseum AI for minions it came to my mind this thing i discovered a bunch of time ago while messing with my code.
Also... you need to remove the colosseum mode before the fight ends or the battle prize will be the one used for colosseum(a dirk in this case)
noticing this detail actually made me figure out something quite interesting...



3) Ok, let's do something more serious: 



(Borrowed the video from Madsiur's channel but it's my clip so yeah  Tongue )
well... here a bunch of stuff happens: 
  - before the clip starts i changed allies sprites to dead pose(despite they are still alive)
  - then the BG palettes changes(toned darker)
  - i change the battle menu cursor from finger icon to Zzz icon
i don't have the code i used back to that time, but the code that makes change the color to the BG was something like this:

AI script:
Code:
FB 11 A0       ; ???
FB 12 7E       ; ???
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
F8 04 81       ; 1 added to VAR004
FB 18 10       ; ???
FF             ; End first wave of attack
FF             ; End



4) pseudo-battle event + calling a map event from a random battle:    
    (sorry LK2, i'm gonna recycle your secret santa since i don't wanna create something new... takes some time i don't have)



did that look like a battle event? nope, it was my code... i can replicate a battle event with that, but without a limit
Oh, and if you pay attention at the end there's a mini-custom map event after the battle, but that was just a random battle
It's a known fact that you can't call an event from a battle, but with my code i discovered how to do it... let's start from that AI:

AI script:
Code:
[script #-1]   ; orig idx=8, "Kaiser", nb. bytes=968
FC 15 00 00    ; If VAR000 has all the following bit cleared: 0
FB 0E 2B       ; ???
FB 11 C1       ; ???
FB 12 61       ; ???
FB 16 1C       ; ???
FB 16 17       ; ???
FB 16 1C       ; ???
FB 16 17       ; ???
FB 16 1C       ; ???
FB 16 1C       ; ???
FB 16 1C       ; ???
FB 16 00       ; ???
F3 05 00       ; Text: " T SANTA!!! <D><F> Let's party! First_ <D>
we need the right place! *snap* <D>"
FB 0F 12       ; ???
F3 06 00       ; Text: " *snap* <D> "
FB 0E 15       ; ???
F3 07 00       ; Text: " And now_ Let's dance!!! <D><D>"
F8 04 C1       ; 1 subtracted from VAR004
FB 16 25       ; ???
F9 01 00 00    ; VAR000 set bit: 0
FE             ; End If and reset targeting
FB 11 F3       ; ???
FB 12 80       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FD             ; Wait until the attack sequence is called upon again, then continue (reset targeting)
FB 11 C0       ; ???
FB 12 61       ; ???
FB 16 23       ; ???
FB 11 F3       ; ???
FB 12 80       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FD             ; Wait until the attack sequence is called upon again, then continue (reset targeting)
FB 11 BE       ; ???
FB 12 61       ; ???
FB 16 80       ; ???
FB 11 C0       ; ???
FB 16 25       ; ???
FB 11 F3       ; ???
FB 12 80       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FD             ; Wait until the attack sequence is called upon again, then continue (reset targeting)
FA 06 00 00    ; Allies switch from right to left side
FB 11 C0       ; ???
FB 12 61       ; ???
FB 16 25       ; ???
FB 11 F3       ; ???
FB 12 80       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FD             ; Wait until the attack sequence is called upon again, then continue (reset targeting)
FB 11 C0       ; ???
FB 12 61       ; ???
FB 16 23       ; ???
FB 11 F3       ; ???
FB 12 80       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FD             ; Wait until the attack sequence is called upon again, then continue (reset targeting)
FB 11 BE       ; ???
FB 12 61       ; ???
FB 16 00       ; ???
FB 11 C0       ; ???
FB 16 25       ; ???
F3 08 00       ; Text: " great!! now 2 times faster!!! <D>"
FB 11 F3       ; ???
FB 12 80       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 00       ; ???
FD             ; Wait until the attack sequence is called upon again, then continue (reset targeting)
FB 11 C0       ; ???
FB 12 61       ; ???
FB 16 23       ; ???
FB 11 F3       ; ???
FB 12 80       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FD             ; Wait until the attack sequence is called upon again, then continue (reset targeting)
FB 11 C0       ; ???
FB 12 61       ; ???
FB 16 25       ; ???
FB 11 BE       ; ???
FB 16 80       ; ???
FB 11 F3       ; ???
FB 12 80       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FD             ; Wait until the attack sequence is called upon again, then continue (reset targeting)
FA 05 00 00    ; Allies switch from left to right side
FB 11 C0       ; ???
FB 12 61       ; ???
FB 16 25       ; ???
FB 11 F3       ; ???
FB 12 80       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 01       ; ???
FD             ; Wait until the attack sequence is called upon again, then continue (reset targeting)
FB 11 C0       ; ???
FB 12 61       ; ???
FB 16 23       ; ???
FB 11 F3       ; ???
FB 12 80       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 16 01       ; ???
FB 16 03       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 02       ; ???
FB 16 00       ; ???
FB 11 BE       ; ???
FB 12 61       ; ???
FB 16 00       ; ???
FB 11 C0       ; ???
FB 12 61       ; ???
FB 16 00       ; ???
F3 09 00       ; Text: " Well, still better than a fight_ <D> Muahahah! see you later!! <D><D>"
F5 05 04 00    ; Monsters  are hidden without affecting their HP, from top in swirl
FB 11 8D       ; ???
FB 12 11       ; ???
FB 16 26       ; ???
FF             ; End first wave of attack
FF             ; End

I don't remember exactly but i think the trick is in the last 3 unknown lines of that AI, basically i write in $118D  0x26 value... ok, so what?
That's the clue:
Code:
$1188-$119F Timer Data (4 items, 6 bytes each)
-----------
     $1188 pfrm----
           p: pause timer in menu and battle
           f: timer visible on field (timer 0 only)
           r: used if timer runs out during emperor's banquet     // quit battle/menu and trigger event?
           m: timer visible in menu and battle (timer 0 only)   // in real time -> analyze F2 8D XX YY
   + $1189 counter (frames)           // 89 = 0-255 frames; 8A = 0-255 * 255 frames; 60 frames = 1 second
  ++ $118B pointer to event code (+CA0000)    //!!! CA | 00 | 00 ---> 00($118B) | 00($118C) | CA($118D) !!!
                              // ++ $118B saved in $E5?  // no, the commands within it
       // if you put a shop in the event(ex.) you must wait some frame(8 at least i think), otherwise it changes screen before
       // the timer disappears and goes into loop(use for example command 91 for waiting 15 frames)
it's a piece of Everything's RAM map that i commented with the result of my tests, well do you see "$118B pointer to event code (+CA0000)" ?
that's the most important thing: when a timer expires, the event address that kicks in is saved in those 3 bytes, starting from CA0000, which means
that you're not even limited to bank CA-CB-CC, you can put that event in the expanded area and voilà: infinite space for events!
i think that the timer even when it's disactivated is 00:00:00, well $118B i guess that most of the times is resetted to 000000, if i'm not wrong is
an empty event, according to the flags and vars you see above you can customize your timer and also trigger the event during or after the battle
though there's no need to change the timer, if you change those 3 bytes the timer should awake, and since it's at 00:00:00 you can launch the event
immediately, if you want... and if you force the quit for making start the event, then i think you can also interrupt an event that was happening to 
make start the one that you decided to trigger, and that means another thing: you can multi-fork events according to what happens in battle!!
PS. as soon as you change the timer, it will start to go immediately, of course... there's a flag that blocks it and/or makes it restart.
Well, i think that's REALLY amazing, you can test it on your own, after a while you should be able to figure out how to use it, 
just pay attention at not triggering that Cid clock's glitch that has been discovered recently. 



Well, i think that's enough... the code is here: if it interests you, go to the link and stick it to your ROM, it's up to you decide how to use it.
The only limit is immagination, your tastes and ASM skills  Hold on
Ah, don't forget to use the RAM map, without that it's like driving blindfolded.



EDIT: fixed the text and some slight cosmetic change in order of making more enjoyable your reading of the OP

_____________________________

credits: 
- Everything for his super RAM map, which is kinda a must to use this code
- Edrin for his improved AI battlescript, there's some code that belongs to him, like change BGM/BG because
   it fits in any case and well... because there's no need to reinvent the wheel if it already exists and works
   well
- FF6Hacking.com community, as always... afterall what the heck would i know about FF6 hacking without them? Tongue


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  
[-] The following 5 users say Thank You to Tenkarider for this post:
  • Gi Nattak (03-21-2018), JWhiteLXXXIX (03-19-2018), madsiur (03-19-2018), Robo Jesus (03-19-2018), Warrax (09-17-2018)

#2
Posts: 3,966
Threads: 279
Thanks Received: 234
Thanks Given: 56
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
This submission is the weirdest thing I've ever seen here but it's a 5 stars "RAM Editor"! Good job!
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • Tenkarider (03-19-2018)

#3
Posts: 281
Threads: 18
Thanks Received: 12
Thanks Given: 8
Joined: Mar 2014
Reputation: 8
Status
None
I agree, this is some crazy shit. Turning the ai script engine into a full blown code interpreter moor or less. You can do anything with this if you have the patience to write a whole lot of ai script. Tongue
  Find
Quote  
[-] The following 1 user says Thank You to seibaby for this post:
  • Tenkarider (03-19-2018)

#4
Posts: 45
Threads: 0
Thanks Received: 0
Thanks Given: 24
Joined: Feb 2015
Reputation: 0
Status
None
This is the sort of thing you expect to read about in attempts at creating AI, or gods forbid, Seed AI. Like, the sort of thing you would find in a setting like Eclipse Phase while dealing with TITAN remnants. It's fluid as hell, and being able to turn the ROM of an SNES game into something fluid like this is, well, it's unexpected as can be. Shockingly so.

...if someone uses this sort of programming to build killer robots, I vote we name it magitek. Evil laugh Tongue
  Find
Quote  
[-] The following 1 user says Thank You to Robo Jesus for this post:
  • Tenkarider (03-19-2018)

#5
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
lol, i heard with ZNES the code can escape outside the emulator... who knows, maybe in that case with this code it's possible to control a PC and reaching
the web as well, that's my chance to conquer the world!  Laugh Kappa! 

You know, when i was making those commands i wanted to implement also long jump write(alias write on ROM), which would have been the ultimate code,
obviously it didn't work but back to that time i forgot the reason why it didn't so i asked to Everything and when he said it was because
ROM is Read Only Memory i stopped for a second, then i chuckled and finally laughed, realizing how much dumb i was at forget about something so trivial  Finger


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  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite