Users browsing this thread: 1 Guest(s)
Gaining a greater health from Potions?

#21
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
The method to modify the value of the gained health of an item is to use the modified special effect of the super ball. Looks like two different codes are used for the in-battle and out-battle use of the item. The in-battle is in the bank C2 and the out-battle (menu) is in the bank C3.

The code for the menu probably doesn't call the special effect of the super ball. Without it, it will do the regular healing of the item.

It is unfortunate, but i don't know how to fix it. The bank C3 is know to have a sloppy method to check items ID instead of the items data. Even if the items data are altered, the code will not recognize it without its alteration.

As example, the item antidot checks if the user has the poison status. If you alter it to be similar to a healing item, like potion, it still checks for the poison status. You can't use the new healing item unless the user has the poison status.

This sloppy method to check the item ID instead of the item data is scattered in the bank C3. It makes the adjustment of the item healing more difficult based on the item you are actually modifying. You always need to track down these hard coded item-ID checks.

Unfortunately, the only advice i can give you is to not use the item outside of battle. With FF3usMe, you only need to setup the flag which is used to determinate if the item is used out-of-battle. It is not the ideal option, but is the only option i have by now. The method to use the special effect of the super ball will not work for the menu. A new method needs to be designed.
  Find
Quote  

#22
Posts: 378
Threads: 94
Thanks Received: 17
Thanks Given: 26
Joined: Jul 2013
Reputation: 11
Status
Charmed
This is indeed unfortunate. Thanks for clearing it up for me, though. Hopefully I can find a workaround. I was thinking of having special healing items that work only in-battle while leaving the Potions to heal a decent amount for when you're outside the menu. Of course I will need to tone down significantly the ratio potions were dropped, but eh.


Step forward, spriters! We are also responsible to make hacks look new and fresh, we are no less important than code or ASM hackers! CHARGE!!
Quote  

#23
Posts: 23
Threads: 4
Thanks Received: 1
Thanks Given: 0
Joined: Sep 2015
Reputation: 0
Status
Zombie
I figured it out for a mod I was making.

To get it to heal 1000 HP, go into your hex editor...

Change:
C2/4371: 40 FE

The previously-unused Item Extra Effect 0 now points to Blow Fish.

Now, go into FF3usME, and under item advanced settings, set your item's extra effect to 00.

If everything worked, your potions will heal for 1000.
  Find
Quote  
[-] The following 1 user says Thank You to funkydiscogod for this post:
  • SSJ Rick (07-08-2016)

#24
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
^Very clever sir.

Your name looks super familiar, I could of sworn you were a member here already. Maybe from Romhacking.net I've seen you lots?


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

#25
Posts: 378
Threads: 94
Thanks Received: 17
Thanks Given: 26
Joined: Jul 2013
Reputation: 11
Status
Charmed
I just did that and it crashed my game.
Went to C2/4371, switched the two bytes to 40 FE, I went to my game, used the item, screen turns black and some glitched colors, then later the game restarts o_O

Even then, I did plan for other items to heal 500 hp soo...


Step forward, spriters! We are also responsible to make hacks look new and fresh, we are no less important than code or ASM hackers! CHARGE!!
Quote  

#26
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
I don't know what happened to you but there must be a way to make it work out;
No problem about other similar effects: you need to duplicate the effect code of Blowfish and change 1000 into something else... In BNW cyan's swdtech Mindblow does exactly 500 MP damage, and there's also Blowfish.


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#27
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(12-20-2015, 04:49 PM)Kugawattan Wrote: Went to C2/4371, switched the two bytes to 40 FE

The info funkydisco gave you is right but also false. In a pointer table the offset bytes are inverted. So you'll have to enter FE 40. If you open the disassembly you'll see a "pattern" that the second byte of all entries is between 3E and 42. This sometimes can ring a bell.

Another detail is that the pointer offset he gives is actually special effect $48 but it is true that it is unused. Special effect $00 would be at C2/42E1. I'm too lazy to open usME so you'll have to experiment.

Edit: He probably means special effect $48 is item extra effect $00. I had no knowledge of that.
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • SSJ Rick (07-08-2016)

#28
Posts: 23
Threads: 4
Thanks Received: 1
Thanks Given: 0
Joined: Sep 2015
Reputation: 0
Status
Zombie
(12-20-2015, 08:50 PM)Madsiur Wrote: The info funkydisco gave you is right but also false.

Edit: He probably means special effect $48 is item extra effect $00. I had no knowledge of that.

Well, my first post was massively embarrassing.

Yes, I screwed up the order of the bytes.

And I did mean that special effect $48 == item extra effect $00.

(12-20-2015, 04:49 PM)Kugawattan Wrote: Even then, I did plan for other items to heal 500 hp soo...

I now have discovered a solution for healing on the menus.

Since it seems you're looking for healing of 50*power, do this...

C3/8CDD: A9 20
C3/8CE2: A9 03

This changes the behavior of the flag FF3usME calls "Max out". Instead of causing items with this flag to heal for power/16*maximum health, it will heal for power*50 instead.

You'll have to change the power of X-Potions (and other full-heal items) to 200 so that it heals for 9999, though.

Edit: Nevermind, this will screw up the potions in-battle.
  Find
Quote  

#29
Posts: 179
Threads: 3
Thanks Received: 24
Thanks Given: 4
Joined: Apr 2015
Reputation: 18
Status
None
Here are the two subroutines in bank C3 that calculate the amount of hp/mp restored when you use an item from the menu. funkydiscogod has the right idea, you could modify these if you want to change the effect in the menu.

Code:
; [ Load Item HP/MP Restored ]
; this is for items that restore an exact amount of hp/mp

C3/8CCD: BF 14 50 D8  LDA $D85014,X   ; hp/mp restored
C3/8CD1: 85 B2        STA $B2
C3/8CD3: 64 B3        STZ $B3
C3/8CD5: 60           RTS

; [ Calculate Fraction of Max HP/MP Restored ]
; this is for items that restore 1/16ths of max hp/mp

C3/8CD6: AD 12 42     LDA $4212
C3/8CD9: 29 40        AND #$40
C3/8CDB: F0 F9        BEQ $8CD6
C3/8CDD: A5 F3        LDA $F3
C3/8CDF: 8D 1B 21     STA $211B
C3/8CE2: A5 F4        LDA $F4
C3/8CE4: 8D 1B 21     STA $211B
C3/8CE7: A5 B2        LDA $B2
C3/8CE9: 8D 1C 21     STA $211C
C3/8CEC: 8D 1C 21     STA $211C
C3/8CEF: AD 36 21     LDA $2136
C3/8CF2: 85 EB        STA $EB
C3/8CF4: 64 EC        STZ $EC
C3/8CF6: C2 20        REP #$20
C3/8CF8: AD 34 21     LDA $2134
C3/8CFB: 85 E9        STA $E9
C3/8CFD: 46 EB        LSR $EB
C3/8CFF: 66 E9        ROR $E9
C3/8D01: 46 EB        LSR $EB
C3/8D03: 66 E9        ROR $E9
C3/8D05: 46 EB        LSR $EB
C3/8D07: 66 E9        ROR $E9
C3/8D09: 46 EB        LSR $EB
C3/8D0B: 66 E9        ROR $E9
C3/8D0D: E2 20        SEP #$20
C3/8D0F: 60           RTS

One idea that might work is to add something like this in an unused part of bank C3 (maybe somewhere in C3/F091-C3/FFFF) and then replace the address for the original hp/mp subroutine (at C3/8C41) with wherever you add the new code. This will multiply an item's hp/mp value by 40.

Code:
LDA $D85014,X
STA $4202
LDA #$28        ; multiply by 40
STA $4203
NOP
NOP
NOP
NOP
LDY $4216
STY $B2
RTS

C3/8C40: 20 CD 8C     JSR $8CCD       ; change this to point to your new subroutine
  Find
Quote  
[-] The following 1 user says Thank You to Everything for this post:
  • SSJ Rick (07-08-2016)

#30
Posts: 23
Threads: 4
Thanks Received: 1
Thanks Given: 0
Joined: Sep 2015
Reputation: 0
Status
Zombie
Ok...I suck.  So, I have another possibly wrong solution for y'all.  I hope to not screw up anything else.  It seems the correct answer includes "all of the above" solutions.  And, rather than try to change as little as possible, I just went for a small rewrite of the section governing potions and


Code:
C3/8C33:    5A                PHY
            20    2B    8C        JSR $8C2B
            20    21    83        JSR $8321        (Multiplies A by 30)
            7A                PLY
            AE    34    21        LDX $2134
            86    B0            STX $B0
            20    CD    8C        JSR $8CCD        (gets magnitude of item)
            BF    13    50    D8    LDA $D85013,X    (Load item properties X)
            10    29            BPL $8C76        (Branch if not "Manipulates 1/16ths of actual value affected")
            29    08            AND #$08        (Check if it "Restores HP")
            F0    0D            BEQ                (skip to the MP check if it doesn't)
            B9    0B    00        LDA $000B,Y        max health, high bit
            85    F3            STA $F3
            B9    0C    00        LDA $000C,Y        max health, low bit
            85    F4            STA $F4
            20    9B    8C        JSR    hp heals    now, jump to where it would normally go if it was 1/16ths healing.
            A6    B0            LDX $B0
            BF    13    50    D8    LDA $D85013,X  (Load weapon/item properties X)
            29    10            AND #$10       (Check if it "Restores MP")
            F0    0D            BEQ $8C75      (Exit if it doesn't)
            B9    0F    00        LDA $000F,Y        max mp, high bit
            85    F3            STA $F3
            B9    10    00        LDA $0010,Y        max mp, low bit
            85    F4            STA $F4
            20    B4    8C        JSR    mp heals    go to where MP should go
            60                RTS

8C72:        29    08            AND #$08       (Check if it "Restores HP")
            F0    0D            BEQ $8CA0      (Branch if it doesn't)
            EA                NOP
            A9    80            LDA 80            loads data as if HP was 640, so 1/16th would be 40.
            85    F3            STA $F3
            EA                NOP
            A9    02            LDA    02
            85    F4            STA $F4
            20    9B    8C        JSR hp heals
            A6    B0            LDX $B0
            BF    13    50    D8    LDA $D85013,X    (Load item properties X)
            29    10            AND #$10        (Check if it "Restores MP")
            F0    0D            BEQ $8CCC        (Exit if not)
            EA                NOP
            A9    80            LDA 80
            85    F3            STA $F3
            EA                NOP
            A9    02            LDA    02
            85    F4            STA $F4
            20    B4    8C        JSR    mp heals
            60                RTS

8C9B:        20    65    0D        JSR $0D65
            20    92    0D        JSR $0D92
            20    D6    8C        JSR $8CD6
            C2    21            REP #$21
            A5    E9            LDA $E9
            79    09    00        ADC $0009,Y
            99    09    00        STA $0009,Y
            E2    20            SEP #$20          (8 bit memory/accum.)
            20    9A    2B        JSR $2B9A        (Heal HP)
            60                RTS

8CB4:        20    65    0D        JSR $0D65
            20    9F    0D        JSR $0D9F
            20    D6    8C        JSR $8CD6
            C2    21            REP #$21
            A5    E9            LDA $E9
            79    0D    00        ADC $000D,Y
            99    0D    00        STA $000D,Y
            E2    20            SEP #$20          (8 bit memory/accum.)
            20    BC    2B        JSR $2BBC        (Heal MP)
            60                RTS


This hopefully will make potions heal for 40*their listed power.  You'll need the Superball fix to make this work, too, because you want them to heal for 40* their listed power in battle, too.

This shouldn't screw up any items that have the "max out" bit set.  I looked for the Dried Meat special effect code, and it looks like it just points to a return, so Dried meat should be a superball, too.

Items will only be able to heal for 40*power, or power*max HP/16, though, so I'll keep looking for a better wolution.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite