Battle Autoprompts - pret/pokecrystal GitHub Wiki
In Generation 3 onwards, most battle texts don't require the player to click A. That's not the case in Generation 2, as most battle texts require prompts which the player must press A. Thus, players tend to spam it after making a move. This tutorial aims to remove prompts for most battle texts by making the game scroll through them automatically.
- Add new charmap constants
- Define new macros for autoprompts
- Make functions for the new macros
- Edit battle text to not require prompts
We first need to edit charmap.asm to make the autoprompts possible. Each control character is assigned to a 2 hex digit. There are a lot of unassigned hex digits, thus we can use some of them.
...
charmap "<_CONT>", $4b ; implements "<CONT>"
+ ; While "<SCROLL>" this is used in sharply rose or sharply fell stat texts, this will be
+ ; adjusted to give the player time to read.
charmap "<SCROLL>", $4c
charmap "<NEXT>", $4e
charmap "<LINE>", $4f
charmap "@", $50 ; string terminator
charmap "<PARA>", $51
charmap "<PLAYER>", $52 ; wPlayerName
charmap "<RIVAL>", $53 ; wRivalName
charmap "#", $54 ; "POKé"
charmap "<CONT>", $55
charmap "<……>", $56 ; "……"
charmap "<DONE>", $57
charmap "<PROMPT>", $58
charmap "<TARGET>", $59
charmap "<USER>", $5a
charmap "<PC>", $5b ; "PC"
charmap "<TM>", $5c ; "TM"
charmap "<TRAINER>", $5d ; "TRAINER"
charmap "<ROCKET>", $5e ; "ROCKET"
charmap "<DEXEND>", $5f
+ charmap "<ATPRA>", $60
+ charmap "<ATDNE>", $61
...
Next, we edit macros/scripts/text.asm to add new macros that we'll be using for autoprompts.
DEF text EQUS "db TX_START," ; Start writing text.
DEF next EQUS "db \"<NEXT>\"," ; Move a line down.
DEF line EQUS "db \"<LINE>\"," ; Start writing at the bottom line.
DEF page EQUS "db \"@\"," ; Start a new Pokédex page.
DEF para EQUS "db \"<PARA>\"," ; Start a new paragraph.
+ DEF autopara EQUS "db \"<ATPRA>\"," ; Automatically start a new paragraph.
DEF cont EQUS "db \"<CONT>\"," ; Scroll to the next line.
+ DEF scroll EQUS "db \"<SCROLL>\"," ; Scroll to the next line, pausing shortly.
DEF done EQUS "db \"<DONE>\"" ; End a text box.
+ DEF autodone EQUS "db \"<ATDNE>\"" ; Automatically ends a text box.
DEF prompt EQUS "db \"<PROMPT>\"" ; Prompt the player to end a text box (initiating some other event).
We then edit home/text.asm and make functions for the new constants.
dict "<MOBILE>", MobileScriptChar
dict "<LINE>", LineChar
dict "<NEXT>", NextLineChar
dict "<CR>", CarriageReturnChar
dict "<NULL>", NullChar
- dict "<SCROLL>", _ContTextNoPause
+ dict "<SCROLL>", _ContTextPauseShort
dict "<_CONT>", _ContText
dict "<PARA>", Paragraph
+ dict "<ATPRA>", AutoParagraph
dict "<MOM>", PrintMomsName
...
dict "<LF>", LineFeedChar
dict "<CONT>", ContText
dict "<……>", SixDotsChar
dict "<DONE>", DoneText
+ dict "<ATDNE>", AutoDoneText
dict "<PROMPT>", PromptText
dict "<PKMN>", PlacePKMN
dict "<POKE>", PlacePOKE
...
_ContTextNoPause::
push de
call TextScroll
call TextScroll
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
pop de
jp NextChar
+_ContTextPauseShort::
+ push de
+ call TextScroll
+ call TextScroll
+ hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
+ ld c, 5
+ call DelayFrames
+ pop de
+ jp NextChar
...
Paragraph::
push de
ld a, [wLinkMode]
cp LINK_COLOSSEUM
jr z, .linkbattle
cp LINK_MOBILE
jr z, .linkbattle
call LoadBlinkingCursor
.linkbattle
call Text_WaitBGMap
call PromptButton
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
call ClearBox
call UnloadBlinkingCursor
ld c, 20
call DelayFrames
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
pop de
jp NextChar
+AutoParagraph::
+ push de
+ call Text_WaitBGMap
+ ld c, 10
+ call DelayFrames
+ hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
+ lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
+ call ClearBox
+ ld c, 20
+ call DelayFrames
+ hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
+ pop de
+ jp NextChar
...
DoneText::
pop hl
ld de, .stop
dec de
ret
.stop:
text_end
+AutoDoneText::
+ call Text_WaitBGMap
+ ld c, 20
+ call DelayFrames
+ jr DoneText
Edit data/text/common_1.asm for the withdraw battle text:
_EnemyWithdrewText::
text "<ENEMY>"
line "withdrew"
- cont "@"
+ scroll "@"
text_ram wEnemyMonNickname
text "!"
- prompt
+ autodone
_EnemyUsedOnText::
text "<ENEMY>"
line "used @"
text_ram wMonOrItemNameBuffer
text_start
- cont "on @"
+ scroll "on @"
text_ram wEnemyMonNick
text "!"
- prompt
+ autodone
Also, edit data/text/battle.asm. Since the text is disorganized, just remember to edit the text related to type effectiveness, residual damage, item use, weather status, and more. Make sure to avoid editing fainting and EXP prompts. Feel free to edit the file by replacing the following macros:
-
cont
toscroll
-
para
toautopara
-
done
toautodone
.
That's it! You've made most battle texts have autoprompts! If you want to have an idea how it'd look like in action, you can watch this video or this video.