Users browsing this thread: 1 Guest(s)
Restrict Espers by Character

#1
Posts: 3,674
Threads: 267
Thanks Received: 701
Thanks Given: 300
Joined: Oct 2011
Reputation: 60
Status
Faith
Author: Synchysi
Download


This hack allows for restricting espers by character to add individuality (or remove customization, depending on your point of view) to the game beyond unique battle commands. There is no limit to how many characters can equip any certain esper.

It is best used in conjuction with a rather thorough overhauling of esper spell lists and level bonuses.
  Find
Quote  
[-] The following 3 users say Thank You to madsiur for this post:
  • Gi Nattak (07-13-2018), SSJ Rick (01-20-2015), Timbo (02-24-2017)

#2
Posts: 31
Threads: 4
Thanks Received: 50
Thanks Given: 1
Joined: Apr 2018
Reputation: 2
Status
Shell
I modified this patch to use quite a bit less space. It uses a bitmask for which characters equip espers similar to way the equipment does, instead of a bunch of jump tables.

Code:
hirom   ; Don't change this.
header  ; Comment out if your ROM has no header.

; Restricts espers to be equippable only by certain characters set in the tables at the bottom.
; All locations have only been tested in FF3us ROM version 1.0, although it should work in version 1.1.
; This will likely not work in the Japanese version.
; Uses 138 bytes of free space at the end of bank C3.
; Address range utilized: C3/F091 to C3/F11A

; Loads the skills menu and gets the character ID. We interrupt this routine in order
; to store the character ID in $1CF8 (formerly Bushido names in the Japanese version;
; unused in FF3us).
; This is why it likely won't work in FF3j, although I suppose you could just find
; another unused location.

org $C31B61
JSR StChr

; Checks if any espers are already equipped. We come here just to create a label for
; ease of use and readability.

org $C35576
ChkEq:

; Sets text color to blue. This block is only executed if the esper is in question is
; already equipped by someone else.

org $C35593
LDA #$2C        ; #$2C for grey text with a blue shadow/#$24 for blue

; Sets text color of the current esper to be printed. As above, we only come here to
; create a label. If an esper can't be equipped because a character can't use it, the
; text will be gray. If an esper can't be equipped because someone else already has it,
; the text will be blue. Otherwise, it'll be white.
; The game will later use the text color to determine whether to allow a character to
; use a particular esper.

org $C35595
SetTxtColor:

; This prints out the name of the person currently using the esper you're trying to
; equip, which was originally the only thing stopping someone from equipping a certain
; esper. We need to change this, as the name will be blank if the character simply
; can't equip it.

org $C355B2
JSR Uneq

; The following lines originally jumped to the subroutine for checking if espers were
; already equipped (C3/5574). This check obviously isn't necessary if the character is
; unable to equip the esper anyway.

org $C35524
JSR ChkEsp

org $C358E1
JSR ChkEsp

org $C359B1
JSR ChkEsp

; Checks if the text color is gray, and BZZTs the character if it is. Since we're also
; using blue to indicate an unequippable esper, we'll simply change the comparison from
; "if not gray, branch" to "if white, branch"

org $C358E8
CMP #$20
BEQ WhiteTxt

; Actions to perform if selecting anything in white text. We come here only to make
; a label

org $C35902
WhiteTxt:

; Custom functions follow.

org $C3F091         ; Start of free space in bank C3.
StChr:                ; Gets the ID of the current character and stores it for later use.
TAX
LDA $69,X
STA $1CF8
RTS

ChkEsp:                ; Checks if a character can use an esper before checking if someone else has it equipped.
PHX                    ; Preserve X. May or may not be necessary, but better safe than sorry.
PHP
STA $E0                ; Stores the esper ID for later use. Could use the stack, but the esper ID needs to go into $E0 anyway.
ASL
TAX
REP #$20
LDA EsperTable,X    ; Get esper equip bitmask
SEP #$10
LDX $1CF8            ; Character ID, from above.
AND $C39C67,X        ; AND with 2^X
BEQ NoEq

Eq:
PLP
PLX
JMP ChkEq

NoEq:
PLP
PLX
LDA #$28            ; Grey text color
JMP SetTxtColor

; Handles error messages in the case of trying to equip a grey esper.

Uneq:
LDA $1602,X            ; Character's name.
CMP #$80            ; If the first letter isn't blank, then someone has the esper equipped and we can go back to tell the player as much.
BCS Exit
PLX                    ; Else, the character can't equip the esper at all and we need to tell the player as much.
LDX $00                

; Above: PLX because we no longer need to RTS to where this subroutine was called from.
; Sloppy, I know. BCS alone (instead of branching to an RTS) won't work because the branch is just too long.
; I'm looking for a way to streamline it.
; LDX $00 because it's necessary anyway as a counter for the next block.

