summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Show-move-names-when-you-receive-a-TM-or-HM.md183
-rw-r--r--Tutorials.md2
-rw-r--r--screenshots/tm-move-names.pngbin0 -> 3186 bytes
3 files changed, 184 insertions, 1 deletions
diff --git a/Show-move-names-when-you-receive-a-TM-or-HM.md b/Show-move-names-when-you-receive-a-TM-or-HM.md
new file mode 100644
index 0000000..c79e1a2
--- /dev/null
+++ b/Show-move-names-when-you-receive-a-TM-or-HM.md
@@ -0,0 +1,183 @@
+In Gen 2, acquiring a TM or HM would just say "*PLAYER* received TM*##*!" when you're given one, or "*PLAYER found TM*##*!" when you take an item ball or hidden item. Gen 4 made these messages more helpful by showing the name of the move that the TM/HM teaches. This tutorial will implement that little quality of life feature.
+
+
+## Contents
+
+1. [Define a routine to append move names after TM/HM item names](#1-define-a-routine-to-append-move-names-after-tmhm-item-names)
+2. [Use the new routine in all cases where you acquire an item](#2-use-the-new-routine-in-all-cases-where-you-acquire-an-item)
+3. [Update the hard-coded TM24 messages](#3-update-the-hard-coded-tm24-messages)
+
+
+## 1. Define a routine to append move names after TM/HM item names
+
+Edit [engine/overworld/scripting.asm](../blob/master/engine/overworld/scripting.asm):
+
+```diff
++AppendTMHMMoveName::
++; a = item ID
++ ld a, [wNamedObjectIndexBuffer]
++ cp TM01
++ ret c
++; save item name buffer
++ push de
++; a = TM/HM number
++ ld c, a
++ farcall GetTMHMNumber
++ ld a, c
++; a = move ID
++ ld [wTempTMHM], a
++ predef GetTMHMMove
++ ld a, [wTempTMHM]
++; wStringBuffer1 = move name
++ ld [wNamedObjectIndexBuffer], a
++ call GetMoveName
++; hl = item name buffer
++ pop hl
++; append wStringBuffer1 to item name buffer
++ ld [hl], " "
++ inc hl
++ ld de, wStringBuffer1
++ jp CopyName2
+```
+
+
+## 2. Use the new routine in all cases where you acquire an item
+
+Edit [engine/overworld/scripting.asm](../blob/master/engine/overworld/scripting.asm) again:
+
+```diff
+ Script_verbosegiveitem:
+ ; script command 0x9e
+ ; parameters: item, quantity
+
+ call Script_giveitem
+ call CurItemName
+ ld de, wStringBuffer1
+ ld a, 1
+ call CopyConvertedText
++ ld de, wStringBuffer4 + STRLEN("TM##")
++ call AppendTMHMMoveName
+ ld b, BANK(GiveItemScript)
+ ld de, GiveItemScript
+ jp ScriptCall
+```
+
+```diff
+ Script_verbosegiveitem2:
+ ; script command 0x9f
+ ; parameters: item, var
+
+ call GetScriptByte
+ cp -1
+ jr nz, .ok
+ ld a, [wScriptVar]
+ .ok
+ ld [wCurItem], a
+ call GetScriptByte
+ call GetVarAction
+ ld a, [de]
+ ld [wItemQuantityChangeBuffer], a
+ ld hl, wNumItems
+ call ReceiveItem
+ ld a, TRUE
+ jr c, .ok2
+ xor a
+ .ok2
+ ld [wScriptVar], a
+ call CurItemName
+ ld de, wStringBuffer1
+ ld a, 1
+ call CopyConvertedText
++ ld de, wStringBuffer4 + STRLEN("TM##")
++ call AppendTMHMMoveName
+ ld b, BANK(GiveItemScript)
+ ld de, GiveItemScript
+ jp ScriptCall
+```
+
+Edit [engine/events/misc_scripts.asm](../blob/master/engine/events/misc_scripts.asm):
+
+```diff
+ FindItemInBallScript::
+ callasm .TryReceiveItem
+ ...
+
+ .TryReceiveItem:
+ xor a
+ ld [wScriptVar], a
+ ld a, [wEngineBuffer1]
+ ld [wNamedObjectIndexBuffer], a
+ call GetItemName
+ ld hl, wStringBuffer3
+ call CopyName2
++ ld de, wStringBuffer3 + STRLEN("TM##")
++ farcall AppendTMHMMoveName
+ ld a, [wEngineBuffer1]
+ ld [wCurItem], a
+ ld a, [wCurFruit]
+ ld [wItemQuantityChangeBuffer], a
+ ld hl, wNumItems
+ call ReceiveItem
+ ret nc
+ ld a, $1
+ ld [wScriptVar], a
+ ret
+```
+
+Edit [engine/events/misc_scripts_2.asm](../blob/master/engine/events/misc_scripts_2.asm):
+
+```diff
+ HiddenItemScript::
+ opentext
+ copybytetovar wEngineBuffer3
+ itemtotext USE_SCRIPT_VAR, MEM_BUFFER_0
++ callasm .append_tmhm_move_name
+ writetext .found_text
+ giveitem ITEM_FROM_MEM
+ iffalse .bag_full
+ callasm SetMemEvent
+ specialsound
+ itemnotify
+ jump .finish
+
+ .bag_full
+ buttonsound
+ writetext .no_room_text
+ waitbutton
+
+ .finish
+ closetext
+ end
++
++.append_tmhm_move_name
++ ld de, wStringBuffer3 + STRLEN("TM##")
++ farcall AppendTMHMMoveName
++ ret
+```
+
+
+## 3. Update the hard-coded TM24 messages
+
+Edit [maps/BlackthornGym1F.asm](../blob/master/maps/BlackthornGym1F.asm):
+
+```diff
+ BlackthornGymText_ReceivedTM24:
+ text "<PLAYER> received"
+- line "TM24."
++ line "TM24 DRAGONBREATH."
+ done
+```
+
+And edit [maps/DragonsDenB1F.asm](../blob/master/maps/DragonsDenB1F.asm):
+
+```diff
+ NotifyReceiveDragonbreath:
+ text "<PLAYER> received"
+- line "TM24."
++ line "TM24 DRAGONBREATH."
+ done
+```
+
+Now we'll see the move name along with the TM/HM number when it's first acquired.
+
+![Screenshot](screenshots/tm-move-names.png)
diff --git a/Tutorials.md b/Tutorials.md
index 9ca83cb..6933cab 100644
--- a/Tutorials.md
+++ b/Tutorials.md
@@ -66,6 +66,7 @@ Tutorials may use diff syntax to show edits:
- [Replace stat experience with EVs](Replace-stat-experience-with-EVs)
- [Don't gain experience at level 100](Don't-gain-experience-at-level-100)
- [Erratic and Fluctuating experience growth rates](Erratic-and-Fluctuating-experience-growth-rates)
+- [Show move names when you receive a TM or HM](Show-move-names-when-you-receive-a-TM-or-HM)
- [Infinitely reusable TMs](Infinitely-reusable-TMs)
- [Automatically reuse Repel](Automatically-reuse-Repel)
- [Evolution moves](Evolution-moves)
@@ -100,7 +101,6 @@ Tutorials may use diff syntax to show edits:
- Short beeping for low HP
- Gain experience from catching Pokémon
- Trainer dialog and music change for their last Pokémon
-- TM/HM item balls say the move name
- Items that act like overworld moves
- Safari Game
- Ghost and Silph Scope
diff --git a/screenshots/tm-move-names.png b/screenshots/tm-move-names.png
new file mode 100644
index 0000000..2afe93c
--- /dev/null
+++ b/screenshots/tm-move-names.png
Binary files differ