Users browsing this thread: 1 Guest(s)
Having characters learn spells through events

#1
Posts: 831
Threads: 41
Thanks Received: 16
Thanks Given: 12
Joined: Nov 2009
Reputation: 18
Status
None
[/u]This tutorial should allow people who are editing events to give any spell to a character in an event. This was requested by xJCSx, and hopefully I'll be making a patch soon.

There are several event commands that are used in the game (3F adds or removes a character from the party, F0 plays a song, etc), but there's is no event command assigned in the game to have characters learn spells, unlike FF4 (Tellah learns meteor in FF4 as a result of an event). However, there's some unused code to do this in the game, in the C0 bank, and it's a matter of changing some bytes to make this work.

Code:
C0/AE0D:    A5EB        LDA $EB
C0/AE0F:    8D0242      STA $4202    
C0/AE12:    A936        LDA #$36      
C0/AE14:    8D0342      STA $4203    
C0/AE17:    A5EC        LDA $EC    
C0/AE19:    C221        REP #$21
C0/AE1B:    EA          NOP
C0/AE1C:    6D1642      ADC $4216      
C0/AE1F:    AA          TAX            
C0/AE20:    7B          TDC
C0/AE21:    E220        SEP #$20      
C0/AE23:    A9FF        LDA #$FF    
C0/AE25:    9D6E1A      STA $1A6E,X    
C0/AE28:    A903        LDA #$03      
C0/AE2A:    4C5C9B      JMP $9B5C

The code above expects two bytes as inputs: The byte corresponding to the character ID, and the byte corresponding to the spell ID.

A Jump table is available starting at C0/98C4 and ending at C0/9A58 for general events. These jump tables tell the game to "jump to a specific address in that bank to look for the code associated with the event".
As an example, take the event command 8F: This command is used in doma for cyan to learn all his bushido skills. The address at which the jump table is located for the command 8F is at

C0/9978: F8AF     (gen. act. 8F)

This means that at the address C0/9978, there's a JUMP to the address C0/F8AF to look for the code that grants cyan all his bushido skills.
Now, if we replace the code from the command 8F so we can assign spells in events, we just need to change the two bytes from the jump table, "F8 AF" to "AE 0D" (in reverse order). By doing this, the game will read the code corresponding to assigning spells.

Last, but not least, This command needs two bytes as inputs, corresponding to the character ID and the spell number, starting with black magic (00 is fire, 01 is ice, etc.). If you want to use the newly assigned command 8F to teach terra the spell Fira, the command is as follows:

8F, 00, 06 --> 00 is the character ID, and 06 is the byte of the spell (starting with black magic).

If you do this, remember to go to the event dump, find the address at which cyan learns his skills, and be sure to remove the byte 8F from that event! (Replace it by FD). This way your game will not freeze during that event.

A video in which all of the above changed have been done, and terra is given 3 spells during one of the battles with narshe guards is here:

[youtube]http://www.youtube.com/watch?v=bRVm-USE1js[/youtube]

I'll probably be adding a complete list of all spells later on.
Quote  
[-] The following 3 users say Thank You to Angelo26 for this post:
  • h.carrell (01-07-2022), Morendo (01-11-2020), SSJ Rick (05-01-2014)

#2
Posts: 2,548
Threads: 98
Thanks Received: 147
Thanks Given: 156
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Awesome stuff Angelo, thanks for sharing this.


We are born, live, die and then do the same thing over again.
Quote  

#3
Posts: 161
Threads: 14
Thanks Received: 4
Thanks Given: 0
Joined: Sep 2010
Reputation: 5
Status
None
Wow I completely never saw this post ha :p But thanks for showing the coding of this! I was extremely surprised to find that Square never made a command for learning magic.
If/once I get back to my game (should be a "once") this is definitely going to make my Crystal ability system 100x easier. While I'm still brainstorming the possibilities, the learning of the Crystal magicks will be story related i.e. Lenna (the only one granted "Crystal") will learn a certain spell through a story sequence.
All in all, a BIG help, thanks again!


