summaryrefslogtreecommitdiff
path: root/data/maps/PalletTown/scripts.inc
blob: e482f1fb4d3826084395af5818de3c069d9ba167 (plain)
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
PalletTown_MapScripts:: @ 816545A
    map_script 3, PalletTown_MapScript1_165465
    map_script 2, PalletTown_MapScript2_1654CE
    .byte 0

PalletTown_MapScript1_165465:: @ 8165465
    setworldmapflag 2192
    checkflag FLAG_0x291
    call_if 1, EventScript_165488
    compare_var_to_value VAR_0x4070, 0
    call_if 1, EventScript_1654A8
    compare_var_to_value VAR_0x4070, 1
    call_if 1, EventScript_1654A2
    end

EventScript_165488:: @ 8165488
    checkflag 2110
    goto_if 0, EventScript_1A77A9
    compare_var_to_value VAR_0x4070, 1
    goto_if 4, EventScript_1A77A9
    setvar VAR_0x4070, 1
    return

EventScript_1654A2:: @ 81654A2
    setvar VAR_0x4070, 2
    return

EventScript_1654A8:: @ 81654A8
    checkflag FLAG_0x291
    goto_if 1, EventScript_1654BD
    setobjectxyperm 1, 5, 15
    setobjectmovementtype 1, 7
    return

EventScript_1654BD:: @ 81654BD
    setobjectxyperm 1, 12, 2
    setobjectmovementtype 1, 8
    setvar VAR_0x4002, 1
    return

PalletTown_MapScript2_1654CE:: @ 81654CE
    map_script_2 VAR_0x4050, 2, EventScript_1654D8
    .2byte 0

EventScript_1654D8:: @ 81654D8
    lockall
    textcolor 0
    setobjectxyperm 3, 14, 14
    setobjectmovementtype 3, 9
    addobject 3
    applymovement 3, Movement_1655AF
    waitmovement 0
    checkflag FLAG_SYS_RIBBON_GET
    goto_if 0, EventScript_1655A1
    loadword 0, gUnknown_817D8BF
    callstd 4
    setvar VAR_0x8004, 0
    specialvar VAR_RESULT, sub_80CA3D8
    copyvar VAR_0x8008, VAR_0x8005
    copyvar VAR_0x8009, VAR_0x8006
    getnumberstring 0, VAR_0x8008
    getnumberstring 1, VAR_0x8009
    compare_var_to_value VAR_0x8009, 60
    goto_if 0, EventScript_165593
    loadword 0, gUnknown_817D9AA
    callstd 4
    closemessage
    playbgm BGM_FRLG_FOLLOW_ME, 0
    applymovement 255, Movement_1655DD
    applymovement 3, Movement_1655CC
    waitmovement 0
    opendoor 16, 13
    waitdooranim
    applymovement 3, Movement_16572E
    applymovement 255, Movement_165758
    waitmovement 0
    closedoor 16, 13
    waitdooranim
    setvar VAR_0x4055, 7
    setvar VAR_0x4050, 3
    setflag FLAG_0x02C
    warp MAP_PALLETTOWN_PROFESSOROAKSLAB, 255, 6, 12
    waitstate
    releaseall
    end

EventScript_16557E:: @ 816557E
    closemessage
    applymovement 3, Movement_1655BE
    waitmovement 0
    removeobject 3
    setvar VAR_0x4050, 3
    releaseall
    end

EventScript_165593:: @ 8165593
    loadword 0, gUnknown_817D925
    callstd 4
    goto EventScript_16557E
    end

EventScript_1655A1:: @ 81655A1
    loadword 0, gUnknown_817DA16
    callstd 4
    goto EventScript_16557E
    end

Movement_1655AF:: @ 81655AF
    step_12
    step_12
    step_12
    step_11
    step_11
    step_11
    step_11
    step_11
    step_12
    step_12
    step_12
    step_12
    step_12
    step_2e
    step_end

Movement_1655BE:: @ 81655BE
    step_13
    step_13
    step_13
    step_13
    step_13
    step_10
    step_10
    step_10
    step_10
    step_10
    step_13
    step_13
    step_13
    step_end

Movement_1655CC:: @ 81655CC
    step_13
    step_13
    step_13
    step_13
    step_13
    step_10
    step_10
    step_10
    step_10
    step_10
    step_13
    step_13
    step_13
    step_13
    step_13
    step_2e
    step_end

Movement_1655DD:: @ 81655DD
    step_10
    step_13
    step_13
    step_13
    step_13
    step_13
    step_10
    step_10
    step_10
    step_10
    step_10
    step_13
    step_13
    step_13
    step_13
    step_end

PalletTown_EventScript_1655ED:: @ 81655ED
    lockall
    setvar VAR_0x4001, 0
    goto EventScript_165605
    end

PalletTown_EventScript_1655F9:: @ 81655F9
    lockall
    setvar VAR_0x4001, 1
    goto EventScript_165605
    end

EventScript_165605:: @ 8165605
    setvar VAR_0x8004, 0
    setvar VAR_0x8005, 2
    special UpdatePickStateFromSpecialVar8005
    textcolor 0
    delay 30
    playbgm BGM_FRLG_PROF_OAK, 0
    message Text_17D72C
    waitmessage
    delay 85
    closemessage
    applymovement 255, Movement_1A75ED
    waitmovement 0
    playse SE_PIN
    applymovement 255, Movement_1A75DB
    waitmovement 0
    delay 30
    addobject 3
    compare_var_to_value VAR_0x4001, 0
    call_if 1, EventScript_1656B8
    compare_var_to_value VAR_0x4001, 1
    call_if 1, EventScript_1656C3
    delay 30
    loadword 0, gUnknown_817D74A
    callstd 4
    closemessage
    delay 30
    compare_var_to_value VAR_0x4001, 0
    call_if 1, EventScript_1656CE
    compare_var_to_value VAR_0x4001, 1
    call_if 1, EventScript_1656E0
    opendoor 16, 13
    waitdooranim
    applymovement 3, Movement_16572E
    applymovement 255, Movement_165758
    waitmovement 0
    closedoor 16, 13
    waitdooranim
    setvar VAR_0x4055, 1
    clearflag FLAG_0x02B
    setvar VAR_0x4050, 1
    setflag FLAG_0x02C
    setflag FLAG_SPECIAL_FLAG_0x4001
    warp MAP_PALLETTOWN_PROFESSOROAKSLAB, 255, 6, 12
    waitstate
    releaseall
    end

EventScript_1656B8:: @ 81656B8
    applymovement 3, Movement_1656F2
    waitmovement 0
    return

EventScript_1656C3:: @ 81656C3
    applymovement 3, Movement_1656FB
    waitmovement 0
    return

EventScript_1656CE:: @ 81656CE
    applymovement 3, Movement_165705
    applymovement 255, Movement_165731
    waitmovement 0
    return

EventScript_1656E0:: @ 81656E0
    applymovement 3, Movement_165719
    applymovement 255, Movement_165744
    waitmovement 0
    return

Movement_1656F2:: @ 81656F2
    step_11
    step_11
    step_13
    step_11
    step_11
    step_13
    step_11
    step_11
    step_end

Movement_1656FB:: @ 81656FB
    step_13
    step_11
    step_11
    step_13
    step_11
    step_11
    step_13
    step_11
    step_11
    step_end

Movement_165705:: @ 8165705
    step_10
    step_12
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_13
    step_13
    step_13
    step_13
    step_13
    step_2e
    step_end

Movement_165719:: @ 8165719
    step_10
    step_12
    step_12
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_13
    step_13
    step_13
    step_13
    step_13
    step_2e
    step_end

Movement_16572E:: @ 816572E
    step_11
    step_60
    step_end

Movement_165731:: @ 8165731
    step_10
    step_10
    step_12
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_13
    step_13
    step_13
    step_13
    step_end

Movement_165744:: @ 8165744
    step_10
    step_10
    step_12
    step_12
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_10
    step_13
    step_13
    step_13
    step_13
    step_end

Movement_165758:: @ 8165758
    step_13
    step_11
    step_60
    step_end

PalletTown_EventScript_16575C:: @ 816575C
    lock
    compare_var_to_value VAR_0x4070, 2
    goto_if 1, EventScript_1657ED
    compare_var_to_value VAR_0x4070, 1
    goto_if 1, EventScript_165815
    compare_var_to_value VAR_0x4002, 1
    goto_if 1, EventScript_1658C2
    checkflag FLAG_0x002
    goto_if 1, EventScript_165801
    loadword 0, gUnknown_81B1C8B
    callstd 4
    applymovement 1, Movement_1A75E1
    waitmovement 0
    playse SE_PIN
    applymovement 1, Movement_1A75DB
    waitmovement 0
    applymovement 1, Movement_1A75DD
    waitmovement 0
    loadword 0, gUnknown_81B1C9F
    callstd 4
    closemessage
    compare_var_to_value VAR_FACING, 4
    call_if 1, EventScript_1657D7
    compare_var_to_value VAR_FACING, 4
    call_if 5, EventScript_1657E2
    moveobjectoffscreen 1
    setflag FLAG_0x002
    release
    end

EventScript_1657D7:: @ 81657D7
    applymovement 1, Movement_165829
    waitmovement 0
    return

EventScript_1657E2:: @ 81657E2
    applymovement 1, Movement_16582C
    waitmovement 0
    return

EventScript_1657ED:: @ 81657ED
    applymovement 1, Movement_1A75E1
    waitmovement 0
    loadword 0, gUnknown_817D7C8
    callstd 4
    release
    end

EventScript_165801:: @ 8165801
    applymovement 1, Movement_1A75E1
    waitmovement 0
    loadword 0, gUnknown_81B1CAF
    callstd 4
    release
    end

EventScript_165815:: @ 8165815
    applymovement 1, Movement_1A75E1
    waitmovement 0
    loadword 0, gUnknown_81B1CEC
    callstd 4
    release
    end

Movement_165829:: @ 8165829
    step_13
    step_2f
    step_end

Movement_16582C:: @ 816582C
    step_12
    step_30
    step_end

PalletTown_EventScript_16582F:: @ 816582F
    loadword 0, gUnknown_817D80D
    callstd 2
    end

PalletTown_EventScript_165838:: @ 8165838
    lockall
    setvar VAR_0x8004, 0
    setvar VAR_0x8005, 0
    special SetFlavorTextFlagFromSpecialVars
    loadword 0, gUnknown_817D866
    callstd 4
    releaseall
    end

PalletTown_EventScript_165850:: @ 8165850
    loadword 0, gUnknown_817D87F
    callstd 3
    end

PalletTown_EventScript_165859:: @ 8165859
    loadword 0, gUnknown_817D88A
    callstd 3
    end

PalletTown_EventScript_165862:: @ 8165862
    loadword 0, gUnknown_817D895
    callstd 3
    end

PalletTown_EventScript_16586B:: @ 816586B
    lockall
    loadword 0, gUnknown_81B1CC1
    callstd 4
    setvar VAR_0x4070, 1
    releaseall
    end

PalletTown_EventScript_16587B:: @ 816587B
    lockall
    applymovement 1, Movement_1A75EB
    applymovement 255, Movement_1A75E7
    waitmovement 0
    call EventScript_165894
    releaseall
    end

EventScript_165894:: @ 8165894
    textcolor 1
    loadword 0, gUnknown_81B1D0B
    callstd 4
    closemessage
    delay 20
    textcolor 3
    setflag 2110
    setvar VAR_0x4070, 1
    setvar VAR_0x4002, 0
    special sub_80699E0
    special sub_80699BC
    signmsg
    loadword 0, gUnknown_81B1D51
    callstd 4
    normalmsg
    return

EventScript_1658C2:: @ 81658C2
    applymovement 1, Movement_1A75E1
    waitmovement 0
    call EventScript_165894
    release
    end