Users browsing this thread: 1 Guest(s)
Displaying item received, spell learned or amount of gold received in a dialog box

#1
Posts: 3,969
Threads: 279
Thanks Received: 236
Thanks Given: 57
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
How can we use the dialog number 2948, 2949 and 2950? Those are used when you receive an item, learn a spell or receive an amount of GP.

As an example, #2948 is written like that: Received!, where is an item supplied by the calling code. However, the command 4B or 48 are 3 bytes long and we cannot add an item or a spell as a parameter of those two commands. I tried to find an example in the event dump but I found nothing.

I created two extra captions in the example in this video but I would rather know how to properly use captions #2948:



  Find
Quote  

#2
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 158
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
(11-27-2011, 04:42 PM)Madsiur Wrote: we cannot add an item or a spell as a parameter of those two commands. I tried to find an example in the event dump but I found nothing.

I'm not entirely sure what you mean here. It's not allowing you to make a dialog box and then add the item after it like this?:

CB/3103: 4B Display dialogue message $06A4, wait for button press

Got “Water Skean.”
CB/3106: 80 Add item $AC (Water Edge ) to inventory

[4B A4 06 80 AC]


I think maybe you need to call this subroutine instead?

CA/0008: 4B Display dialogue message $0B85, wait for button press

Received “”!
CA/000B: FE Return

The other 2 are right below that one.

I'm sorry if this doesn't help, I just don't really understand the problem here well enough.
Cool idea by the way. =)


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

#3
Posts: 3,969
Threads: 279
Thanks Received: 236
Thanks Given: 57
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
I'll try to clarify myself. I know how to add an item to the inventory. This is the part that bugs me:

(11-27-2011, 06:45 PM)Gi Nattak Wrote: I think maybe you need to call this subroutine instead?

CA/0008: 4B    Display dialogue message $0B85, wait for button press
             
              Received “i”!
CA/000B: FE    Return

If I call that subroutine (B2 08 00 00) or I call directly the message box (4B 85 OB) how can I tell the game what Item(I) will be displayed in the message box with an event command? My temporary solution was to create a custom message box with usME each time you want to display "Received 'name of the item' !" but from what I understand there would be a way to give the item value as a parameter to use in message box $0B85. If I do 4B 85 0B 80 00 would it display "Received dirk !" automatically in the message box? It's like when you open a treasure chest: It must use message $0B85 because there is not a message box written for each treasure chest in the game...I don't really  know how to put it in other words..


thanks for your answer however.
  Find
Quote  

#4
Posts: 2,768
Threads: 88
Thanks Received: 24
Thanks Given: 87
Joined: Jun 2009
Reputation: 25
Status
None
I was actually considering adding something like this into my hack

well not so much as a savepoint

but an old guy that is wandering around the world that asks you questions/riddles

I was thinking you meet him 3 times (twice in the WOB and once in the WOR) and he gives you incredible items if you answer his questions correctly (incredible for ur char at the time you get it anyway lolz)


"Sometimes ninjas do wrong to each other, and in dat way the force of tha earf' comes around da moon - and at that presence, da dirt, it overshadows the grass, so you're like, I can't cut dis grass, there's no sun comin' through. So in order to enable each other the two fruits have to look each other in da eye and understand we can only be right, as da ripe is wrong, you know what I mean?"

-HNIC
Quote  

#5
Posts: 3,969
Threads: 279
Thanks Received: 236
Thanks Given: 57
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(11-28-2011, 01:05 PM)Poco Loco Wrote: I was actually considering adding something like this into my hack

well not so much as a savepoint

but an old guy that is wandering around the world that asks you questions/riddles

This is by far a better idea than a save point...Laugh

I used that save point because there was a one time event related to the first time you get to a save point. Anyway you could even make you old sage travel by having his appearance bit cleared at the second location if you didn't met him at the first one.

  Find
Quote  

#6
Posts: 2,768
Threads: 88
Thanks Received: 24
Thanks Given: 87
Joined: Jun 2009
Reputation: 25
Status
None
now thats a good idea Wink


"Sometimes ninjas do wrong to each other, and in dat way the force of tha earf' comes around da moon - and at that presence, da dirt, it overshadows the grass, so you're like, I can't cut dis grass, there's no sun comin' through. So in order to enable each other the two fruits have to look each other in da eye and understand we can only be right, as da ripe is wrong, you know what I mean?"

-HNIC
Quote  

#7
Posts: 3,969
Threads: 279
Thanks Received: 236
Thanks Given: 57
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
To answer my own question and for everyone else who would like to know, I did a little research...

Here's the treasure chest decoding function:
Code:
Treasure chest decoding function
C0/4C06:    C220        REP #$20          (16 bit accum./memory)
C0/4C08:    BF3886ED    LDA $ED8638,X
C0/4C0C:    851A        STA $1A        (now the contents of the chest)
C0/4C0E:    BF3686ED    LDA $ED8636,X
C0/4C12:    851E        STA $1E        (the bit of this chest)
C0/4C14:    290700      AND #$0007
C0/4C17:    AA          TAX
C0/4C18:    A51E        LDA $1E
C0/4C1A:    29FF01      AND #$01FF
C0/4C1D:    4A          LSR A
C0/4C1E:    4A          LSR A
C0/4C1F:    4A          LSR A
C0/4C20:    A8          TAY
C0/4C21:    7B          TDC
C0/4C22:    E220        SEP #$20          (8 bit accum./memory)
C0/4C24:    B9401E      LDA $1E40,Y    (treasure chest bits)
C0/4C27:    3FFCBAC0    AND $C0BAFC,X  (is it this bit?)
C0/4C2B:    D0A6        BNE $4BD3      (branch and exit if not. interesting fail-safe)
C0/4C2D:    B9401E      LDA $1E40,Y    (treasure chest bits)
C0/4C30:    1FFCBAC0    ORA $C0BAFC,X
C0/4C34:    99401E      STA $1E40,Y    (set this chest as now open)
C0/4C37:    A51F        LDA $1F
C0/4C39:    1045        BPL $4C80         (if high bit = 0 then it's not a GP chest)
C0/4C3B:    A51A        LDA $1A
C0/4C3D:    8D0242      STA $4202
C0/4C40:    A964        LDA #$64       (GP amount * 100)
C0/4C42:    8D0342      STA $4203
C0/4C45:    EA          NOP
C0/4C46:    EA          NOP
C0/4C47:    EA          NOP
C0/4C48:    AC1642      LDY $4216
C0/4C4B:    8422        STY $22
C0/4C4D:    6424        STZ $24        (shame all 24-bits aren't used here)
C0/4C4F:    C221        REP #$21
C0/4C51:    98          TYA
C0/4C52:    6D6018      ADC $1860      (add to current GP, low two bytes)
C0/4C55:    8D6018      STA $1860      (and save)
C0/4C58:    7B          TDC
C0/4C59:    E220        SEP #$20          (8 bit accum./memory)
C0/4C5B:    6D6218      ADC $1862      (wrap high byte if needed)
C0/4C5E:    8D6218      STA $1862      (and save)
C0/4C61:    C998        CMP #$98       (is high byte greater than 152? this check is not perfect... LDX $1861 CPX #$9896 may give more precision)
C0/4C63:    9013        BCC $4C78      (branch if not, GP not maxed out)
C0/4C65:    AE6018      LDX $1860
C0/4C68:    E07F96      CPX #$967F
C0/4C6B:    900B        BCC $4C78
C0/4C6D:    A27F96      LDX #$967F
C0/4C70:    8E6018      STX $1860
C0/4C73:    A998        LDA #$98
C0/4C75:    8D6218      STA $1862      (set max GP as 9999999)
C0/4C78:    20E502      JSR $02E5 (get number grabbed ready for display purposes)
C0/4C7B:    A21000      LDX #$0010     (set CA/0010, event for "Found x GP!")
C0/4C7E:    802C        BRA $4CAC
C0/4C80:    A51F        LDA $1F        (would've been better to BIT all of these checks, so A would be intact throughout)
C0/4C82:    2940        AND #$40          (is it a item-containing chest?)
C0/4C84:    F00D        BEQ $4C93        (branch if not)
C0/4C86:    A51A        LDA $1A
C0/4C88:    8D8305      STA $0583        (item index)
C0/4C8B:    20FCAC      JSR $ACFC
C0/4C8E:    A20800      LDX #$0008     (set CA/0008, event for "Received x!")
C0/4C91:    8019        BRA $4CAC
C0/4C93:    A51F        LDA $1F
C0/4C95:    2920        AND #$20        (is it a monster-in-a-box?)
C0/4C97:    F00A        BEQ $4CA3        (branch if not)
C0/4C99:    A51A        LDA $1A        (load the "contents" byte)
C0/4C9B:    8D8907      STA $0789        (store that to $0789; now this is the stored monster set to use with gen. act. 0x8E)
C0/4C9E:    A24000      LDX #$0040     (set CA/0040, event for "Monster-in-a-box!")
C0/4CA1:    8009        BRA $4CAC
C0/4CA3:    A51F        LDA $1F
C0/4CA5:    2910        AND #$10             (is it something else???)
C0/4CA7:    F000        BEQ $4CA9        (why check... this is a totally pointless line probably inserted in case they wanted to branch elsewhere to code for some other type of chest)
C0/4CA9:    A21400      LDX #$0014     (set CA/0014, event for "Empty!")    
C0/4CAC:    86E5        STX $E5        (many things branch here, so this actually sets a few events)
C0/4CAE:    8EF405      STX $05F4
C0/4CB1:    A9CA        LDA #$CA
C0/4CB3:    85E7        STA $E7
C0/4CB5:    8DF605      STA $05F6
C0/4CB8:    A20000      LDX #$0000     (LDX $00...)
C0/4CBB:    8E9405      STX $0594
C0/4CBE:    A9CA        LDA #$CA
C0/4CC0:    8D9605      STA $0596
C0/4CC3:    A901        LDA #$01
C0/4CC5:    8DC705      STA $05C7
C0/4CC8:    A20300      LDX #$0003
C0/4CCB:    86E8        STX $E8
C0/4CCD:    AC0308      LDY $0803
C0/4CD0:    B97C08      LDA $087C,Y
C0/4CD3:    997D08      STA $087D,Y
C0/4CD6:    A904        LDA #$04
C0/4CD8:    997C08      STA $087C,Y
C0/4CDB:    20ED2F      JSR $2FED
C0/4CDE:    A62A        LDX $2A
C0/4CE0:    BF00007F    LDA $7F0000,X
C0/4CE4:    C913        CMP #$13
C0/4CE6:    D01E        BNE $4D06
C0/4CE8:    868F        STX $8F
C0/4CEA:    A20C4D      LDX #$4D0C
C0/4CED:    868C        STX $8C
C0/4CEF:    A9C0        LDA #$C0
C0/4CF1:    858E        STA $8E        (C0/4D0C?)
C0/4CF3:    A20000      LDX #$0000     (LDX $00...)
C0/4CF6:    862A        STX $2A
C0/4CF8:    A904        LDA #$04
C0/4CFA:    8D5A05      STA $055A
C0/4CFD:    20C41E      JSR $1EC4
C0/4D00:    A9A6        LDA #$A6
C0/4D02:    20D302      JSR $02D3      (JMP fool!)
C0/4D05:    60          RTS

This function check if the treasure chest contain GP, an item or a monster and will call the appropriate event (respectively CA/0010, CA/0008, CA/0040 or even CA/0014, the event for an empty chest).

Those event will then display the dialog box with the item or the amount of GP as a parameter if it's the case.

If we take the example of subroutine CA/0008, the only place I found in the entire game that it is called is in the portion of code I posted and therefore is only used for treasure chests. There is no example in the event dump where CA/0008 is called. I beleive there is no way to give the item name as a parameter in events.

Every item given through events will need a custom dialog box, where you write "Receive 'item name'!" and you need to manually add the item to the inventory using command 80.

The situation is probably the same for the amount of GP to display and for the dialog box that display "Learned []!", where is a spell, it may be only used at the end of a battle, not through events.
  Find
Quote  

#8
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 158
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
I concluded the same, will need a custom dialog box, as the game is not programmed to work in such a way outside of the treasure data when calling the S.R.


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

#9
Posts: 51
Threads: 5
Thanks Received: 2
Thanks Given: 0
Joined: Apr 2018
Reputation: 8
Status
Shell
This is an old thread, but in case it helps anyone, the assembly below changes two unused event commands
6D XX: Give item XX and show dialogue box with the item name
6E XX: Give XX * 100 GP and show dialogue box with amount
It basically just copies the treasure chest code, which is why it's XX*100 GP.
Code:
hirom

org $C0ACFC
GiveItem:

org $C04D06
PlaySound:

org $C0B1A3:
Subroutine:

org $C09934
DW Action6D
DW Action6E

org $C0D613
Action6D:
LDA $EB
STA $1A
STA $0583
JSR GiveItem
JSR PlaySound
LDA #$08
STA $EB
BRA CommonEnd

Action6E:
LDA $EB
STA $1A
STA $4202
LDA #$64
STA $4203
NOP
NOP
NOP
LDY $4216
STY $22
STZ $24
REP #$21
TYA
ADC $1860
STA $1860
TDC
SEP #$20
ADC $1862
STA $1862
CMP #$98
BCC NotMaxedGP
LDX $1860
CPX #$967F
BCC NotMaxedGP
LDX #$967F
STX $1860
LDA #$98
STA $1862
NotMaxedGP:
JSR PlaySound
JSR $02E5
LDA #$10
STA $EB

CommonEnd:
STZ $EC
LDA #$00
STA $ED
LDA #$02
JMP Subroutine
  Find
Quote  
[-] The following 3 users say Thank You to Subtraction for this post:
  • madsiur (04-05-2018), Tenkarider (04-05-2018), Warrax (04-06-2018)

#10
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
gg, kinda like something i'd do in my hack.
would it be too much asking for a patch? in that way i'd be able to extract raw hex from it...


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