[Image: funnysiga.jpg]

MY YOUTUBE CHANNEL Laugh
http://www.youtube.com/user/xJCSx1
  Find
Quote  

#4
Posts: 831
Threads: 41
Thanks Received: 16
Thanks Given: 12
Joined: Nov 2009
Reputation: 18
Status
None
I think it should be OK for you to return hacking around summer time? Or you home schooling goes all year long? Or maybe you're thinking about doing other activities you go and do other activities...just wondering lol
Quote  

#5
Posts: 161
Threads: 14
Thanks Received: 4
Thanks Given: 0
Joined: Sep 2010
Reputation: 5
Status
None
Ha it ends actually at the last week of April, and that's when I'm going to ask my parents and see if it's OK with em. I honestly think that with the summer, ROM hacking will be soo much easier, hardly any stress IMO and just altogether the best time to ROM hack. There will be one week of July where I'll be going on a summer camp so I'll be outta commission until that next Monday, but that'd be the only thing I can think of :p
I'll probably announce that I can ROM hack in the shout box. Smile
And then maybe me and you could make some fun episodic hacks together or something? I remember wanting to replace the Chocobo's sprite, thanks to the new FF3usME, to Wyvern and make an aerial event battle with Wyverns! Laugh
I think my imagination might be getting the best of me lolz but I do believe things like that are possible!
And hey who knows, maybe even a core hack one day!


[Image: funnysiga.jpg]

MY YOUTUBE CHANNEL Laugh
http://www.youtube.com/user/xJCSx1
  Find
Quote  

#6
Posts: 831
Threads: 41
Thanks Received: 16
Thanks Given: 12
Joined: Nov 2009
Reputation: 18
Status
None
Spell bytes for using the event command to make characters learn magic:

Code:
00 - Fire
01 - Blizzard
02 - Thunder
03 - Poison
04 - Drain
05 - Fira
06 - Blizzara
07 - Thundara
08 - Bio
09 - Firaga
0A - Blizzaga
0B - Thundaga
0C - Petrify (Break)
0D - Death
0E - Holy
0F - Flare
10 - Gravity (Demi)
11 - Gravija (Demi 2)
12 - Degen (X-Zone)
13 - Meteor
14 - Ultima
15 - Quake
16 - Tornado
17 - Meltdown (Merton)
18 - Libra
19 - Slow
1A - Rasp
1B - Mute
1C - Protect
1D - Sleep
1E - Confuse
1F - Haste
20 - Stop
21 - Berserk
22 - Float
23 - Imp
24 - Reflect
25 - Barrier/Shell
26 - Vanish
27 - Haste2/Hastega
28 - Slow2/Slowga
29 - Osmose
2A - Warp
2B - Quick
2C - Dispel
2D - Cure
2E - Cura
2F - Curaga
30 - Life
31 - Life2/Arise
32 - Life3/Reraise
33 - Esuna/Remedy
34 - Regene/Regen
35 - Poisona/Antidote
Quote  

#7
 
Status
None
Would the same event allow me to add a spell (or a move) to the list of magitek? I could use magitek which is a not so used command for a character and have new magiktek spells added throughout the progression of the game. Thanks.
 
Quote  

#8
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
No, the code here alters the RAM that holds each character's learned magic list. There is no such list for Magitek. That would require a major overhaul of the Magitek code, as well as unused RAM for the list of learned "Magitek" attacks, unless you use an existing element that naturally progresses through the game to determine when each ability becomes available, such as character level. Either way, ASM hacking required.
  Find
Quote  

#9
Posts: 831
Threads: 41
Thanks Received: 16
Thanks Given: 12
Joined: Nov 2009
Reputation: 18
Status
None
I did not mean to necropost...but I needed the information from this post to do something, and I found some erroneous information. The spell values for the command 8F are now updated. Also, note that this only applies for PC's. You cannot have characters like Biggs, Wedge or Kefka learn spells this way.
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite