1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
|
Pokémon Crystal was the first time in the series' history that the player was introduced to move tutors. They teach the player's Pokémon some interesting moves, usually for a price.
In this tutorial we will be expanding the existing move tutor code in pokecrystal, and create a new move tutor script to be used in a map. For this example, we will be creating a move tutor for Softboiled.
## Contents
1. [Edit existing move tutor code](#1-edit-existing-move-tutor-code)
2. [Edit Goldenrod Move Tutor to support the new changes](#2-edit-goldenrod-move-tutor-to-support-the-new-changes)
3. [Create a new tutor move](#3-create-a-new-tutor-move)
4. [Create a new Move Tutor script](#4-create-a-new-move-tutor-script)
5. [Create a new Move Tutor similar to Goldenrod Move Tutor](#5-create-a-new-move-tutor-similar-to-goldenrod-move-tutor)
6. [Other examples](#6-other-examples)
## 1. Edit existing move tutor code
The existing move tutor code is programmed in a way that it can only check for three variables (the three moves able to be tutored). Let's fix that. Head to `.GetMoveTutorMove` in [engine/events/move_tutor.asm](../blob/master/engine/events/move_tutor.asm):
```diff
.GetMoveTutorMove:
ld a, [wScriptVar]
cp MOVETUTOR_FLAMETHROWER
jr z, .flamethrower
cp MOVETUTOR_THUNDERBOLT
jr z, .thunderbolt
; MOVETUTOR_ICE_BEAM
ld a, ICE_BEAM
ret
.flamethrower
ld a, FLAMETHROWER
ret
.thunderbolt
ld a, THUNDERBOLT
ret
```
The routine loads the currently selected `MOVETUTOR_MOVE` into `a`. If you didn't select `MOVETUTOR_FLAMETHROWER`, then the game checks if you selected `MOVETUTOR_THUNDERBOLT`, and loads `THUNDERBOLT` into `a` if you did. If you selected neither, then the game loads `ICE_BEAM` into `a` instead.
What if we wanted to add more moves? It's not optimal to keep tacking on additional checks the more tutor moves you have.
```diff
.GetMoveTutorMove:
ld a, [wScriptVar]
- cp MOVETUTOR_FLAMETHROWER
- jr z, .flamethrower
- cp MOVETUTOR_THUNDERBOLT
- jr z, .thunderbolt
- ; MOVETUTOR_ICE_BEAM
- ld a, ICE_BEAM
- ret
-
-.flamethrower
- ld a, FLAMETHROWER
- ret
-
-.thunderbolt
- ld a, THUNDERBOLT
ret
```
Remove the checks entirely, and let the move tutor script in a map load `a` with the selected tutor move instead! This means you can add a few more tutor moves, and the game should handle it perfectly, if you create the right move tutor script. But first, we need to apply this new engine change to the existing move tutor in Goldenrod.
## 2. Edit Goldenrod Move Tutor to support the new changes
Now that `.GetMoveTutorMove` is edited to load whatever move the map script wants into `a`, we need to change the Goldenrod Move Tutor to support this change.
Open [maps/GoldenrodCity.asm](../blob/master/maps/GoldenrodCity.asm) and locate `MoveTutorScript`:
```diff
MoveTutorScript:
faceplayer
opentext
writetext GoldenrodCityMoveTutorAskTeachAMoveText
yesorno
iffalse .Refused
special DisplayCoinCaseBalance
writetext GoldenrodCityMoveTutorAsk4000CoinsOkayText
yesorno
iffalse .Refused2
checkcoins 4000
ifequal HAVE_LESS, .NotEnoughMoney
writetext GoldenrodCityMoveTutorWhichMoveShouldITeachText
loadmenu .MoveMenuHeader
verticalmenu
closewindow
ifequal MOVETUTOR_FLAMETHROWER, .Flamethrower
ifequal MOVETUTOR_THUNDERBOLT, .Thunderbolt
ifequal MOVETUTOR_ICE_BEAM, .IceBeam
sjump .Incompatible
.Flamethrower:
setval MOVETUTOR_FLAMETHROWER
writetext GoldenrodCityMoveTutorMoveText
special MoveTutor
ifequal FALSE, .TeachMove
sjump .Incompatible
.Thunderbolt:
setval MOVETUTOR_THUNDERBOLT
writetext GoldenrodCityMoveTutorMoveText
special MoveTutor
ifequal FALSE, .TeachMove
sjump .Incompatible
.IceBeam:
setval MOVETUTOR_ICE_BEAM
writetext GoldenrodCityMoveTutorMoveText
special MoveTutor
ifequal FALSE, .TeachMove
sjump .Incompatible
...
```
In this case, now that we've edited `.GetMoveTutorMove` to not contain `MOVETUTOR_MOVE` checks, this existing script will not function correctly. We need to edit each existing `setval` command to set the named value of each move from [data/moves/tmhm_moves.asm](../blob/master/data/moves/tmhm_moves.asm).
```diff
.Flamethrower:
- setval MOVETUTOR_FLAMETHROWER
+ setval FLAMETHROWER
writetext GoldenrodCityMoveTutorMoveText
special MoveTutor
ifequal FALSE, .TeachMove
sjump .Incompatible
.Thunderbolt:
- setval MOVETUTOR_THUNDERBOLT
+ setval THUNDERBOLT
writetext GoldenrodCityMoveTutorMoveText
special MoveTutor
ifequal FALSE, .TeachMove
sjump .Incompatible
.IceBeam:
- setval MOVETUTOR_ICE_BEAM
+ setval ICE_BEAM
writetext GoldenrodCityMoveTutorMoveText
special MoveTutor
ifequal FALSE, .TeachMove
sjump .Incompatible
```
The routine functions almost the same as before, but now the code that lets him teach moves can be expanded to teach others, as well.
## 3. Create a new tutor move
There are three parts to creating a new tutor move. Defining the constant, defining the move, and lastly, adding the move to a Pokémon's existing learnset.
Let's define the constant first. Open [constants/item_constants.asm](../blob/master/constants/item_constants.asm)
Even though tutor moves aren't items and therefore do not have item constants, they're technically still similar to TMs and HMs, in order to work with Pokémon movesets. So they must be defined as such below.
```diff
add_hm: MACRO
if !DEF(HM01)
HM01 EQU const_value
endc
define _\@_1, "HM_\1"
const _\@_1
enum \1_TMNUM
ENDM
add_hm CUT ; f3
add_hm FLY ; f4
add_hm SURF ; f5
add_hm STRENGTH ; f6
add_hm FLASH ; f7
add_hm WHIRLPOOL ; f8
add_hm WATERFALL ; f9
NUM_HMS EQU const_value - HM01
add_mt: MACRO
enum \1_TMNUM
ENDM
add_mt FLAMETHROWER
add_mt THUNDERBOLT
add_mt ICE_BEAM
NUM_TM_HM_TUTOR EQU __enum__ + -1
```
As you can see, tutor moves are defined below HMs, with the `add_mt` macro. They function like TMs and HMs, just without an item corresponding to their use. Let's add our first new tutor move constant, Softboiled.
```diff
+; Move tutor moves don't have item constants, but do need
+; to be added after TMs and HMs for learnset compatibility!
add_mt FLAMETHROWER
add_mt THUNDERBOLT
add_mt ICE_BEAM
+ add_mt SOFTBOILED
NUM_TM_HM_TUTOR EQU __enum__ + -1
```
Now that the constant is defined, we still need to define what move is actually taught. Head on over to [constants/item_constants.asm](../blob/master/constants/item_constants.asm):
```diff
add_hm CUT ; f3
add_hm FLY ; f4
add_hm SURF ; f5
add_hm STRENGTH ; f6
add_hm FLASH ; f7
add_hm WHIRLPOOL ; f8
add_hm WATERFALL ; f9
NUM_HMS EQU __tmhm_value__ - NUM_TMS - 1
...
add_mt FLAMETHROWER
add_mt THUNDERBOLT
add_mt ICE_BEAM
NUM_TUTORS = __tmhm_value__ - NUM_TMS - NUM_HMS - 1
```
Just like before, tutor moves come after HMs. Be sure to adhere to the order, and the order of new tutor moves you add.
```diff
add_mt FLAMETHROWER
add_mt THUNDERBOLT
add_mt ICE_BEAM
+ add_mt SOFTBOILED
NUM_TUTORS = __tmhm_value__ - NUM_TMS - NUM_HMS - 1
```
Now that the new tutor move is defined, and has been added as a tutor move, we need to add the tutor move to a Pokémon's learnset. For this example, we'll specifically be using Chansey. Chansey's signature move is Softboiled, and is already learned on level up(evos_attacks.asm). But even if a Pokemon can naturally learn this tutor move, the tutor still can't teach it without the tutor move being added to the end of the Chansey's learnset! Just like before, tutor moves come after HMs.
Open up Chansey's base stats at [data/pokemon/base_stats/chansey.asm](../blob/master/data/pokemon/base_stats/chansey.asm)
```diff
db CHANSEY ; 113
db 250, 05, 05, 50, 35, 105
; hp atk def spd sat sdf
db NORMAL, NORMAL ; type
db 30 ; catch rate
db 255 ; base exp
db NO_ITEM, LUCKY_EGG ; items
db GENDER_F100 ; gender ratio
db 100 ; unknown 1
db 40 ; step cycles to hatch
db 5 ; unknown 2
INCBIN "gfx/pokemon/chansey/front.dimensions"
dw NULL, NULL ; unused (beta front/back pics)
db GROWTH_FAST ; growth rate
dn EGG_FAIRY, EGG_FAIRY ; egg groups
; tm/hm learnset
tmhm DYNAMICPUNCH, HEADBUTT, CURSE, ROLLOUT, TOXIC, ZAP_CANNON, ROCK_SMASH, PSYCH_UP, HIDDEN_POWER, SUNNY_DAY, SNORE, BLIZZARD, HYPER_BEAM, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, SOLARBEAM, IRON_TAIL, THUNDER, RETURN, PSYCHIC_M, SHADOW_BALL, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, SANDSTORM, FIRE_BLAST, DEFENSE_CURL, DREAM_EATER, REST, ATTRACT, STRENGTH, FLASH, FLAMETHROWER, THUNDERBOLT, ICE_BEAM
; end
```
What we want to edit is the tm/hm learnset at the bottom. The TMs and HMs all follow the numeric order of each TM move from `tmhm_moves` and `item_constants`. Move tutor moves go at the end, and as you can see, Chansey already has the Goldenrod tutor moves at the end of her list, after HMs. Simply add `SOFTBOILED` to the end of the list, like so:
```diff
; tm/hm learnset
- tmhm DYNAMICPUNCH, HEADBUTT, CURSE, ROLLOUT, TOXIC, ZAP_CANNON, ROCK_SMASH, PSYCH_UP, HIDDEN_POWER, SUNNY_DAY, SNORE, BLIZZARD, HYPER_BEAM, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, SOLARBEAM, IRON_TAIL, THUNDER, RETURN, PSYCHIC_M, SHADOW_BALL, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, SANDSTORM, FIRE_BLAST, DEFENSE_CURL, DREAM_EATER, REST, ATTRACT, STRENGTH, FLASH, FLAMETHROWER, THUNDERBOLT, ICE_BEAM
+tmhm DYNAMICPUNCH, HEADBUTT, CURSE, ROLLOUT, TOXIC, ZAP_CANNON, ROCK_SMASH, PSYCH_UP, HIDDEN_POWER, SUNNY_DAY, SNORE, BLIZZARD, HYPER_BEAM, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, SOLARBEAM, IRON_TAIL, THUNDER, RETURN, PSYCHIC_M, SHADOW_BALL, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, SANDSTORM, FIRE_BLAST, DEFENSE_CURL, DREAM_EATER, REST, ATTRACT, STRENGTH, FLASH, FLAMETHROWER, THUNDERBOLT, ICE_BEAM, SOFTBOILED
```
With that, our new tutor move has been created, and a Pokemon can learn it. All that's left to do is to create a new tutor to actually teach the move to our Chansey.
## 4. Create a new Move Tutor script
For this example, we'll be editing an NPC in Celadon City to turn them into a Softboiled move tutor, much like the one in Gen 3's Fire Red/Leaf Green.
Open [maps/CeladonCity.asm](../blob/master/maps/CeladonCity.asm):
```diff
CeladonCityGramps1Script:
jumptextfaceplayer CeladonCityGramps1Text
...
CeladonCityGramps1Text:
text "GRIMER have been"
line "appearing lately."
para "See that pond out"
line "in front of the"
para "house? GRIMER live"
line "there now."
para "Where did they"
line "come from? This is"
cont "a serious problem…"
done
...
def_object_events
object_event 26, 11, SPRITE_FISHER, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, CeladonCityFisherScript, -1
object_event 27, 11, SPRITE_POLIWAG, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, CeladonCityPoliwrath, -1
object_event 20, 24, SPRITE_TEACHER, SPRITEMOVEDATA_WALK_LEFT_RIGHT, 2, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, CeladonCityTeacher1Script, -1
object_event 14, 16, SPRITE_GRAMPS, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 0, CeladonCityGramps1Script, -1
object_event 8, 31, SPRITE_GRAMPS, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, CeladonCityGramps2Script, -1
object_event 18, 13, SPRITE_YOUNGSTER, SPRITEMOVEDATA_WALK_LEFT_RIGHT, 2, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, CeladonCityYoungster1Script, -1
object_event 24, 33, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, CeladonCityYoungster2Script, -1
object_event 6, 14, SPRITE_TEACHER, SPRITEMOVEDATA_WANDER, 2, 2, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, CeladonCityTeacher2Script, -1
object_event 7, 22, SPRITE_LASS, SPRITEMOVEDATA_WALK_UP_DOWN, 0, 2, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, CeladonCityLassScript, -1
```
We'll be borrowing the old man at the house behind the small body of water in Celadon, `CeladonCityGramps1`.
You can either delete the `CeladonCityGramps1Script` and `CeladonCityGramps1Text` itself, or comment it out as we won't be needing them. The bottom part of this script block handles all the `object_event`s, the sprites that usually make up NPCs or important items. Now let's turn him into a tutor!
```diff
-CeladonCityGramps1Script:
- jumptextfaceplayer CeladonCityGramps1Text
+CeladonCityTutorSoftboiledScript:
+ faceplayer
+ opentext
+ writetext CeladonCityTutorSoftboiledText
+ waitbutton
+ writetext CeladonCityTutorSoftboiledText2
+ yesorno
+ iffalse .TutorRefused
+ writebyte SOFTBOILED
+ writetext CeladonCityTutorSoftboiledClear
+ special MoveTutor
+ if_equal $0, .TeachMove
+.TutorRefused
+ writetext CeladonCityTutorSoftboiledRefused
+ waitbutton
+ closetext
+ end
+
+.TeachMove
+ writetext CeladonCityTutorSoftboiledTaught
+ waitbutton
+ closetext
+ end
...
-CeladonCityGramps1Text:
- text "GRIMER have been"
- line "appearing lately."
-
- para "See that pond out"
- line "in front of the"
-
- para "house? GRIMER live"
- line "there now."
-
- para "Where did they"
- line "come from? This is"
- cont "a serious problem…"
- done
+CeladonCityTutorSoftboiledText:
+ text "Hello there!"
+ line "I've seen you"
+ cont "running around."
+ para "It must be good"
+ line "luck that brought"
+ cont "us together."
+ done
+
+CeladonCityTutorSoftboiledText2:
+ text "Would you like me"
+ line "to teach your"
+ para "#MON to use"
+ line "SOFTBOILED"
+
+CeladonCityTutorSoftboiledClear:
+ text ""
+ done
+
+CeladonCityTutorSoftboiledRefused:
+ text "OK then."
+ done
+
+CeladonCityTutorSoftboiledTaught:
+ text "Now if your"
+ line "#MON is in a"
+ para "pinch, they can"
+ line "eat an egg"
+ cont "and restore HP."
+ para "Or if they are"
+ line "feeling a bit"
+ cont "hungry, hohoho!"
+ done
...
def_object_events
object_event 26, 11, SPRITE_FISHER, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, CeladonCityFisherScript, -1
object_event 27, 11, SPRITE_POLIWAG, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, CeladonCityPoliwrath, -1
object_event 20, 24, SPRITE_TEACHER, SPRITEMOVEDATA_WALK_LEFT_RIGHT, 2, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, CeladonCityTeacher1Script, -1
- object_event 14, 16, SPRITE_GRAMPS, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 0, CeladonCityTutorGramps1Script, -1
+ object_event 14, 16, SPRITE_GRAMPS, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 0, CeladonCityTutorSoftboiledScript, -1
```
A brand new move tutor! You can expand on the existing functionality, such as asking for an item or currency as payment!

## 5. Create a new Move Tutor similar to Goldenrod Move Tutor
We can copy the Goldenrod Move Tutor script to create a new move tutor in New Bark Town, for example. But first, we need to modify [maps/GoldenrodCity.asm](../blob/master/maps/GoldenrodCity.asm)
```diff
MoveTutorScript:
faceplayer
opentext
writetext GoldenrodCityMoveTutorAskTeachAMoveText
yesorno
iffalse .Refused
special DisplayCoinCaseBalance
writetext GoldenrodCityMoveTutorAsk4000CoinsOkayText
yesorno
iffalse .Refused2
checkcoins 4000
ifequal HAVE_LESS, .NotEnoughMoney
writetext GoldenrodCityMoveTutorWhichMoveShouldITeachText
loadmenu .MoveMenuHeader
verticalmenu
closewindow
- ifequal MOVETUTOR_FLAMETHROWER, .Flamethrower
- ifequal MOVETUTOR_THUNDERBOLT, .Thunderbolt
- ifequal MOVETUTOR_ICE_BEAM, .IceBeam
+ ifequal 1, .Flamethrower
+ ifequal 2, .Thunderbolt
+ ifequal 3, .IceBeam
sjump .Incompatible
```
That way, instead of requesting for that constant, it instead requests the corresponding entry on the list menu.
For example, if we want to create a Move Tutor in New Bark Town that can teach your starter the following moves: Mega Drain, Fire Spin, Bubble, and Absorb. First, we need to edit [constants/item_constants.asm](../blob/master/constants/item_constants.asm):
```diff
add_mt FLAMETHROWER
add_mt THUNDERBOLT
add_mt ICE_BEAM
+ add_mt MEGA_DRAIN
+ add_mt FIRE_SPIN
+ add_mt BUBBLE
+ add_mt ABSORB
NUM_TUTORS = __tmhm_value__ - NUM_TMS - NUM_HMS - 1
```
Next, copy the script in Goldenrod City [maps/GoldenrodCity.asm](../blob/master/maps/GoldenrodCity.asm) and copy it to [maps/NewBarkTown.asm](../blob/master/maps/NewBarkTown.asm) while changing the MoveTutorScript to StarterTutorScript and changing the moves to fit the ones we want the tutor to teach.
```diff
.FlyPoint:
setflag ENGINE_FLYPOINT_NEW_BARK
clearevent EVENT_FIRST_TIME_BANKING_WITH_MOM
endcallback
+StarterTutorScript:
+ faceplayer
+ opentext
+ writetext AskTeachAMoveText
+ yesorno
+ iffalse .Refused
+ writetext NewBarkTownStarterTutorWhichMoveShouldITeachText
+ loadmenu .MoveMenuHeader
+ verticalmenu
+ closewindow
+ ifequal 1, .MegaDrain
+ ifequal 2, .FireSpin
+ ifequal 3, .Bubble
+ ifequal 4, .Absorb
+ sjump .Incompatible
+
+.MegaDrain:
+ setval MEGA_DRAIN
+ writetext NewBarkTownStarterTutorMoveText
+ special MoveTutor
+ ifequal FALSE, .TeachMove
+ sjump .Incompatible
+
+.FireSpin:
+ setval FIRE_SPIN
+ writetext NewBarkTownStarterTutorMoveText
+ special MoveTutor
+ ifequal FALSE, .TeachMove
+ sjump .Incompatible
+
+.Bubble:
+ setval BUBBLE
+ writetext NewBarkTownStarterTutorMoveText
+ special MoveTutor
+ ifequal FALSE, .TeachMove
+ sjump .Incompatible
+
+.Absorb:
+ setval ABSORB
+ writetext NewBarkTownStarterTutorMoveText
+ special MoveTutor
+ ifequal FALSE, .TeachMove
+ sjump .Incompatible
+
+.Refused:
+ writetext NewBarkTownStarterTutorAwwButTheyreAmazingText
+ waitbutton
+ closetext
+ end
+
+.Incompatible:
+ writetext NewBarkTownStarterTutorBButText
+ waitbutton
+ closetext
+ end
+
+.TeachMove:
+ writetext NewBarkTownStarterTutorIfYouUnderstandYouveMadeItText
+ promptbutton
+ writetext NewBarkTownStarterTutorFarewellKidText
+ waitbutton
+ closetext
```
We need to change `TEXTBOX_Y` in `.MoveMenuHeader` to accommodate 4 moves (and the CANCEL option on-screen). Also, we need to change the menu data to reflect the moves we want the tutor to teach.
```diff
.TeachMove:
writetext NewBarkTownStarterTutorIfYouUnderstandYouveMadeItText
promptbutton
writetext NewBarkTownStarterTutorFarewellKidText
waitbutton
closetext
+.MoveMenuHeader:
+ db MENU_BACKUP_TILES ; flags
+ menu_coords 0, 2, 15, TEXTBOX_Y - 0
+ dw .MenuData
+ db 1 ; default option
+
+.MenuData:
+ db STATICMENU_CURSOR ; flags
+ db 5 ; items
+ db "MEGA DRAIN@"
+ db "FIRE SPIN@"
+ db "BUBBLE@"
+ db "ABSORB@"
+ db "CANCEL@"
```
Finally, we add in the Tutor's quotes and add the Tutor NPC to the area.
```diff
NewBarkTownElmsHouseSignText:
text "ELM'S HOUSE"
done
+AskTeachAMoveText:
+ text "I can teach your"
+ line "starter amazing"
+
+ para "moves if you'd"
+ line "like."
+
+ para "Should I teach a"
+ line "new move?"
+ done
+
+
+NewBarkTownStarterTutorAwwButTheyreAmazingText:
+ text "Come back here"
+ line "if you want to"
+
+ para "teach your"
+ line "starter a new"
+ cont "move!"
+ done
+
+NewBarkTownStarterTutorWhichMoveShouldITeachText:
+ text "Great! You won't"
+ line "regret it!"
+
+ para "Which move should"
+ line "I teach?"
+ done
+
+
+NewBarkTownStarterTutorIfYouUnderstandYouveMadeItText:
+ text "If you understand"
+ line "what's so amazing"
+
+ para "about this move,"
+ line "you've made it as"
+ cont "a trainer."
+ done
+
+NewBarkTownStarterTutorFarewellKidText:
+ text "Farewell and"
+ line "good luck on"
+ cont "your journey!"
+ done
+
+NewBarkTownStarterTutorBButText:
+ text "Your starter"
+ line "can't learn this"
+ cont "move…"
+ done
+
+NewBarkTownStarterTutorMoveText:
+ text_start
+ done
...
def_object_events
object_event 6, 8, SPRITE_TEACHER, SPRITEMOVEDATA_SPINRANDOM_SLOW, 1, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, NewBarkTownTeacherScript, -1
object_event 12, 9, SPRITE_FISHER, SPRITEMOVEDATA_WALK_UP_DOWN, 0, 1, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, NewBarkTownFisherScript, -1
object_event 3, 2, SPRITE_SILVER, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, NewBarkTownSilverScript, EVENT_RIVAL_NEW_BARK_TOWN
+ object_event 14, 14, SPRITE_TEACHER, SPRITEMOVEDATA_WALK_LEFT_RIGHT, 1, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, StarterTutorScript, -1
```
Finally, we need to update the learnset for the starters by editing the files [data/pokemon/base_stats/cyndaquil.asm](../blob/master/data/pokemon/base_stats/cyndaquil.asm), [data/pokemon/base_stats/chikorita.asm](../blob/master/data/pokemon/base_stats/chikorita.asm), and [data/pokemon/base_stats/totodile.asm](../blob/master/data/pokemon/base_stats/totodile.asm) for these Pokémon to learn the moves.
```diff
dn EGG_GROUND, EGG_GROUND ; egg groups
; tmhm
- tmhm HEADBUTT, CURSE, ROLLOUT, TOXIC, HIDDEN_POWER, SUNNY_DAY, SNORE, PROTECT, ENDURE, FRUSTRATION, IRON_TAIL, RETURN, DIG, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, FIRE_BLAST, SWIFT, DEFENSE_CURL, DETECT, REST, ATTRACT, CUT, FLAMETHROWER
+ tmhm HEADBUTT, CURSE, ROLLOUT, TOXIC, HIDDEN_POWER, SUNNY_DAY, SNORE, PROTECT, ENDURE, FRUSTRATION, IRON_TAIL, RETURN, DIG, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, FIRE_BLAST, SWIFT, DEFENSE_CURL, DETECT, REST, ATTRACT, CUT, FLAMETHROWER, FIRE_SPIN
; end
```
```diff
dn EGG_MONSTER, EGG_PLANT ; egg groups
; tm/hm
- tmhm HEADBUTT, CURSE, TOXIC, HIDDEN_POWER, SUNNY_DAY, SWEET_SCENT, SNORE, PROTECT, GIGA_DRAIN, ENDURE, FRUSTRATION, SOLARBEAM, IRON_TAIL, RETURN, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, DETECT, REST, ATTRACT, CUT, FLASH
+ tmhm HEADBUTT, CURSE, TOXIC, HIDDEN_POWER, SUNNY_DAY, SWEET_SCENT, SNORE, PROTECT, GIGA_DRAIN, ENDURE, FRUSTRATION, SOLARBEAM, IRON_TAIL, RETURN, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, DETECT, REST, ATTRACT, CUT, FLASH, MEGA_DRAIN, ABSORB
; end
```
```diff
dn EGG_MONSTER, EGG_WATER_1 ; egg groups
; tm/hm
- tmhm DYNAMICPUNCH, HEADBUTT, CURSE, TOXIC, HIDDEN_POWER, SNORE, BLIZZARD, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, IRON_TAIL, RETURN, DIG, MUD_SLAP, DOUBLE_TEAM, ICE_PUNCH, SWAGGER, SLEEP_TALK, DETECT, REST, ATTRACT, CUT, SURF, WHIRLPOOL, ICE_BEAM
+ tmhm DYNAMICPUNCH, HEADBUTT, CURSE, TOXIC, HIDDEN_POWER, SNORE, BLIZZARD, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, IRON_TAIL, RETURN, DIG, MUD_SLAP, DOUBLE_TEAM, ICE_PUNCH, SWAGGER, SLEEP_TALK, DETECT, REST, ATTRACT, CUT, SURF, WHIRLPOOL, ICE_BEAM, BUBBLE
; end
```
And now you got it! The tutor has successfully been created!
## 6. Other examples
Now that new tutors can be added to the game, what else could you do? Like the tutors from Gen 3 onwards, you can charge a price, or demand a specific item. Adding a `checkitem` command is very simple, but effective! For this example, we will be using a `POKE_DOLL` to the Celadon City move tutor.
```diff
CeladonCityTutorSoftboiledScript:
faceplayer
opentext
writetext CeladonCityTutorSoftboiledText
waitbutton
+ checkitem POKE_DOLL
+ iffalse .NoPokeDoll
writetext CeladonCityTutorSoftboiledText2
yesorno
iffalse .TutorRefused
writebyte SOFTBOILED
writetext CeladonCityTutorSoftboiledClear
special MoveTutor
if_equal $0, .TeachMove
.TutorRefused:
writetext CeladonCityTutorSoftboiledRefused
waitbutton
closetext
end
+.NoPokeDoll:
+ writetext CeladonCityTutorNoDoll
+ waitbutton
+ closetext
+ end
.TeachMove
writetext CeladonCityTutorPayment
takeitem POKE_DOLL
waitbutton
writetext CeladonCityTutorSoftboiledTaught
waitbutton
closetext
end
...
+CeladonCityTutorPayment:
+ text "<PLAYER> gave the"
+ line "man a #DOLL."
+ done
CeladonCityTutorSoftboiledTaught:
text "Now if your"
line "#MON is in a"
para "pinch, they can"
line "eat an egg"
cont "and restore HP."
para "Or if they are"
line "feeling a bit"
cont "hungry, hohoho!"
done
+
+CeladonCityTutorNoDoll:
+ text "Ah, you don't"
+ line "have a #DOLL."
+
+ para "You can get one"
+ line "from the DEPT."
+
+ para "STORE in CEL-"
+ line "ADON CITY."
+ done
```
If the player has no `POKE_DOLL` in their Pack, the script will jump to `CeladonCityTutorNoDoll`, and will end dialogue with the tutor. If the player has one, the script will enter the Move Tutor dialogue. If the move is successfully taught, one will be taken in exchange to tutor a move. If the player quits out of the menu due to having no compatible Pokémon or changing their mind, they will get the "Refused" dialogue.
To charge a price, replace the `checkitem` command with a `checkmoney`, and after `yesorno`, add a `takemoney` command to the `TeachMove` script. Keep in mind you'll have to change the dialogue in `CeladonCityTutorNoDoll` also!
```diff
CeladonCityTutorSoftboiledScript:
faceplayer
opentext
writetext CeladonCityTutorSoftboiledText
waitbutton
- checkitem POKE_DOLL
+ checkmoney YOUR_MONEY, 1000
- iffalse .NoPokeDoll
+ ifequal HAVE_LESS, .NoPokeDoll
writetext CeladonCityTutorSoftboiledText2
yesorno
iffalse .TutorRefused
writebyte SOFTBOILED
writetext CeladonCityTutorSoftboiledClear
special MoveTutor
if_equal $0, .TeachMove
.NoPokeDoll:
writetext CeladonCityTutorNoDoll
waitbutton
closetext
end
.TeachMove
writetext CeladonCityTutorPayment
- takeitem POKE_DOLL
+ takemoney YOUR_MONEY, 1000
waitbutton
writetext CeladonCityTutorSoftboiledTaught
waitbutton
closetext
end
```
For other ideas, look at the Goldenrod move tutor script. Perhaps you want move tutors that appear on different days of the week? Or teach different moves based on what day it is? All of this is possible, and left up to you intrepid assembly hackers to challenge yourself with.
|