top of page

Item Description on Acquire

6.4

Description Loading...

HMA Discord Link 2.png

Credits:

Defa


How To

The attached .hma file enables showing the item description window at the top of the screen when any item (consumable, Berry, TM, Key...) is obtained for the first time. It adds some anchors, all found in data.items.descOnAcq, but you do not need to edit anything.


Once applied, this feature is always active automatically, you do not need to edit any existing script in your romhack.

The item description window is shown only when using find.item, npc.item, special 0xE4 (info below) and Hidden Item signpost events, and only when an item is obtained for the first time via these commands. When an already obtained item is obtained again, its sprite is shown on the right side of the message box at the bottom of the screen; for Key Items and TMs/HMs, their sprite is shown on the center of the screen instead.

This feature also enables two CFRU special commands:


special 0xE4 ShowItemSpriteOnFindObtain

This special shows the item description window manually, if the item has not been obtained yet, otherwise it shows the item sprite on the bottom right corner of the screen. Ideally you should use a msgbox after this.

Before using this special, you have to set var4 to the item index.


special 0xE5 ClearItemSpriteAfterFindObtain

This special removes the item description window or the item sprite shown with the special above. Ideally you should use it after closing the msgbox paired with the special above.

NOTE: Between special 0xE4 and special 0xE5 do not change the value of var6 (yes, six), this will make the item description window or the item sprite to not be removed and may lead to graphics glitches!


NOTE: msgbox.item, additem and addpcitem do not show the item description window and do not mark an item as obtained for the first time.


NOTE: In CFRU source code there is a comment that says that this feature breaks Celadon Game Corner prize room, I tested it and everything looks like it works correctly, I did not get any kind of bug. The script of the clerk on the left uses npc.item to give the prizes, and the item description window is shown correctly.


NOTE: TMs 51 to 120 added by HUBOL do not have a description and their sprites' palette is not set correctly, you should update them manually.


NOTE: Normally there is no way to clear the flag that is set when an item is obtained for the first time. If you would like to show the item description window more than once for the same item, add this routine in free space and note the offset:


    ldr   r0, =0x020370C0 @var4
    ldrh  r0, [r0]
    lsr   r0, r0, #3 @div by 8
    lsl   r0, r0, #24
    lsr   r0, r0, #24
    ldr   r1, =0x03005008 @gSaveBlock1Ptr
    ldr   r1, [r1, #0]
    add   r0, r0, r1
    ldr   r1, =0x00002F18 @->itemObtainedFlags
    add   r0, r0, r1
    ldrb  r1, [r0, #0]
    mov   r2, #7
    and   r2, r1
    mov   r1, #1
    lsl   r1, r2
    bic   r2, r1
    strb  r2, [r0, #0]
    bx    r14

Set var4 to the item index, then callasm <offset+1>. The item description window for the item set in var4 will be shown again (only once) when this item is obtained again or after special 0xE4.


Happy Hacking!

 


bottom of page