Skip to content
Rangi edited this page Jun 23, 2018 · 13 revisions

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
  2. Give it an inventory
  3. Use it in a map script

1. Define a mart constant

Edit constants/item_data_constants.asm:

; 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:

 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 ; # items
+	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, 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, 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:

 	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!

Screenshot

Clone this wiki locally