; The following is identical to the code that prints "<Char> has it!",
; just altered slightly so it reads "Can't equip!"

LoadNoEqTxt:
LDA NoEqTxt,X
BEQ Null            ; If the character (letter) being written is null ($00), end the line.
STA $2180            ; Print the current letter.
INX                    ; Go to the next letter.
BRA LoadNoEqTxt
Exit:
RTS

Null:
STZ $2180            ; End this string.
JMP $7FD9

; "Can't equip!" text.
NoEqTxt:
DB $82,$9A,$A7,$C3,$AD,$FF,$9E,$AA,$AE,$A2,$A9,$BE,$00

; Esper equip table.
; Bitmask for which characters can equip the esper
; $0001    = Terra can equip
; $0002    = Locke
; $0004    = Cyan
; $0008    = Shadow
; $0010    = Edgar
; $0020    = Sabin
; $0040    = Celes
; $0080    = Strago
; $0100    = Relm
; $0200    = Setzer
; $0400    = Mog
; $0800    = Gau
; $1000    = Gogo
; $2000    = Umaro

; Logical OR them together to let multiple characters equip
; So $0030 = Figaro bros only
; $0141 = girls only
; $3fff = all 14 chars
; etc.

EsperTable:
DW $0000        ; Ramuh
DW $0000        ; Ifrit
DW $0000        ; Shiva
DW $0000        ; Siren
DW $0000        ; Terrato
DW $0000        ; Shoat
DW $0000        ; Maduin
DW $0000        ; Bismark
DW $0000        ; Stray
DW $0000        ; Palidor
DW $0000        ; Tritoch
DW $0000        ; Odin
DW $0000        ; Raiden
DW $0000        ; Bahamut
DW $0000        ; Alexander
DW $0000        ; Crusader
DW $0000        ; Ragnarok
DW $0000        ; Kirin
DW $0000        ; ZoneSeek
DW $0000        ; Carbunkle
DW $0000        ; Phantom
DW $0000        ; sraphim
DW $0000        ; Golem
DW $0000        ; Unicorn
DW $0000        ; Fenrir
DW $0000        ; Starlet
DW $0000        ; Phoenix

; EOF
  Find
Quote  
[-] The following 5 users say Thank You to Subtraction for this post:
  • madsiur (04-05-2018), Robo Jesus (04-05-2018), seibaby (04-05-2018), Turbotastic (04-05-2018), Warrax (04-06-2018)

#3
Posts: 110
Threads: 4
Thanks Received: 15
Thanks Given: 1
Joined: Jan 2012
Reputation: 4
Status
None
Funny, I actually made the same modification when I implimented it into Meltdown. It's sloppy and directly integrated into my other esper material though, and therefore unreleasable.
  Find
Quote  

#4
Posts: 6
Threads: 0
Thanks Received: 0
Thanks Given: 0
Joined: Oct 2019
Reputation: 0
Status
None
This is really cool, and got it working fine on a vanilla rom.

But it doesn't work with, Ted Woolsey Uncensored edition. I surmise it is conflicting with the Restored Ability Names portion of the hack, but that is just a guess as I really don't know. I did make sure to add a header to TWUE, and tried patching it from all angles, but it simply isn't compatible.

At the end of the day, the Restricted Espers code needs to he moved. I would do it myself, but I haven't got a clue on how to do it.

Can someone who moves code around all the time do this? I would be very grateful.

I think TWUE + Restricted Espers = The definitive version of the game.
  Find
Quote  

#5
Posts: 3,674
Threads: 267
Thanks Received: 701
Thanks Given: 300
Joined: Oct 2011
Reputation: 60
Status
Faith
(11-01-2019, 12:37 PM)fw4210 Wrote: I would do it myself, but I haven't got a clue on how to do it.

You could use @Subtraction code. Copy all the code block into a text file and replace the extension by .asm. Then use xkas 0.06 in command line like this: xkas filename.asm rom.smc. You'll need to edit this line to a free space block in bank $C3 ($03F091-$03FFFF) that TWUE doesn't use (if you look it up in a hex editor bytes would be a bunch of FF).

Code:
org $C3F091         ; Start of free space in bank C3.

This is one problem for sure, I know TWUE use $C3F091 ($03F091) and up so if there is room it would probably be near the end of the bank (nearer $03FFFF). Note that you'll need to make sure code doesn't overflow in bank $C4. There could be more compatibility problems with the hack, but that one is one for sure.
  Find
Quote  

#6
Posts: 6
Threads: 0
Thanks Received: 0
Thanks Given: 0
Joined: Oct 2019
Reputation: 0
Status
None
(11-01-2019, 03:11 PM)madsiur Wrote:
(11-01-2019, 12:37 PM)fw4210 Wrote: I would do it myself, but I haven't got a clue on how to do it.

You could use @Subtraction code. Copy all the code block into a text file and replace the extension by .asm. Then use xkas 0.06 in command line like this: xkas filename.asm rom.smc. You'll need to edit this line to a free space block in bank $C3 ($03F091-$03FFFF) that TWUE doesn't use (if you look it up in a hex editor bytes would be a bunch of FF).

Code:
org $C3F091         ; Start of free space in bank C3.

This is one problem for sure, I know TWUE use $C3F091 ($03F091) and up so if there is room it would probably be near the end of the bank (nearer $03FFFF). Note that you'll need to make sure code doesn't overflow in bank $C4. There could be more compatibility problems with the hack, but that one is one for sure.

Pardon my noobery, but I need to make sure what I am going to do is correct, as I have never done it.


I take the rom that has TWUE on it. Throw it in subtraction code. Change the extension to .asm.

Now take that .asm file to xkas (xkas "filename".asm rom.smc.)  Find Bank $C3, $03F091. Cut it. Now move it to say, $03FEEE. Would that be enough space? What would you recommend?

Then patch restricted espers to the newly vacated space?  

Profit???? Victory

Or would it be wiser to take the restricted espers, asm, and move it to $03FEEE?

*EDIT* I think I am in way over my head on this one.  Laugh
  Find
Quote  

#7
Posts: 3,674
Threads: 267
Thanks Received: 701
Thanks Given: 300
Joined: Oct 2011
Reputation: 60
Status
Faith
(11-02-2019, 01:22 PM)fw4210 Wrote: I take the rom that has TWUE on it. Throw it in subtraction code. Change the extension to .asm.

Now take that .asm file to xkas (xkas "filename".asm rom.smc.)  Find Bank $C3, $03F091. Cut it. Now move it to say, $03FEEE. Would that be enough space? What would you recommend?

You just need to change the org $C3F091 instruction to newly vacant space before using xkas. If $C3FEEE is a bunch of FF up to $C3FFFF then you can use this. I don't know how much free space is needed for the hack, so try the lowest offset possible.
  Find
Quote  

#8
Posts: 6
Threads: 0
Thanks Received: 0
Thanks Given: 0
Joined: Oct 2019
Reputation: 0
Status
None
(11-02-2019, 04:31 PM)madsiur Wrote:
(11-02-2019, 01:22 PM)fw4210 Wrote: I take the rom that has TWUE on it. Throw it in subtraction code. Change the extension to .asm.

Now take that .asm file to xkas (xkas "filename".asm rom.smc.)  Find Bank $C3, $03F091. Cut it. Now move it to say, $03FEEE. Would that be enough space? What would you recommend?

You just need to change the org $C3F091 instruction to newly vacant space before using xkas. If $C3FEEE is a bunch of FF up to $C3FFFF then you can use this. I don't know how much free space is needed for the hack, so try the lowest offset possible.

I think I am getting a better understanding.


Does "org" = original rom, as in vanilla? How do I move $C3F091 instruction, again? And finally can I use SNEStuff instead of xkas? That is what I used before to patch in restricted espers.
  Find
Quote  

#9
Posts: 2,231
Threads: 90
Thanks Received: 263
Thanks Given: 268
Joined: Aug 2009
Reputation: 40
Status
Nattak\'d
ORG is where the code will be placed, it tells the assembler to modify the ORIGIN of memory instructions from that specific point.
So you would just change the org $C3F091 to whatever free space spot you have in mind.
SNEStuff does seem able to patch ASM files (by use of xkas), I never noticed that!


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

#10
Posts: 6
Threads: 0
Thanks Received: 0
Thanks Given: 0
Joined: Oct 2019
Reputation: 0
Status
None
(11-02-2019, 06:32 PM)Gi Nattak Wrote: ORG is where the code will be placed, it tells the assembler to modify the ORIGIN of memory instructions from that specific point.
So you would just change the org $C3F091 to whatever free space spot you have in mind.
SNEStuff does seem able to patch ASM files (by use of xkas), I never noticed that!
I am sorry guys. I am no hacker or software developer, so I will be easily stumped by the most basic terms that you guys don't even give a second thought about.

Okay, so I get the conflict is happening at $C3F091 between Restricted Espers & TWUE, and it needs to be moved. But I am still struggling with which rom I am supposed to change though? The vanilla rom, the TWUE rom, or the Restricted Espers rom? And what tool or method do I use to move it?

Yeah, SNEStuff was suggested in the readme for the Restricted Espers patch. It was very easy to do, so I will stick with that over using xkas directly.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite