Shock Ability
05-27-2018, 10:52 PM
(05-27-2018, 05:43 PM)madsiur Wrote: The first 4 pairs of bytes are pointers to animation scripts, regrouped by layer or sprite script. In order to get what you want, use the same value at the same place as another spell with the bubble effect. You can also change the scripts themselves but it's more work.
That's just it; there are no other spells with the bubble effect. The Bubble effect only seems to be used by special attacks by monsters and by items themselves, not other spells. I actually wouldn't mind the vanish spell effect, but the character starts to turn invisible before they suddenly have the image appearance instead.
With the help of the animation disassembly and FF6MDE, you could maybe find it with trial and error. It seems the monster special 8-byte animation data reference same scripts as 14-bytes animation data. You can change the byte in FF6MDE and you'll have descriptions, you can try $00 to $FF. You can also try manual searches in the disassembly, there are a bunch of things in there, monster animation, weapons, spells, items, etc. To reference a disassembly script in your animation data, use the offset without the bank (1234 for $D01234 as an example). Like I said I think sprite animations should be in correct of 4 slots, same for BG1 and BG2 animations.
05-31-2018, 07:32 PM
So I got bored and coded up an MP-costing Shock. Only needed 70 bytes of space, even! (And I'm going to look at getting it into even less free space, but it's functional and, I think, not too shabbily done so far.)
With this code:
With this code:
- Shock costs 50MP (set by a !define at the start of the code)
- Shock's MP cost is adjusted by Gold Hairpin/Economizer.
- Shock is disabled when current MP is below 50MP
- Shock is disabled when muted
- Shock is properly enabled when MP goes back above 50, and when unmuted
Code:
hirom
; header
; Defines
!Freespace_1 = $c2A65A ; 26 bytes, or 70 total
;!Freespace_2 = $c2xxxx ; 27 bytes (if separate from above)
;!Freespace_3 = $c2xxxx ; 17 bytes (if separate from above)
!Shock_ID = $1B
!Shock_MP = $32 ; or 50d
;;; Flagging menu redraw on MP restore/loss
; These were all originally STA $3C08,Y (and one ,X).
; They now jump to new generic functions that update current MP,
; but also flag the attacker/target (as relevant) to have their
; menu updated for Shock's MP cost.
;
; Nothing needed to be done for Mute, as it already flagged the
; function appropriately, and Shock piggybacks on Magic/Lore/X-Magic
; for handling it.
org $C21365
JSR flagSTAY
org $c21375
JSR flagSTAY
org $c2137D
JSR flagSTAY
org $c232E0
JSR flagSTAX
org $c23CB4
JSR flagSTAY
org $c23F47
JSR flagSTAY
;;; Adding MP Cost to Shock
; Added a jump in the middle of the MP cost code; new code
; replicates the same check for Summon, then checks for Shock
; before jumping back to this codeblock as appropriate.
org $C24F14
JMP shockMP : NOP
;;; Disabling Shock at less than 50MP
; Adjusts some table pointers, and then includes new code includes
; the space opened up by moving the tables to freespace.
;
; New code checks current MP against cost of Shock and disables
; (greys out) the command if MP is too low.
org $c252C6
LDX #$0008
CMP.l c2_table1,X ; Moved table to free space because it's being expanded
org $c252D2
JSR (c2_table2,X) ; Moved table to free space because it's being expanded
org $c252E9 ; Code fits into the place freed by the moved tables
dis_Shock: REP #$20 ; Set 16-bit A
LDA.w #!Shock_MP ; LDA with $32/50d
CMP $3C08,Y ; Compare it to current MP and restore processor flags from stack
SEP #$20 ; Set 8-bit A
BCC c25314 ; If MP was over 50, carry is clear, so branch to Magic/Lore/X-Magic code to check for mute
RTS ; Else, return with carry set, which will grey out Shock
warnpc $c25300
org $c25314
c25314: ; Setting label for branch above
;;; New Code!
; This code (jumped to from MP cost function above) sets Shock's MP cost
; and adjusts it as necessary for Gold Hairpin/Economizer.
org !Freespace_1 ; (26 bytes)
shockMP: CMP #$19 ; Is the command Summon? (Moved check to make space for JMP to new code)
BNE .notSummon
JMP $4F24 ; If it is, jump back to where it would have BRA'd in the earlier code
.notSummon CMP #!Shock_ID ; Is it Shock?
BEQ .shockMP ; If it is, branch and set MP to deduct
JMP $4F18
.shockMP LDA #!Shock_MP
XBA ; Put Shock's MP cost in the top of A
LDA $3C45,X ; Get relic byte 2 (Gold Hairpin/Economizer)
JSR $5739 ; Adjust MP cost based on Gold Hairpin/Economizer
JMP $4F54
; Moved/expanded tables (from the disable CMDs function)
;org !Freespace_2 ; (27 bytes)
c2_table1: db $03, $0B, $07, $0C, $17, $02, $06, $00, !Shock_ID
c2_table2: dw $5326, $5322, $531D, $5314, $5314, $5314, $5310, $5310, dis_Shock
; Generic functions for flagging menu redraw on MP damage/restore (one for STA $3C08,Y, one for STA $3C08,X)
;org !Freespace_3 ; (17 bytes)
flagSTAY: STA $3C08,Y ; Stores updated current MP
PHX : TYX
INC $2F30,X
PLX
RTS
flagSTAX: STA $3C08,X ; Stores updated current MP
INC $2F30,X ; Flags actor/target (as relevant) to have menu updated
RTS
The following 4 users say Thank You to GrayShadows for this post:
• madsiur (06-01-2018), Robo Jesus (05-20-2019), Turbotastic (06-01-2018), Warrax (06-01-2018)
• madsiur (06-01-2018), Robo Jesus (05-20-2019), Turbotastic (06-01-2018), Warrax (06-01-2018)
Wow, that's pretty sweet! The only thing is that I have literally done no successful hex editing to date; all my editing has been on FF3usME and FF3SE. Can I apply this as a patch to the rom, or do I have to hex edit?
Also, where is the 70 bytes of space used? Do I have to make sure I keep 70 bytes free in any particular part of the rom, like spells, names, graphics, etc.? I have pretty much used up the bytes in most of those fields according to FF3usME, but I don't know if that affects this.
Also, where is the 70 bytes of space used? Do I have to make sure I keep 70 bytes free in any particular part of the rom, like spells, names, graphics, etc.? I have pretty much used up the bytes in most of those fields according to FF3usME, but I don't know if that affects this.
06-01-2018, 10:33 AM
So, this is assembly code, which is kind of a step above direct hex editing. You can save this in a plain text file with a .asm file extension, and then use an assembler (xkas is most common, but I use asar, which uses the same syntax) to patch it onto the ROM. I believe both of those are available on the wiki, under the utilities section?
There's no freespace conflict with the stuff you're editing with FF3usME, thankfully -- all of that data is stored elsewhere in the ROM. This is using some unused space in the C2 codebank, which primarily handles the battle functionality. (C1 handles battle graphics, C3 handles field menu, etc.) There may be a conflict with other patches you've applied, and if so, I can help you find an appropriate place to patch this onto the ROM, but otherwise you can just assemble this onto the ROM and you'll be good to go!
One thing to note: if you're using xkas and your ROM is headered, delete the semi-colon before "header" at the start of the code or it'll patch over the wrong sections of the ROM. If you're using asar, it uses the file extension of the ROM to determine whether or not it's headered -- .sfc for no header, .smc for header.
There's no freespace conflict with the stuff you're editing with FF3usME, thankfully -- all of that data is stored elsewhere in the ROM. This is using some unused space in the C2 codebank, which primarily handles the battle functionality. (C1 handles battle graphics, C3 handles field menu, etc.) There may be a conflict with other patches you've applied, and if so, I can help you find an appropriate place to patch this onto the ROM, but otherwise you can just assemble this onto the ROM and you'll be good to go!
One thing to note: if you're using xkas and your ROM is headered, delete the semi-colon before "header" at the start of the code or it'll patch over the wrong sections of the ROM. If you're using asar, it uses the file extension of the ROM to determine whether or not it's headered -- .sfc for no header, .smc for header.
I did some preliminary testing, and the patch seems to work flawlessly with one exception. In my mod, General Leo cannot use Espers or spells, which means he does not have any MP, so Shock is blacked out. If I give Shock to Terra as a test, it works as intended. It seems to me there must be some way to tell the game to give a character MP when they have the Shock ability, similar to how all characters get MP when they learn their first spell. Any ideas there?
(06-01-2018, 01:51 PM)Lightning Wrote: I did some preliminary testing, and the patch seems to work flawlessly with one exception. In my mod, General Leo cannot use Espers or spells, which means he does not have any MP, so Shock is blacked out. If I give Shock to Terra as a test, it works as intended. It seems to me there must be some way to tell the game to give a character MP when they have the Shock ability, similar to how all characters get MP when they learn their first spell. Any ideas there?
Can you elaborate on Leo not having MP in your mod? I've been looking to have characters with 0 MP ala Kain in FF4 but was unable to since all characters gain MP every single levels (even if MP is not shown). The best I was able to do for characters that doesn't use MP is to forcefully hide their MP in the menus but they still have MP internally.
06-01-2018, 04:26 PM
Oh, it's because Leo doesn't have a magic command, and therefore no spells learned or Espers equipped. The game is blanking out his MP. It's an easy fix, I've got a couple of different ideas on the best way. Once I get them tested, I'll post some updated code.
(06-01-2018, 04:26 PM)GrayShadows Wrote: Oh, it's because Leo doesn't have a magic command, and therefore no spells learned or Espers equipped. The game is blanking out his MP. It's an easy fix, I've got a couple of different ideas on the best way. Once I get them tested, I'll post some updated code.
Thanks!
Quote:Can you elaborate on Leo not having MP in your mod? I've been looking to have characters with 0 MP ala Kain in FF4 but was unable to since all characters gain MP every single levels (even if MP is not shown). The best I was able to do for characters that doesn't use MP is to forcefully hide their MP in the menus but they still have MP internally.
Well, characters don't seem to have any MP if they don't have the magic command, UNLESS they learn a spell via an item. So for example, if you equip imp gear and they learn imp, they will now have a MP meter even though they have no magic command. It's kind of a bug, but it works that way. I got around this by disabling magic learning from all items and instead used Espers & natural magic for certain characters only (Terra, Celes, Relm, and Gogo).
06-02-2018, 09:21 AM
(This post was last modified: 06-02-2018, 09:30 AM by Turbotastic.)
(06-01-2018, 10:26 PM)Lightning Wrote: Well, characters don't seem to have any MP if they don't have the magic command, UNLESS they learn a spell via an item. So for example, if you equip imp gear and they learn imp, they will now have a MP meter even though they have no magic command. It's kind of a bug, but it works that way.
It's not a bug in terms of the original game. It's precisely intended to work that way, as blanking out MP is a way to hide the fact that any of your main characters could learn magic under the right circumstances.
In addition, temporary guest party members like Leo are unable to learn magic due to their actor ID being beyond the bounds for learnable characters. If you didn't change his ID in your hack so you could enforce his "no magic" status, that would also cause a problem with MP-battle related things.
Both can be worked around, but if you're talking about a hack that is closer to the original game in this regard, it will be more difficult.
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)