Users browsing this thread: 1 Guest(s)
It is the apocalypse after all.

#11
Posts: 21
Threads: 1
Thanks Received: 0
Thanks Given: 4
Joined: Oct 2019
Reputation: 0
Status
None
(07-20-2021, 07:49 PM)C-Dude Wrote: Okay, I think I know why the money dump didn't work.  That event code is designed for things like buying Rust Rid.  If the player doesn't have enough funds, it sets a bit that the event script can check for and branch with, and the funds are not deducted.

The pause could be related to the money removal failure or it could just be the game trying to remove all of those items.  It is a very LONG event loop.  Try shortening the loop by changing the first value to B0 10 and see if the pause is shortened.  It won't remove all the items anymore, but if the pause is shortened that indicates that this event takes too long to execute and a different approach should be used.

I actually don't mind the pause as its worth the trade-off for me. My concern is the money issue.

In terms of a different approach, I think shortening it could work. The player won't have all 255 item slots filled in the WoB, maybe that is a possible solution? 255 -> 200?

But yeah, I'll try out that B0->10 trick and see if it works.

*EDIT* it got rid of the pause issue, but Cid now floats off into the ether, it didn't remove any money, and of course didn't dump my inventory.
  Find
Quote  

#12
Posts: 2,380
Threads: 93
Thanks Received: 358
Thanks Given: 326
Joined: Aug 2009
Reputation: 44
Status
Nattak\'d
(07-20-2021, 08:19 PM)fw4210 Wrote:
(07-20-2021, 07:49 PM)C-Dude Wrote: Okay, I think I know why the money dump didn't work.  That event code is designed for things like buying Rust Rid.  If the player doesn't have enough funds, it sets a bit that the event script can check for and branch with, and the funds are not deducted.

The pause could be related to the money removal failure or it could just be the game trying to remove all of those items.  It is a very LONG event loop.  Try shortening the loop by changing the first value to B0 10 and see if the pause is shortened.  It won't remove all the items anymore, but if the pause is shortened that indicates that this event takes too long to execute and a different approach should be used.

*EDIT* it got rid of the pause issue, but Cid now floats off into the ether, it didn't remove any money, and of course didn't dump my inventory.

Check/compare the hex again, something got messed up - I suspect the B0 64 to B0 10 change was not done correctly. Cid's ID is $10 on the map, so it seems to be now reading to do some action for him. Probably you got 10 10, instead of B0 10? Anyways, that was more just a test to see if the pause is lessened, which it will be, but will only deduct 16 of each item from the inventory, which would be enough for equipment but not for regular items I'd imagine... I mean you'd probably want to have 64 to clear it all, despite the lag.

I'll just state the obvious that the more challenging assembly route to make use of an unused event command to do this would be more practical, especially considering how gold is deducted by event code as there's no way to ensure removing the exact amount/all of GP the player has. BUT, this remains a valid option!


We are born, live, die and then do the same thing over again.
Quote  
[-] The following 1 user says Thank You to Gi Nattak for this post:
  • C-Dude (07-20-2021)

#13
Posts: 333
Threads: 26
Thanks Received: 134
Thanks Given: 124
Joined: Dec 2018
Reputation: 18
Status
Moog
Yes, Gi is correct, a custom event that triggers some assembly code would work much better. I shouldn't have sent you astray the way I did, Masiur was right to begin with.
I've never coded something like that before, so you're going to be the guinea pig.

