Final Requests for Help
05-11-2021, 11:10 PM
(This post was last modified: 05-11-2021, 11:10 PM by Subtraction.)
You have to pair a JSR with RTS and JSL with RTL. Since the subroutine gets called both from within C2 and from another bank, it needs paths for both.
05-14-2021, 12:41 PM
(This post was last modified: 05-14-2021, 12:46 PM by PowerPanda.)
Hey Subtraction, I have a question on this section of the code:
Specifically:
JSR $4B5A
AND #$1F ; 1/32 chance of breaking
With it saying #$1F, does that mean that it's actually breaking 1/8th of the time? I was expecting "AND #$05". Reports from players have their tools breaking multiple times before they even hit the Returner's hideout.
Code:
check_break:
PHA
PHP
JSR $2B63 ; Multiply A by 30, size of item data block
REP #$10 ; Set 16-bit X and Y
TAX
LDA $D85012,X ; equipment spell byte. Bit 7: 1 = remove from inventory upon usage, 0 = nope
BPL no_break ; if the flag is not set, this tool never breaks
JSR $4B5A
AND #$1F ; 1/32 chance of breaking
BNE no_break
LDA #$44 ; "Orge Nix broke!" dialog. Works for most tools but gets clobbered by the Air Anchor "Move and you're dust!"
STA $3401
SEP #$10 ; Set 8-bit X and Y
TYX
LDA #$FF
STA $32F4,X ; null item index to add to inventory. This means the item will stay deducted from your inventory.
LDA $3018,X
BRA check_break_end
Specifically:
JSR $4B5A
AND #$1F ; 1/32 chance of breaking
With it saying #$1F, does that mean that it's actually breaking 1/8th of the time? I was expecting "AND #$05". Reports from players have their tools breaking multiple times before they even hit the Returner's hideout.
Projects:
FFVI: Divergent Paths (Completed) - a complete storyline and gameplay hack of FF6 that adds Leo as a playable character
05-14-2021, 11:59 PM
(05-14-2021, 12:41 PM)PowerPanda Wrote: Hey Subtraction, I have a question on this section of the code:
Specifically:
JSR $4B5A
AND #$1F ; 1/32 chance of breaking
With it saying #$1F, does that mean that it's actually breaking 1/8th of the time? I was expecting "AND #$05". Reports from players have their tools breaking multiple times before they even hit the Returner's hideout.
No, AND #$05 would be a 1/8 chance. In fact, when I was testing this, it was taking too long for tools to break, so I changed it to AND #$03 to make them break more frequently.
JSR $4B5A sets the accumulator to a pseudo-random number, 0–255
AND #$1F clears the top 3 bits, making it a pseudo-random number from 0–31. If the number is now 0, it sets the Zero flag; otherwise it clears the Zero flag.
BNE branches if the Zero flag is clear.
05-15-2021, 11:18 AM
For what it’s worth 1/32 sounds like a lot to me. A big dungeon might cause multiple breaks. If breakage is rare it might be more impactful because people forget to account for it.
05-15-2021, 11:36 AM
Alternate idea (perhaps more appropriate for Setzer): make tool use cost gil, and make the cost determined by something similar to the damage formula.
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)