diff options
-rw-r--r-- | Add-a-new-Mart.md | 203 | ||||
-rw-r--r-- | Tutorials.md | 1 | ||||
-rw-r--r-- | screenshots/marttype_shady.png | bin | 0 -> 3006 bytes |
3 files changed, 192 insertions, 12 deletions
diff --git a/Add-a-new-Mart.md b/Add-a-new-Mart.md index cfed43d..768c565 100644 --- a/Add-a-new-Mart.md +++ b/Add-a-new-Mart.md @@ -6,11 +6,12 @@ This tutorial is for how to add a new Poké Mart. As an example, we'll add an ev 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) +4. [Add a new type of Mart](#4-add-a-new-type-of-mart) ## 1. Define a mart constant -Edit [constants/item_data_constants.asm](../blob/master/constants/item_data_constants.asm): +Edit [constants/mart_constants.asm](../blob/master/constants/mart_constants.asm) (or [constants/item_data_constants.asm](../blob/master/constants/item_data_constants.asm) in older versions of pokecrystal): ```diff ; Marts indexes (see data/items/marts.asm) @@ -90,16 +91,7 @@ A Mart can sell up to 10 items. 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): +Edit [maps/GoldenrodDeptStore3F.asm](../blob/master/maps/GoldenrodDeptStore3F.asm): ```diff const_def 2 ; object constants @@ -137,3 +129,192 @@ Anyway, edit [maps/GoldenrodDeptStore3F.asm](../blob/master/maps/GoldenrodDeptSt That's it!  + + +## 4. Add a new type of Mart + +We used `MARTTYPE_STANDARD` before because that's what typical Mart clerks use. But there are other types: + +- `MARTTYPE_BITTER`: Uses unique phrases for the bitter herb merchant in Goldenrod Underground. +- `MARTTYPE_PHARMACY`: Uses unique phrases for the pharmacist in Cianwood City. +- `MARTTYPE_BARGAIN`: Has a special inventory and behavior for the bargain merchant in Goldenrod Underground. (Items are half-price but only sells one of each; see [data/items/bargain_shop.asm](../blob/master/data/items/bargain_shop.asm).) +- `MARTTYPE_ROOFTOP`: Has a special inventory and behavior for the rooftop sale merchant in Goldenrod Dept. Store. (Items are low-price; see [data/items/rooftop_sale.asm](../blob/master/data/items/rooftop_sale.asm).) + +Adding custom behavior like `MARTTYPE_BARGAIN` or `MARTTYPE_ROOFTOP` is beyond the scope of this tutorial, but it isn't hard to add a type that just has different phrases. We'll add a "shady" mart that sells suspicious items. + +Edit [constants/mart_constants.asm](../blob/master/constants/mart_constants.asm): + +```diff + ; mart types (see engine/items/mart.asm) + const_def + const MARTTYPE_STANDARD + const MARTTYPE_BITTER + const MARTTYPE_BARGAIN + const MARTTYPE_PHARMACY + const MARTTYPE_ROOFTOP ++ const MARTTYPE_SHADY +``` + +Edit [engine/items/mart.asm](../blob/master/engine/items/mart.asm): + +```diff + OpenMartDialog:: ; 15a45 + ... + + .dialogs + dw MartDialog + dw HerbShop + dw BargainShop + dw Pharmacist + dw RooftopSale ++ dw ShadyShop + ; 15a61 + + ... + + Pharmacist: ; 15aae + call FarReadMart + call LoadStandardMenuHeader + ld hl, Text_Pharmacist_Intro + call MartTextBox + call BuyMenu + ld hl, Text_Pharmacist_ComeAgain + call MartTextBox + ret + ; 15ac4 ++ ++ShadyShop: ++ call FarReadMart ++ call LoadStandardMenuHeader ++ ld hl, Text_ShadyShop_Intro ++ call MartTextBox ++ call BuyMenu ++ ld hl, Text_ShadyShop_ComeAgain ++ call MartTextBox ++ ret + + ... + + GetMartDialogGroup: ; 15ca3 + ... + + .MartTextFunctionPointers: ; 15cb0 + dwb .StandardMartPointers, 0 + dwb .HerbShopPointers, 0 + dwb .BargainShopPointers, 1 + dwb .PharmacyPointers, 0 + dwb .StandardMartPointers, 2 ++ dwb .ShadyPointers, 0 + ; 15cbf + + ... + + .PharmacyPointers: ; 15ce3 + dw Text_Pharmacy_HowMany + dw Text_Pharmacy_CostsThisMuch + dw Text_Pharmacy_InsufficientFunds + dw Text_Pharmacy_BagFull + dw Text_Pharmacy_HereYouGo + dw BuyMenuLoop ++ ++.ShadyPointers: ++ dw Text_ShadyShop_HowMany ++ dw Text_ShadyShop_CostsThisMuch ++ dw Text_ShadyShop_InsufficientFunds ++ dw Text_ShadyShop_BagFull ++ dw Text_ShadyShop_HereYouGo ++ dw BuyMenuLoop + ; 15cef + + ... ++ ++Text_ShadyShop_Intro: ++ text_jump ShadyShop_IntroText ++ db "@" ++ ++Text_ShadyShop_ComeAgain: ++ text_jump ShadyShop_ComeAgainText ++ db "@" ++ ++Text_ShadyShop_HowMany: ++ text_jump ShadyShop_HowManyText ++ db "@" ++ ++Text_ShadyShop_CostsThisMuch: ++ text_jump ShadyShop_CostsThisMuchText ++ db "@" ++ ++Text_ShadyShop_InsufficientFunds: ++ text_jump ShadyShop_InsufficientFundsText ++ db "@" ++ ++Text_ShadyShop_BagFull: ++ text_jump ShadyShop_BagFullText ++ db "@" ++ ++Text_ShadyShop_HereYouGo: ++ text_jump ShadyShop_HereYouGoText ++ db "@" +``` + +And edit [data/text/common_3.asm](../blob/master/data/text/common_3.asm): + +```diff +ShadyShop_IntroText:: + text "Hello, kiddo!" + + para "Wanna buy any of" + line "my goods?" + + para "They fell off the" + line "back of a truck!" + cont "Hehehe…" + done + +ShadyShop_ComeAgainText:: + text "See ya, kid!" + done + +ShadyShop_HowManyText:: + text "How many you" + line "need?" + done + +ShadyShop_CostsThisMuchText:: + text "That'll cost ya" + line "¥@" + deciram hMoneyTemp, 3, 6 + text ". 'Kay?" + done + +ShadyShop_InsufficientFundsText:: + text "That ain't enough!" + done + +ShadyShop_BagFullText:: + text "Hehe, you can't" + line "carry it!" + done + +ShadyShop_HereYouGoText:: + text "Cha-ching!" + done +``` + +This new Mart type is appropriate for the Team Rocket merchant in Mahogany Town. So edit [maps/MahoganyMart1F.asm](../blob/master/maps/MahoganyMart1F.asm): + +```diff + MahogayMart1FPharmacistScript: + faceplayer + opentext + checkevent EVENT_DECIDED_TO_HELP_LANCE + iftrue .LanceEntered +- pokemart MARTTYPE_STANDARD, MART_MAHOGANY_1 ++ pokemart MARTTYPE_SHADY, MART_MAHOGANY_1 + closetext + end +``` + +And it works! + + diff --git a/Tutorials.md b/Tutorials.md index 5837dde..74310ea 100644 --- a/Tutorials.md +++ b/Tutorials.md @@ -51,7 +51,6 @@ 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/marttype_shady.png b/screenshots/marttype_shady.png Binary files differnew file mode 100644 index 0000000..371fb8d --- /dev/null +++ b/screenshots/marttype_shady.png |