"Low on HP" spells and "Active if Imp" flag
#5
A simple code modification to the SOS spellcasts:

Code:
hirom

org $c20a4a
C20A4A: LDA $3AA0,X
C20A4D: BIT #$10                   ; (is entity Wounded, Petrified, or Stopped, or is somebody else under the influence of Quick?)
C20A4F: BNE sos_end                  ; (Exit function if any are true)
C20A51: LDA #$02
C20A53: BIT $3EE5,X
C20A56: BEQ sos_end                  ; (Branch if not Near Fatal)
C20A58: BIT $3205,X                ; (is bit 1 set?)
C20A5B: BEQ sos_end                  ; (exit if not, meaning we've already activated a spell on low HP this battle)
C20A5D: EOR $3205,X
C20A60: STA $3205,X                ; (toggle off bit 1)
lda $3c59,x                        ; load equip special byte 4
and #$07                            ; filter all except bits 0-2
beq sos_end
phx                                ; save X
dec
tax                                ; move A to X, as index
lda (#spell_index),x                ; load value to compare
plx
sta $b8                            ; spell ID
lda #$26                        ; command #$26 (force target self, no MT)
jsr $4e91                        ; queue command
sos_end:
rts

spell_index:
;Spell IDs go here. All use self-targetting only, though offensive spells may use a very simple single target randomization on enemy targets. I haven't tested that.
db $00                            ; 001 (Previously Shell flag)
db $00                            ; 010 (Previously Safe flag)
db $00                            ; 011 (Previously Shell+Safe flags)
db $00                            ; 100 (Previously Rflect flag)
db $00                            ; 101 (Previously Rflect+Shell flags)
db $00                            ; 110 (Previously Rflect+Safe flags)
db $00                            ; 111 (Previously Rflct+Safe+Shell flags)
padbyte $FF : pad $c20a91
Reply


Messages In This Thread
RE: "Low on HP" spells and "Active if Imp" flag - by dn - 02-23-2018, 02:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Active nATB C-Dude 0 1,176 02-21-2024, 03:09 AM
Last Post: C-Dude
  Additional Command Change Flag DrakeyC 2 2,229 05-09-2023, 11:22 PM
Last Post: DrakeyC
  Formation Special Event Flag Findings Gi Nattak 1 2,231 01-07-2021, 04:48 PM
Last Post: C-Dude
  Add learning new spells doofenH 11 9,017 02-13-2020, 08:02 PM
Last Post: C-Dude
  Need help with event flag. Mantecol 3 5,863 07-23-2018, 08:47 PM
Last Post: GrayShadows
  Espers: 1 set of spells KnightDude 7 6,869 07-10-2016, 10:14 AM
Last Post: KnightDude
  Changing Active Character slots?(FF6Adv) EnglishLanguage 2 3,855 10-21-2014, 03:24 PM
Last Post: EnglishLanguage
  A few questions regarding spells XFER 5 6,282 04-08-2014, 07:47 PM
Last Post: Cyprus

Forum Jump:


Users browsing this thread: 1 Guest(s)