The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.3.33 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




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)



Messages In This Thread
Having characters learn spells through events - by Angelo26 - 02-19-2011, 10:21 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite