[4.5.9] Open a text dialogue on tile collision and close it by pressing a button

chains

Member
Hey guys! This is a quick one.

In the `MOD_AdventureBase`, I've found a pretty neat script that allows your char to collide with the tile "NPC Trigger" and show the text box for the given screen. Problem is, if the text has the "more" tag, it won't show. Even worse, you can't make it disappear.

Not sure how they do that in the Adventure Base. I couldn't find it, so I did it myself:

1) Create a new script (drawTextIfRequired.asm) and add it to your `input` folder
2) Copy this content:

Code:
;; this script will keep drawing the text box after the "more"
;; in this module, we have the tile "NPC Trigger" to show a text box when hit
;; the problem is that we need to keep drawing it by pressing the A button
;; this script only draws the box if we are in a state of a box being drawn


LDA npcTrigger
AND #%00000001
BEQ skipNPCText

    DrawBox #BOX_1_ORIGIN_X, #BOX_1_ORIGIN_Y, #BOX_1_WIDTH , #BOX_1_HEIGHT, #TEXT_NPC, npc_text
        ;;; x
        ;;; y
        ;;; width
        ;;; height
        ;;; text mode
            ;#TEXT_NPC pulls from the index in the following argument.
            ;#TEXT_FREE allows you to just write a label definition in the following argument
            ; and as long as you're in the right bank, will draw it.
        ;;; string or index.

skipNPCText:
   RTS

It will add a quick check in the `npcTrigger` variable to verify if the text needs to be drawn.

3) Map it to some of your buttons in the `Input Editor`. Down could be a potential button since it won be pressed too much, saving CPU cycles. :)

I hope this one could help someone out there.

Note that this is different from drawing a dialogue box on NPC collision.
 
Top Bottom