diff options
-rw-r--r-- | Add-a-new-TM-or-HM.md (renamed from Add-a-new-TM.md) | 88 | ||||
-rw-r--r-- | Tutorials.md | 5 | ||||
-rw-r--r-- | screenshots/tm51-aeroblast-hm08-softboiled.png | bin | 0 -> 2973 bytes | |||
-rw-r--r-- | screenshots/tm51-aeroblast.png | bin | 2247 -> 0 bytes |
4 files changed, 71 insertions, 22 deletions
diff --git a/Add-a-new-TM.md b/Add-a-new-TM-or-HM.md index bf153df..b585f78 100644 --- a/Add-a-new-TM.md +++ b/Add-a-new-TM-or-HM.md @@ -1,16 +1,19 @@ -This tutorial is for how to add a new TM. As an example, we'll add TM51 Aeroblast. +This tutorial is for how to add a new TM or HM. As an example, we'll add TM51 Aeroblast and HM08 Softboiled. + +(I'm using Softboiled as an HM example because it already has a field effect outside of battle. Creating new field-effect moves is beyond the scope of this tutorial.) ## Contents -1. [Define constants with `add_tm`](#1-define-constants-with-add_tm) +1. [Define constants with `add_tm` or `add_hm`](#1-define-constants-with-add_tm-or-add_hm) 2. [Define standard item data](#2-define-standard-item-data) 3. [Update the TM/HM move table](#3-update-the-tmhm-move-table) -4. [Add the TM to base learnsets](#4-add-the-tm-to-base-learnsets) -5. [Adding up to 120 new TMs](#5-adding-up-to-120-new-tms) +4. [Add the TM or HM to base learnsets](#4-add-the-tm-or-HM-to-base-learnsets) +5. [Make the HM move unforgettable](#5-make-the-hm-move-unforgettable) +6. [Adding up to 120 new TMs or HMs](#5-adding-up-to-120-new-tms-or-hms) -## 1. Define constants with `add_tm` +## 1. Define constants with `add_tm` or `add_hm` Edit [constants/item_constants.asm](../blob/master/constants/item_constants.asm): @@ -31,9 +34,26 @@ Edit [constants/item_constants.asm](../blob/master/constants/item_constants.asm) add_tm NIGHTMARE ; f2 + add_tm AEROBLAST NUM_TMS = const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC + + add_hm: MACRO + if !DEF(HM01) + HM01 = const_value + endc + define _\@_1, "HM_\1" + const _\@_1 + enum \1_TMNUM + ENDM + + add_hm CUT ; f3 + ... + add_hm WATERFALL ; f9 ++ add_hm SOFTBOILED + NUM_HMS = const_value - HM01 ``` -The `add_tm` macro will simultaneously define the next item constant `TM_AEROBLAST` and the `TMNUM` constant `AEROBLAST_TMNUM` (equal to 51). The item constant is used for `giveitem` scripts, in Mart inventories, etc. The `TMNUM` constant is not used directly, but gets referred to by the `tmhm` learnsets in Pokémon base data. (We'll get to that later.) +The `add_tm` mand `add_hm` macros simultaneously define the next item constant (`TM_AEROBLAST` and `HM_SOFTBOILED` respectively) and the next `TMNUM` constant (`AEROBLAST_TMNUM` and `SOFTBOILED_TMNUM`). The item constants are used for `giveitem` scripts, in Mart inventories, etc. The `TMNUM` constants are not used directly, but get referred to by the `tmhm` learnsets in Pokémon base data. (We'll get to that later.) + +(This also demonstrates why Rock Smash would be an inconvenient example for adding a new HM. TM08 is already Rock Smash, and we can't define `ROCK_SMASH_TMNUM` twice, so we would have to do the extra work of replacing TM08 with some other move.) ## 2. Define standard item data @@ -48,9 +68,10 @@ Edit [data/items/names.asm](../blob/master/data/items/names.asm): db "HM01@" ... db "HM07@" ++ db "HM08@" db "TERU-SAMA@" - db "TERU-SAMA@" - db "TERU-SAMA@" +- db "TERU-SAMA@" db "TERU-SAMA@" db "TERU-SAMA@" db "TERU-SAMA@" @@ -63,18 +84,20 @@ Edit [data/items/attributes.asm](../blob/master/data/items/attributes.asm): ; TM50 item_attribute 2000, HELD_NONE, 0, CANT_SELECT, TM_HM, ITEMMENU_PARTY, ITEMMENU_NOUSE +; TM51 -+ item_attribute 2000, HELD_NONE, 0, CANT_SELECT, TM_HM, ITEMMENU_PARTY, ITEMMENU_NOUSE ++ item_attribute 3000, HELD_NONE, 0, CANT_SELECT, TM_HM, ITEMMENU_PARTY, ITEMMENU_NOUSE ; HM01 item_attribute 0, HELD_NONE, 0, CANT_SELECT | CANT_TOSS, TM_HM, ITEMMENU_PARTY, ITEMMENU_NOUSE ... ; HM07 item_attribute 0, HELD_NONE, 0, CANT_SELECT | CANT_TOSS, TM_HM, ITEMMENU_PARTY, ITEMMENU_NOUSE ++; HM08 ++ item_attribute 0, HELD_NONE, 0, CANT_SELECT | CANT_TOSS, TM_HM, ITEMMENU_PARTY, ITEMMENU_NOUSE ; ITEM_FA item_attribute $9999, HELD_NONE, 0, NO_LIMITS, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE -; $fb - item_attribute $9999, HELD_NONE, 0, NO_LIMITS, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE - ; $fc - item_attribute $9999, HELD_NONE, 0, NO_LIMITS, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE +-; $fc +- item_attribute $9999, HELD_NONE, 0, NO_LIMITS, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE ; $fd item_attribute $9999, HELD_NONE, 0, NO_LIMITS, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE ; $fe @@ -85,7 +108,7 @@ Edit [data/items/attributes.asm](../blob/master/data/items/attributes.asm): item_attribute $9999, HELD_NONE, 0, NO_LIMITS, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE ``` -Notice how the `ItemNames` and `ItemAttributes` both already had the maximum 256 entries, so we had to remove dummy entries to add the TM51 ones. And there aren't many dummy entries; 251 items are defined, from $00 to $FA. If you want a lot of new TMs, you'll have to remove some unused items. There are 26 unused <code>ITEM_<i>XX</i></code> constants, counting `ITEM_C3` and `ITEM_DC`, which interrupt the sequence of TMs and need [a bit of special handling](../blob/master/docs/design_flaws.md#item_c3-and-item_dc-break-up-the-continuous-sequence-of-tm-items) to remove. +Notice how the `ItemNames` and `ItemAttributes` both already had the maximum 256 entries, so we had to remove dummy entries to fit TM51 and HM08. And there aren't many dummy entries; 251 items are defined, from $00 to $FA. If you want a lot of new TMs or HMs, you'll have to remove some unused items. There are 26 unused <code>ITEM_<i>XX</i></code> constants, counting `ITEM_C3` and `ITEM_DC`, which interrupt the sequence of TMs and need [a bit of special handling](../blob/master/docs/design_flaws.md#item_c3-and-item_dc-break-up-the-continuous-sequence-of-tm-items) to remove. ## 3. Update the TM/HM move table @@ -100,28 +123,55 @@ Edit [data/moves/tmhm_moves.asm](../blob/master/data/moves/tmhm_moves.asm): ... db NIGHTMARE + db AEROBLAST + ; HMs + db CUT + ... + db WATERFALL ++ db SOFTBOILED ``` -This associates the `AEROBLAST_TMNUM` TM/HM constant with the `AEROBLAST` move constant. +This associates the `AEROBLAST_TMNUM` TM/HM constant with the `AEROBLAST` move constant, and the `SOFTBOILED_TMNUM` TM/HM constant with the `SOFTBOILED` move constant. -## 4. Add the TM to base learnsets +## 4. Add the TM or HM to base learnsets -So far we've created a TM51 item and assigned it a move, but nothing can learn it. Edit the `tmhm` entries in [data/pokemon/base_stats/](../blob/master/data/pokemon/base_stats/): +So far we've created items for TM51 and HM08 and assigned their moves, but the items aren't compatible with any Pokémon. So edit the `tmhm` entries in [data/pokemon/base_stats/](../blob/master/data/pokemon/base_stats/): +- [chansey.asm](../blob/master/data/pokemon/base_stats/chansey.asm): `..., FLASH, FLAMETHROWER, ...` → `..., FLASH, SOFTBOILED, FLAMETHROWER, ...` +- [blissey.asm](../blob/master/data/pokemon/base_stats/blissey.asm): `..., FLASH, FLAMETHROWER, ...` → `..., FLASH, SOFTBOILED, FLAMETHROWER, ...` - [lugia.asm](../blob/master/data/pokemon/base_stats/lugia.asm): `..., NIGHTMARE, FLY, ...` → `..., NIGHTMARE, AEROBLAST, FLY, ...` -- [mew.asm](../blob/master/data/pokemon/base_stats/mew.asm): `..., NIGHTMARE, CUT, ...` → `..., NIGHTMARE, AEROBLAST, CUT, ...` +- [mew.asm](../blob/master/data/pokemon/base_stats/mew.asm): `..., NIGHTMARE, CUT, ..., WATERFALL, FLAMETHROWER, ...` → `..., NIGHTMARE, AEROBLAST, CUT, ..., WATERFALL, SOFTBOILED, FLAMETHROWER, ...` + +The learnable moves have to be in the same order as the `add_tm` and `add_hm` lines, since that's what they're referencing: the `tmhm` macro turns `NIGHTMARE` into `NIGHTMARE_TMNUM`, `SOFTBOILED` into `SOFTBOILED_TMNUM`, etc, and then processes them to efficiently store learnsets. (We'll get to the details of how it works next.) + + +## 5. Make the HM move unforgettable + +Edit [home/hm_moves.asm](../blob/master/home/hm_moves.asm): + +```diff + .HMMoves: + db CUT + db FLY + db SURF + db STRENGTH + db FLASH + db WATERFALL + db WHIRLPOOL ++ db SOFTBOILED + db -1 ; end +``` -The learnable moves have to be in the same order as the `add_tm` lines, since that's what they're referencing: the `tmhm` macro turns `NIGHTMARE` into `NIGHTMARE_TMNUM`, `CUT` into `CUT_TMNUM`, etc, and then processes them to efficiently store learnsets. (We'll get to the details of how it works next.) +Now Softboiled can't be forgotten except via the Move Deleter in Blackthorn City. Anyway, that's all: - + -## 5. Adding up to 120 new TMs +## 6. Adding up to 120 new TMs or HMs -There are 50 TMs, 7 HMs, and 3 tutor moves; they each have an associated `*_TMNUM` constant, from 1 to 60. Adding TM51 Aeroblast brings the total to 61. If you end up with more than 64 learnable moves, you'll have to start updating the `tmhm` macro in [data/pokemon/base_stats.asm](../blob/master/data/pokemon/base_stats.asm). +There are 50 TMs, 7 HMs, and 3 tutor moves; they each have an associated `*_TMNUM` constant, from 1 to 60. Adding TM51 Aeroblast and HM08 Softboiled brings the total to 62. If you end up with more than 64 learnable moves, you'll have to start updating the `tmhm` macro in [data/pokemon/base_stats.asm](../blob/master/data/pokemon/base_stats.asm). Here's the macro as-is: diff --git a/Tutorials.md b/Tutorials.md index a7c31bd..89c4745 100644 --- a/Tutorials.md +++ b/Tutorials.md @@ -17,7 +17,7 @@ Tutorials may use diff syntax to show edits: - [Move (up to 254)](Add-a-new-move) - [Move effect](Add-a-new-move-effect) - [Item (up to 254)](Add-different-kinds-of-new-items) -- [TM (up to 120)](Add-a-new-TM) +- [TM or HM (up to 120)](Add-a-new-TM-or-HM) - [Party menu icon (up to 253)](Add-a-new-party-menu-icon) - [Overworld sprite](Add-a-new-overworld-sprite) - [Map object movement behavior](Add-a-new-map-object-movement-behavior) @@ -67,8 +67,7 @@ Tutorials may use diff syntax to show edits: - Move effect script command - Example map scripts (for common cases like an NPC that gives you an item) - Scene for an existing map (aka triggers; auto-running event scripts) -- HMs: - - Rock Smash (demonstrating how HMS themselves work, since Rock Smash already exists) +- Field moves: - Dive (exists in [Orange](https://github.com/PiaCarrot/pokeorange)) - Rock Climb (exists in [Orange](https://github.com/PiaCarrot/pokeorange)) - Evolution methods (location, held item, move, [etc](https://gitgud.io/pfero/axyllagame/commit/81914d43eb89195734caee724c0a40d4686a0bab)) diff --git a/screenshots/tm51-aeroblast-hm08-softboiled.png b/screenshots/tm51-aeroblast-hm08-softboiled.png Binary files differnew file mode 100644 index 0000000..b94a91b --- /dev/null +++ b/screenshots/tm51-aeroblast-hm08-softboiled.png diff --git a/screenshots/tm51-aeroblast.png b/screenshots/tm51-aeroblast.png Binary files differdeleted file mode 100644 index 49bf0d7..0000000 --- a/screenshots/tm51-aeroblast.png +++ /dev/null |