Code:
Custom Event $A4            (Inventory Flush) [This custom event command takes no arguments]
[I chose $A4 because event bit $0A4 means the game is in the World of Ruin.  It's an easy way to remember which event got used for this]


POINTER
C0/99A2:    83 DF        (act. A4: ** NOT USED **)        [Was 1A B9]


COMMAND
C0/DF83:    [Was Freespace, 29 bytes used]
A6 00        LDX $00        (Load X with $00)
A9 FF        LDA #$FF        (Get an "empty" item)
9D 69 18      STA $1869,X     (Put it in inventory at X)
E8          INX                (Increment X)
E0 00 01      CPX #$0100        (Is X over 256?)
D0 F5        BNE getNextSlot        (If not, branch -> get the next item)
C2 21        REP #$21        (16 bit accum./memory)
9C 60 18    STZ $1860        (Zero the low byte of GP)
7B          TDC             (Clear the accumulator)
E2 20        SEP #$20          (8 bit accum./memory)
9C 62 18      STZ $1862        (Zero the high byte of GP)
A9 01        LDA #$01        (Advance the script 1 place, as our command has no arguments)
4C 5C 9B      JMP $9B5C

    RAW HEX FOR COMMAND CODE
    C0/DF83:
        A6 00 A9 FF 9D 69 18 E8 E0 00 01 D0 F5 C2 21 9C 60 18 7B E2 20 9C 62 18 A9 01 4C 5C 9B
    
    
EVENT HOOK  [Unchanged from earlier post]
CA/530C:
    B2 01 AF 24            [Go to subroutine EE/AF01 (which is unused space in Vanilla)]


EVENT SUBROUTINE
EE/AF01:
    88 06 00 00            [Clean Celes's statuses (displaced vanilla code)]
    8D 06                [Unequip Celes]
    A4                    [Run Custom Command to flush inventory]
    FE                     [Return to sender]

    RAW HEX FOR EE/AF01 SUBROUTINE
    88 06 00 00 8D 06 A4 FE

You'll want to blank the rest of the 500-some bytes from the previous post's event code. Better yet, go back to a version of the file before you tried this and just do these changes with the hex editor. If you didn't make a backup, well, thankfully it was just freespace and it's relatively easy to repair (just hold down the F key after typing FE in the $EE bank until you reach another block of FFs), but make sure to make a backup now!

Everything above should make $A4 in the event script flush both inventory and GP. Because it's a custom event command, older programs like Zone Doctor won't be able to parse it and thus won't be able to give you accurate event text dumps (the only thing that editor is good for since its save corrupts ROMs). Luckily, we're putting it in a bank that Zone Doctor doesn't check.
  Find
Quote  
[-] The following 1 user says Thank You to C-Dude for this post:
  • Gi Nattak (07-21-2021)

#14
Posts: 21
Threads: 1
Thanks Received: 0
Thanks Given: 4
Joined: Oct 2019
Reputation: 0
Status
None
C-DudeYes, Gi is correct, a custom event that triggers some assembly code would work much better.  I shouldn't have sent you astray the way I did, Masiur was right to begin with.
I've never coded something like that before, so you're going to be the guinea pig.

Code:
Custom Event $A4            (Inventory Flush) [This custom event command takes no arguments]
[I chose $A4 because event bit $0A4 means the game is in the World of Ruin.  It's an easy way to remember which event got used for this]


POINTER
C0/99A2:    83 DF        (act. A4: ** NOT USED **)        [Was 1A B9]


COMMAND
C0/DF83:    [Was Freespace, 29 bytes used]
A6 00        LDX $00        (Load X with $00)
A9 FF        LDA #$FF        (Get an "empty" item)
9D 69 18      STA $1869,X     (Put it in inventory at X)
E8          INX                (Increment X)
E0 00 01      CPX #$0100        (Is X over 256?)
D0 F5        BNE $AD2F        (If not, branch -> get the next item)
C2 21        REP #$21        (16 bit accum./memory)
9C 60 18    STZ $1860        (Zero the low byte of GP)
7B          TDC             (Clear the accumulator)
E2 20        SEP #$20          (8 bit accum./memory)
9C 62 18      STZ $1862        (Zero the high byte of GP)
A9 01        LDA #$01        (Advance the script 1 place, as our command has no arguments)
4C 5C 9B      JMP $9B5C

    RAW HEX FOR COMMAND CODE
    C0/DF83:
        A6 00 A9 FF 9D 69 18 E8 E0 00 01 D0 F5 C2 21 9C 60 18 7B E2 20 9C 62 18 A9 01 4C 5C 9B
    
    
EVENT HOOK  [Unchanged from earlier post]
CA/530C:
    B2 01 AF 24            [Go to subroutine EE/AF01 (which is unused space in Vanilla)]


EVENT SUBROUTINE
EE/AF01:
    88 06 00 00            [Clean Celes's statuses (displaced vanilla code)]
    8D 06                [Unequip Celes]
    A4                    [Run Custom Command to flush inventory]
    FE                     [Return to sender]

    RAW HEX FOR EE/AF01 SUBROUTINE
    88 06 00 00 8D 06 A4 FE
[i]


I am definitely going to use a fresh rom. But before I do, I just want to make sure I am processing the information correctly.

Step 1: C0/99A2 - $C00000 = 99A2 = write the new pointer change: (WAS 1A B9, NOW IT'S 83 DF)

Step 2  C0/DF83 - $C00000 = DF83 = write the new raw hex code in that offset.
                                 
Step 3: Re-write the A530C & 2EAF01 code as they remain unchanged.

Correct?
  Find
Quote  

#15
Posts: 333
Threads: 26
Thanks Received: 134
Thanks Given: 124
Joined: Dec 2018
Reputation: 18
Status
Moog
Yes, the new pointer goes at 99A2 in HxD. It's 83 DF because pointers are little-endian (so the high part goes first. That's that DF83 you've got in Step 2).
When you write the new raw hex code at DF83 it should end at the very end of the (second) line, with original vanilla code immediately following it.
  Find
Quote  

#16
Posts: 21
Threads: 1
Thanks Received: 0
Thanks Given: 4
Joined: Oct 2019
Reputation: 0
Status
None
Celes is now permanently stuck. I can't get her to move and check the item menu to see if the dump worked.
  Find
Quote  

#17
Posts: 2,380
Threads: 93
Thanks Received: 358
Thanks Given: 326
Joined: Aug 2009
Reputation: 44
Status
Nattak\'d
Something must've been inputted wrong, testing it out here it seems to be working as intended - all inventory cleared and GP as well, no stuck Celes (nice work C-Dude!). Double check everything. If still no luck maybe post a pic(s) of your edit if possible so we can spot a potential error.


We are born, live, die and then do the same thing over again.
Quote  
[-] The following 1 user says Thank You to Gi Nattak for this post:
  • fw4210 (07-21-2021)

#18
Posts: 21
Threads: 1
Thanks Received: 0
Thanks Given: 4
Joined: Oct 2019
Reputation: 0
Status
None
(07-21-2021, 12:21 AM)Gi Nattak Wrote: Something must've been inputted wrong, testing it out here it seems to be working as intended - all inventory cleared and GP as well, no stuck Celes. Double check everything.

Okay, thanks for the input. I will attempt again.

*EDIT* I can post pics, but what's the max file/recommended file size.
  Find
Quote  

#19
Posts: 2,380
Threads: 93
Thanks Received: 358
Thanks Given: 326
Joined: Aug 2009
Reputation: 44
Status
Nattak\'d
I don't believe we have a rule about file size for attachments, just that 'no posting anything bigger than 700x700'.
I'd recommend uploading the images to imgur though for this, or any other known image uploading/sharing site that provides links, if possible.


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

#20
Posts: 21
Threads: 1
Thanks Received: 0
Thanks Given: 4
Joined: Oct 2019
Reputation: 0
Status
None
(07-21-2021, 02:09 AM)Gi Nattak Wrote: I don't believe we have a rule about file size for attachments, just that 'no posting anything bigger than 700x700'.
I'd recommend uploading the images to imgur or any other known image uploading/sharing site that provides links, if possible, for this case.

https://imgur.com/a/hnlQil2

This work?
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite