diff options
-rw-r--r-- | Add-a-new-Mart.md | 139 | ||||
-rw-r--r-- | Tutorials.md | 3 | ||||
-rw-r--r-- | screenshots/evo-stone-mart.png | bin | 0 -> 2082 bytes |
3 files changed, 141 insertions, 1 deletions
diff --git a/Add-a-new-Mart.md b/Add-a-new-Mart.md new file mode 100644 index 0000000..f48ac29 --- /dev/null +++ b/Add-a-new-Mart.md @@ -0,0 +1,139 @@ +This tutorial is for how to add a new Poké Mart. As an example, we'll add an evolution stone merchant to Goldenrod Dept. Store. + + +## Contents + +1. [Define a mart constant](#1-define-a-mart-constant) +2. [Give it an inventory](#2-give-it-an-inventory) +3. [Use it in a map script](#3-use-it-in-a-map-script) + + +## 1. Define a mart constant + +Edit [constants/item_data_constants.asm](../blob/master/constants/item_data_constants.asm): + +```diff +; Marts indexes (see data/items/marts.asm) + const_def + const MART_CHERRYGROVE + const MART_CHERRYGROVE_DEX + const MART_VIOLET + const MART_AZALEA + const MART_CIANWOOD + const MART_GOLDENROD_2F_1 + const MART_GOLDENROD_2F_2 + const MART_GOLDENROD_3F ++ const MART_GOLDENROD_3F_2 + const MART_GOLDENROD_4F + const MART_GOLDENROD_5F_1 + const MART_GOLDENROD_5F_2 + const MART_GOLDENROD_5F_3 + const MART_GOLDENROD_5F_4 + ... +``` + + +## 2. Give it an inventory + +Edit [data/items/marts.asm](../blob/master/data/items/marts.asm): + +```diff + Marts: ; 160a9 + ; entries correspond to MART_* constants + dw MartCherrygrove + dw MartCherrygroveDex + dw MartViolet + dw MartAzalea + dw MartCianwood + dw MartGoldenrod2F1 + dw MartGoldenrod2F2 + dw MartGoldenrod3F ++ dw MartGoldenrod3F2 + dw MartGoldenrod4F + dw MartGoldenrod5F1 + dw MartGoldenrod5F2 + dw MartGoldenrod5F3 + dw MartGoldenrod5F4 + ... + .End + ; 160ed + + ... + + MartGoldenrod3F: ; 1612b + db 7 ; # items + db X_SPEED + db X_SPECIAL + db X_DEFEND + db X_ATTACK + db DIRE_HIT + db GUARD_SPEC + db X_ACCURACY + db -1 ; end + ; 16134 ++ ++MartGoldenrod3F2: ++ db 6 ++ db FIRE_STONE ++ db THUNDERSTONE ++ db WATER_STONE ++ db LEAF_STONE ++ db MOON_STONE ++ db SUN_STONE ++ db -1 ; end +``` + +A Mart can sell up to 10 items. + + +## 3. Use it in a map script + +The core idea here is to use the `pokemart` script command, passing it a mart type and the new `MART_GOLDENROD_3F_2` inventory constant. + +You'll most likely want to use `MARTTYPE_STANDARD`. The others are as follows: + +- `MARTTYPE_BITTER`: Uses unique phrases for the bitter herb merchant in Goldenrod Underground. +- `MARTTYPE_BARGAIN`: Has a special inventory and behavior, as defined in [engine/items/mart.asm](../blob/master/engine/items/mart.asm), for the bargain merchant in Goldenrod Underground. +- `MARTTYPE_PHARMACY`: Uses unique phrases for the pharmacist in Cianwood City. +- `MARTTYPE_ROOFTOP`: Has a special inventory and behavior, as defined in [engine/items/mart.asm](../blob/master/engine/items/mart.asm), for the rooftop sale merchant in Goldenrod Dept. Store. + +Adding a new mart type is beyond the scope of this tutorial. + +Anyway, edit [maps/GoldenrodDeptStore3F.asm](../blob/master/maps/GoldenrodDeptStore3F.asm): + +```diff + const_def 2 ; object constants + const GOLDENRODDEPTSTORE3F_CLERK ++ const GOLDENRODDEPTSTORE3F_CLERK2 + const GOLDENRODDEPTSTORE3F_SUPER_NERD + const GOLDENRODDEPTSTORE3F_ROCKER + + ... + + GoldenrodDeptStore3FClerkScript: + faceplayer + opentext + pokemart MARTTYPE_STANDARD, MART_GOLDENROD_3F + closetext + end ++ ++GoldenrodDeptStore3FClerk2Script: ++ faceplayer ++ opentext ++ pokemart MARTTYPE_STANDARD, MART_GOLDENROD_3F_2 ++ closetext ++ end + + ... + +- db 3 ; object events ++ db 4 ; object events + object_event 6, 1, SPRITE_CLERK, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, GoldenrodDeptStore3FClerkScript, -1 ++ object_event 7, 1, SPRITE_CLERK, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, GoldenrodDeptStore3FClerk2Script, -1 + object_event 12, 5, SPRITE_SUPER_NERD, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 1, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, GoldenrodDeptStore3FSuperNerdScript, -1 + object_event 2, 5, SPRITE_ROCKER, SPRITEMOVEDATA_WALK_UP_DOWN, 0, 1, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, GoldenrodDeptStore3FRockerScript, -1 +``` + +That's it! + + diff --git a/Tutorials.md b/Tutorials.md index f8a21c8..cb14fcd 100644 --- a/Tutorials.md +++ b/Tutorials.md @@ -20,6 +20,7 @@ Tutorials may use diff syntax to show edits: - [Party menu icon (up to 253)](Add-a-new-party-menu-icon) - [Overworld sprite](Add-a-new-overworld-sprite) - [Sprite movement behavior](Add-a-new-sprite-movement-behavior) +- [Mart](Add-a-new-Mart) - [Music song](Add-a-new-music-song) - [Pack pocket](Add-a-new-Pack-pocket) - [Radio channel](Add-a-new-radio-channel) @@ -40,7 +41,6 @@ Tutorials may use diff syntax to show edits: **To do:** *(feel free to contribute one of these!)* -- Mart - Decoration for your room - Spawn point (for Fly or Teleport) - Wild data @@ -51,6 +51,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) +- Mart type - HM (for Rock Smash) - Fourth fishing rod - 8th wild grass slot diff --git a/screenshots/evo-stone-mart.png b/screenshots/evo-stone-mart.png Binary files differnew file mode 100644 index 0000000..48ba8af --- /dev/null +++ b/screenshots/evo-stone-mart.png |