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)
"Low on HP" spells and "Active if Imp" flag

#1
Posts: 735
Threads: 36
Thanks Received: 13
Thanks Given: 43
Joined: Jan 2016
Reputation: 6
Status
None
So I had a neat idea and thought others may find it useful. Here's the coding for the three "Cast spell when low on HP" effects.

Code:
C2/0A4A: BD A0 3A     LDA $3AA0,X
C2/0A4D: 89 10        BIT #$10
C2/0A4F: D0 3F        BNE $0A90    (Exit function)
C2/0A51: A9 02        LDA #$02
C2/0A53: 3C E5 3E     BIT $3EE5,X
C2/0A56: F0 38        BEQ $0A90    (Branch if not Near Fatal)
C2/0A58: 3C 05 32     BIT $3205,X  (is bit 1 set?)
C2/0A5B: F0 33        BEQ $0A90    (exit if not, meaning we've already activated
                                   a spell on low HP this battle)
C2/0A5D: 5D 05 32     EOR $3205,X
C2/0A60: 9D 05 32     STA $3205,X  (turn off bit 1)
                                  (TRB $3205,X could've replaced two instructions)
C2/0A63: BD 59 3C     LDA $3C59,X
C2/0A66: 4A           LSR
C2/0A67: 90 0B        BCC $0A74   (Branch if not Shell when low HP)
C2/0A69: 48           PHA
C2/0A6A: A9 25        LDA #$25
C2/0A6C: 85 B8        STA $B8     (Shell spell ID)
C2/0A6E: A9 26        LDA #$26
C2/0A70: 20 91 4E     JSR $4E91
C2/0A73: 68           PLA
C2/0A74: 4A           LSR
C2/0A75: 90 0B        BCC $0A82   (branch if not Safe when low HP)
C2/0A77: 48           PHA
C2/0A78: A9 1C        LDA #$1C
C2/0A7A: 85 B8        STA $B8     (Safe spell ID)
C2/0A7C: A9 26        LDA #$26
C2/0A7E: 20 91 4E     JSR $4E91
C2/0A81: 68           PLA
C2/0A82: 4A           LSR
C2/0A83: 90 0B        BCC $0A90   (branch if not Reflect when low HP [no item
                                  in game has this feature, but it's possible])
C2/0A85: 48           PHA
C2/0A86: A9 24        LDA #$24
C2/0A88: 85 B8        STA $B8     (Rflect spell ID)
C2/0A8A: A9 26        LDA #$26
C2/0A8C: 20 91 4E     JSR $4E91
C2/0A8F: 68           PLA
C2/0A90: 60           RTS

The spots at C2/0A6A. C2/0A78, and C2/0A86, are the spell IDs. Note that "Cast Reflect when at low HP" is never used in the base game, but the coding is here for it.

Now, of course, the spell IDs can be changed to anything, and in that is the potential for three unique "Cast spell at low HP" effects. The coding will always default to single-targeting the caster, even for party-wide spells (tested with Ultima and Big Guard). So here are some examples of what you could make:

* 1-Up Ring - Casts Cure 3 when at low HP.
* Once More - Casts Life 3 when at low HP.
* Second Chance - Casts Big Guard when at low HP.
* Hide Cowl - Character flees battle when at low HP. (casts Escape, which works fine - single character runs away complete with animation and sound effect. However, this apparently lets you "win" boss battles by letting the rest of the party get KO'd and you don't Game Over)

Trying to make a "Summon at low HP" item was a bit more hit or miss. Golem, Bismarck, Tritoch, and Odin, didn't want to play, but Palidor and Kirin would. I guess you'd have to check yourself what works and what doesn't.

* Final Jump - Summons Palidor when at low HP. (this WILL effect the entire party)

And in turn you can customize whatever spell you want, so...

* Second Wind - Fully restores HP and status when at low HP.
* Hyper Mighty G - Casts Haste, Regen, Shell, Protect, and Life 3 when at low HP

Alas that there isn't a way to attach HP and MP restoration to a spell effect that I know of, or we could do "Last Elixir" to automatically use an Elixir on a low HP character.

To the second part of the topic, this is an idea I didn't figure out how to implement due to a strange hex concerning identifying statuses, but I'll post the coding if someone else could figure it out - the coding for the "weapon/armor active if Imp" trigger.

Code:
C2/1018: BF 14 50 D8  LDA $D85014,X   (get weapon battle power / armor defense power)
C2/101C: EB           XBA
C2/101D: BF 02 50 D8  LDA $D85002,X   (get top byte of equippable chars?)
C2/1021: 0A           ASL
C2/1022: 0A           ASL             (carry = Specs active when Imp?)
C2/1023: A5 FE        LDA $FE         (Character Status Byte 1)
C2/1025: B0 02        BCS $1029       (branch if imp-activated)
C2/1027: 49 20        EOR #$20        (flip Imp status)
C2/1029: 89 20        BIT #$20        (character has Imp status?)
C2/102B: D0 03        BNE $1030      
C2/102D: A9 01        LDA #$01        (if you're an Imp and specs aren't Imp-activated,
                                      defense/battle power = 1.  or if you're not an Imp
                                      and the specs are Imp-activated, battle/defense
                                      power = 1)
C2/102F: EB           XBA
C2/1030: EB           XBA             (if imp-activation and imp status match, put the
                                      original Battle/Defense Power back in bottom of A)

If one could figure out how to change the status that this coding refers to, then you could make some creative equipment. Here are some ideas, presuming all of them can be done.

* Berserker Blade - Powerful sword activates when user is Berserked
* Reaper Rod - Powerful rod activates when user is Condemned
* Rage Vest - Powerful armor defends user under effect of Rage
* Sweet Dreams - Powerful armor defends user when they are asleep.

So yeah, just sharing some simple ideas I had that others could use to make some more fun equipment.
  Find
Quote  
[-] The following 6 users say Thank You to DrakeyC for this post:
  • Fenrir (02-22-2018), Gi Nattak (02-21-2018), madsiur (02-20-2018), Robo Jesus (02-22-2018), Tenkarider (02-22-2018), Turbotastic (02-22-2018)



Messages In This Thread
"Low on HP" spells and "Active if Imp" flag - by DrakeyC - 02-20-2018, 10:38 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite