Users browsing this thread: 1 Guest(s)
Reverse actors HP MP progression

#11
Posts: 175
Threads: 11
Thanks Received: 10
Thanks Given: 8
Joined: May 2013
Reputation: 13
Status
Well-Fed
Wait, wait, I'm one of the professionals? When did that happen?

Decreasing HP/MP at level up should actually be a fairly simple change -- you're looking at this section of code:

Code:
C2/60F6: C2 21        REP #$21       (set 16-bit A, clear carry)C2/60F8: BD 0B 16     LDA $160B,X    (maximum HP)
C2/60FB: 48           PHA
C2/60FC: 29 00 C0     AND #$C000     (isolate top bits, which indicate (bit 7, then bit 6):
                                      00 = no equipment % bonus, 11 = 12.5% bonus,
                                      01 = 25% bonus, 10 = 50% bonus)
C2/60FF: 85 EE        STA $EE        (save equipment bonus bits)
C2/6101: 68           PLA            (get max HP again)
C2/6102: 29 FF 3F     AND #$3FFF     (isolate bottom 14 bits.. just the max HP w/o bonus)
C2/6105: 65 FC        ADC $FC        (add to HP gain for level)
C2/6107: C9 10 27     CMP #$2710  
C2/610A: 90 03        BCC $610F      (branch if less than 10000)
C2/610C: A9 0F 27     LDA #$270F     (replace with 9999)
C2/610F: 05 EE        ORA $EE        (combine with bonus bits)
C2/6111: 9D 0B 16     STA $160B,X    (save updated max HP) C2/6114: 18           CLC            (clear carry)

Assuming a minimum HP of, say, 10, you can change it this way:

Code:
C2/6105: SBC $FC        ; subtract HP 'gain' at level
C2/6107: CMP #$000A
C2/610A: BCS $610F             ; branch if more than 10
C2/610C: LDA #$000A           ; otherwise, set new HP to 10

This is untested and it's been a while since I've dealt with this section of the code at all, but assuming I'm not making an egregious mistake somewhere, this'll work. It also accounts for esper bonuses boosting the decrement, taking more HP at level, as that's calculated elsewhere. You could also code for the opposite (esper bonus lessens the decrease), but it would involve some changes to the code at C2/6170.

The same principle applies to MP, which is the next section of C2, starting at C2/6115. (The relevant ADC is at C2/6122.)


Current Project: FF6: Tensei | Discord ID: TristanGrayse
  Find
Quote  
[-] The following 1 user says Thank You to GrayShadows for this post:
  • Tenkarider (06-13-2014)

#12
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
There may be a little extra coding involved. I'm pretty sure the character startup stats only leave one byte for initial HP. so to start a character at 9999 will require a little extra code in the character startup code in C0.

Code:
C0/A27E:    A916        LDA #$16       (22 = width of character startup struct)
C0/A280:    8D0242      STA $4202
C0/A283:    B90016      LDA $1600,Y    (character ID)
C0/A286:    8D0342      STA $4203      (save as a multiplier)
C0/A289:    B90816      LDA $1608,Y    (character level)
C0/A28C:    851B        STA $1B        (save it for now)
C0/A28E:    641F        STZ $1F        (zero out upper HP byte)
C0/A290:    AE1642      LDX $4216
C0/A293:    BFA07CED    LDA $ED7CA0,X  (Initial HP)
C0/A297:    851E        STA $1E        (save initial HP)
C0/A299:    A600        LDX $00        (X = #$0000)
C0/A29B:    C61B        DEC $1B        (decrement levels to do)
C0/A29D:    F012        BEQ $A2B1      (branch if none left)
C0/A29F:    BFA0F4E6    LDA $E6F4A0,X  (HP mod. by level)
C0/A2A3:    18          CLC
C0/A2A4:    651E        ADC $1E        (add it with current HP)
C0/A2A6:    851E        STA $1E        (save it)
C0/A2A8:    A51F        LDA $1F        (load upper HP byte)
C0/A2AA:    6900        ADC #$00       (incremented based on previous ADC)
C0/A2AC:    851F        STA $1F        (save it)
C0/A2AE:    E8          INX            (increment next level's value)
C0/A2AF:    80EA        BRA $A29B      (...and loop)
C0/A2B1:    C221        REP #$21
C0/A2B3:    A51E        LDA $1E        (load HP)
C0/A2B5:    990B16      STA $160B,Y    (save as max HP)
C0/A2B8:    7B          TDC            (A = #$0000)
C0/A2B9:    E220        SEP #$20          (8 bit accum./memory)
C0/A2BB:    60          RTS

It shouldn't take much since it has the code already works with the high byte, but you will need to make a little room because you need to replace the

STZ $1F ( zero initial high byte)

to

LDA #$27 (#$270F being Hex for 9999)
STA $1F

Then you'll have to set everyone's starting HP in FF3usME to 15 (#$0F)...


You might also want to consider changing the Esper HP bonuses to -50% HP so characters don't run themselves down to 0 max HP.

Happy Hacking!
  Find
Quote  
[-] The following 1 user says Thank You to B-Run for this post:
  • Tenkarider (06-13-2014)

#13
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
Finally someone pointed out that the game doesn't normally let you start with more than 255 HP!!! Objection!

I may even try to use your codes... but i still have a problem...

Actually a stupid problem Laugh, i was dealing with HxD, i even managed to find out the placement of actors parameters(2D7EA0), but it's almost sure that i don't have to deal with that, since they are basically the hex version of the actor section of FF3usme. Hold on

So... what exactly should you do to access assembly operations like LDA or others, from HxD i can only see packs of hex data, but not operation(i think)... Sad

Another question... Should i have to combine your script edit with the ones of GrayShadows post? or the yours do all the job? Huh


PS. Who said that characters MUST have HP > 0 in any case? ;[
The best feature of my hack will be that if you'll use espers for 1 or 2 levels, that character will be destined to literally DIE, going to 0 HP permanently at lv 99 Surprised
And, the more it will abuse of espers, the shorter will be his "life"(dying before lv 99) Laugh
hihihi... i'm EVIL!!! XD


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  

#14
Posts: 324
Threads: 25
Thanks Received: 13
Thanks Given: 15
Joined: Oct 2013
Reputation: 2
Status
X-Zone
GreyShadows Wrote:Wait, wait, I'm one of the professionals? When did that happen?

Well, Compared to my Horrific Hex Editing skills I would see you as a Professional. Anyways, whenever you post something its usually something useful to others.


Shine 
  Find
Quote  

#15
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
Cyprus If you just can hex edit something, then you're professional, compared to me XD
Points of view... Laugh


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  

#16
Posts: 324
Threads: 25
Thanks Received: 13
Thanks Given: 15
Joined: Oct 2013
Reputation: 2
Status
X-Zone
I can Hex Edit, But Its usually minor and after someone's held my hand through it. SadObjection!LaughFinger


Shine 
  Find
Quote  

#17
Posts: 290
Threads: 3
Thanks Received: 40
Thanks Given: 1
Joined: Apr 2012
Reputation: 9
Status
None
(06-13-2014, 09:38 AM)Tenkarider Wrote: Actually a stupid problem Laugh, i was dealing with HxD, i even managed to find out the placement of actors parameters(2D7EA0), but it's almost sure that i don't have to deal with that, since they are basically the hex version of the actor section of FF3usme. Hold on

When you see addresses like C2/6170, it's CPU addressing. To get the hex offset you'll need to edit, subtract 0xC00000 from that address.

For example, C2/6170 would become 0x26170. Enter that into HxD's offset search and it should drop you right at the desired location.

Bear in mind that if you're working with a headered ROM, you'll need to add 0x200 to your result to get to the correct offset.

Quote:So... what exactly should you do to access assembly operations like LDA or others, from HxD i can only see packs of hex data, but not operation(i think)... Sad

This can be a little tricky without knowledge of 65816 addressing modes. This is a good reference for translating assembly instructions to hex, but there are many different ways to translate most instructions based on the addressing.

You can cross-reference that page with the addressing examples in this one to find out which hex values you'll need to input or change.

Quote:Another question... Should i have to combine your script edit with the ones of GrayShadows post? or the yours do all the job? Huh

You'll need to combine them, as GrayShadows' reduces max HP at level up while Edrin's allows characters to start with a 16-bit HP value. You'll also need to make room somewhere to fit Edrin's (probably with a JSR to some empty space), since it expands that particular block by one byte.


GET A SILK BAG FROM THE GRAVEYARD DUCK TO LIVE LONGER.

Brave New World
  Find
Quote  

#18
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
How much space do i need to make room for that code?
Are there some good empty spaces in the hex file, that you may consider better to use?


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  

#19
Posts: 290
Threads: 3
Thanks Received: 40
Thanks Given: 1
Joined: Apr 2012
Reputation: 9
Status
None
Not a lot, and there's plenty of free space in bank C2, which you can find in the disassembly here: http://assassin17.home.comcast.net/~assa...code2i.txt


GET A SILK BAG FROM THE GRAVEYARD DUCK TO LIVE LONGER.

Brave New World
  Find
Quote  
[-] The following 1 user says Thank You to Synchysi for this post:
  • Tenkarider (06-13-2014)

#20
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
Thanks Wink
Let's see if i can handle this stuff... Laugh
sooner or later i may post the result, if i won't have other questions to do. Surprised


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  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite