Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_npc_gerson_Step_0

(view raw script w/o annotations or w/e)
1
event_inherited();
2
if (facing_right && image_xscale != -2)
3
    
scr_flip
scr_flip

function
scr_flip(arg0)
{ if (arg0 == "h" || arg0 == "x") { x += ((sprite_get_width(sprite_index) - (sprite_get_xoffset(sprite_index) * 2)) * image_xscale); image_xscale = -image_xscale; } else { y += ((sprite_get_height(sprite_index) - (sprite_get_yoffset(sprite_index) * 2)) * image_yscale); image_yscale = -image_yscale; } }
("x");
4
if (!facing_right && image_xscale != 2)
5
    
scr_flip
scr_flip

function
scr_flip(arg0)
{ if (arg0 == "h" || arg0 == "x") { x += ((sprite_get_width(sprite_index) - (sprite_get_xoffset(sprite_index) * 2)) * image_xscale); image_xscale = -image_xscale; } else { y += ((sprite_get_height(sprite_index) - (sprite_get_yoffset(sprite_index) * 2)) * image_yscale); image_yscale = -image_yscale; } }
("x");
6
if (state != current_state)
7
{
8
    state = current_state;
9
    state_init = false;
10
    state_loaded = false;
11
    if (state != 2 && state != 3)
12
        thinking_loop = false;
13
    if (state < 14)
14
        writing_loop = false;
15
    if (paper_marker != -4)
16
        instance_destroy(paper_marker);
17
}
18
if (state == 0)
19
{
20
    if (!state_init)
21
    {
22
        state_init = true;
23
        anim_speed = 0;
24
        anim_index = 0;
25
        state_loaded = true;
26
    }
27
}
28
if (state == 1)
29
{
30
    if (!state_init)
31
    {
32
        state_init = true;
33
        current_sprite_index = facing_up ? spr_gerson_outfit_walk_up : spr_gerson_outfit_walk_cane;
34
        anim_speed = 0.2;
35
        anim_index = 0;
36
        state_loaded = true;
37
    }
38
    if (facing_up)
39
    {
40
        if (current_sprite_index != spr_gerson_outfit_walk_up)
41
            current_sprite_index = spr_gerson_outfit_walk_up;
42
    }
43
    else if (current_sprite_index != spr_gerson_outfit_walk_cane)
44
    {
45
        current_sprite_index = spr_gerson_outfit_walk_cane;
46
    }
47
}
48
if (state == 2)
49
{
50
    if (!state_init)
51
    {
52
        state_init = true;
53
        current_sprite_index = spr_gerson_beard_thinking;
54
        anim_speed = 0.1;
55
        anim_index = 0;
56
        state_loaded = true;
57
    }
58
}
59
if (state == 3)
60
{
61
    if (!state_init)
62
    {
63
        state_init = true;
64
        current_sprite_index = spr_gerson_shifty;
65
        anim_speed = 0.1;
66
        anim_index = 0;
67
        state_loaded = true;
68
    }
69
}
70
if (state == 4)
71
{
72
    if (!state_init)
73
    {
74
        state_init = true;
75
        state_loaded = true;
76
        thinking_loop = true;
77
        thinking_timer = 0;
78
    }
79
}
80
if (state == 5)
81
{
82
    if (!state_init)
83
    {
84
        state_init = true;
85
        current_sprite_index = spr_gerson_outfit_laugh_left;
86
        anim_speed = 0.2;
87
        anim_index = 0;
88
        state_loaded = true;
89
    }
90
}
91
if (state == 6)
92
{
93
    if (!state_init)
94
    {
95
        state_init = true;
96
        current_sprite_index = spr_gerson_bow;
97
        anim_speed = 0;
98
        anim_index = 0;
99
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("anim_index", 0, 2, 12);
100
        scr_delay_var("state_loaded", true, 13);
101
    }
102
}
103
if (state == 7)
104
{
105
    if (!state_init)
106
    {
107
        state_init = true;
108
        current_sprite_index = spr_gerson_outfit_genki;
109
        anim_speed = 0.2;
110
        anim_index = 0;
111
        state_loaded = true;
112
    }
113
}
114
if (state == 8)
115
{
116
    if (!state_init)
117
    {
118
        state_init = true;
119
        current_sprite_index = spr_gerson_point_left;
120
        anim_speed = 0.1;
121
        anim_index = 0;
122
        state_loaded = true;
123
    }
124
}
125
if (state == 9)
126
{
127
    if (!state_init)
128
    {
129
        state_init = true;
130
        anim_speed = 0;
131
        anim_index = 0;
132
        state_loaded = true;
133
        current_sprite_index = spr_gerson_outfit_walk_cane;
134
    }
135
    if (facing_up)
136
    {
137
        if (current_sprite_index != spr_gerson_outfit_walk_up)
138
            current_sprite_index = spr_gerson_outfit_walk_up;
139
    }
140
    else if (current_sprite_index != spr_gerson_outfit_walk_cane)
141
    {
142
        current_sprite_index = spr_gerson_outfit_walk_cane;
143
    }
144
}
145
if (state == 10)
146
{
147
    if (!state_init)
148
    {
149
        state_init = true;
150
        anim_speed = 0;
151
        anim_index = 0;
152
        state_loaded = true;
153
        current_sprite_index = spr_gerson_battle_overworld;
154
    }
155
}
156
if (state == 11)
157
{
158
    if (!state_init)
159
    {
160
        state_init = true;
161
        current_sprite_index = spr_gerson_laugh_scene;
162
        anim_speed = 0.2;
163
        anim_index = 0;
164
        state_loaded = true;
165
    }
166
}
167
if (state == 12)
168
{
169
    if (!state_init)
170
    {
171
        state_init = true;
172
        current_sprite_index = spr_gerson_bow_shake;
173
        anim_speed = 0.1;
174
        anim_index = 0;
175
        state_loaded = true;
176
    }
177
}
178
if (state == 13)
179
{
180
    if (!state_init)
181
    {
182
        state_init = true;
183
        current_sprite_index = spr_gerson_hand_up;
184
        anim_speed = 0;
185
        anim_index = 0;
186
        paper_timer = 0;
187
    }
188
    if (paper_con == 0)
189
    {
190
        paper_timer++;
191
        if (paper_timer == 1)
192
        {
193
            if (paper_marker != -4)
194
                instance_destroy(paper_marker);
195
            snd_play_pitch(snd_wing, 1.2);
196
            paper_marker = 
scr_dark_marker
scr_dark_marker

function
scr_dark_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; image_xscale = 2; image_yscale = 2; } return thismarker; }
(x + 14, y + 46, spr_gerson_paper_fall);
197
            with (paper_marker)
198
            {
199
                vspeed = 6;
200
                
scr_var_delay
scr_var_delay

function
scr_var_delay(arg0, arg1, arg2)
{
scr_script_delayed(scr_var, arg2, arg0, arg1);
} function scr_var_delayed(arg0, arg1, arg2) {
scr_script_delayed(scr_var, arg2, arg0, arg1);
} function scr_delay_var(arg0, arg1, arg2) {
scr_script_delayed(scr_var, arg2, arg0, arg1);
}
("sprite_index", spr_gerson_paper_floor, 6);
201
                
scr_var_delay
scr_var_delay

function
scr_var_delay(arg0, arg1, arg2)
{
scr_script_delayed(scr_var, arg2, arg0, arg1);
} function scr_var_delayed(arg0, arg1, arg2) {
scr_script_delayed(scr_var, arg2, arg0, arg1);
} function scr_delay_var(arg0, arg1, arg2) {
scr_script_delayed(scr_var, arg2, arg0, arg1);
}
("vspeed", 0, 4);
202
                
scr_var_delay
scr_var_delay

function
scr_var_delay(arg0, arg1, arg2)
{
scr_script_delayed(scr_var, arg2, arg0, arg1);
} function scr_var_delayed(arg0, arg1, arg2) {
scr_script_delayed(scr_var, arg2, arg0, arg1);
} function scr_delay_var(arg0, arg1, arg2) {
scr_script_delayed(scr_var, arg2, arg0, arg1);
}
("hspeed", -6, 3);
203
                
scr_var_delay
scr_var_delay

function
scr_var_delay(arg0, arg1, arg2)
{
scr_script_delayed(scr_var, arg2, arg0, arg1);
} function scr_var_delayed(arg0, arg1, arg2) {
scr_script_delayed(scr_var, arg2, arg0, arg1);
} function scr_delay_var(arg0, arg1, arg2) {
scr_script_delayed(scr_var, arg2, arg0, arg1);
}
("friction", 1, 8);
204
            }
205
        }
206
    }
207
    if (paper_con == 1)
208
    {
209
        paper_timer++;
210
        if (paper_timer == 1)
211
        {
212
            current_sprite_index = spr_gerson_hand_up_look_down;
213
            anim_index = 0;
214
        }
215
        if (paper_timer == 10)
216
        {
217
            current_sprite_index = spr_gerson_reach_down;
218
            anim_index = 0;
219
        }
220
        if (paper_timer == 14)
221
            anim_index = 1;
222
    }
223
}
224
if (state == 14)
225
{
226
    if (!state_init)
227
    {
228
        state_init = true;
229
        current_sprite_index = spr_gerson_writing_loop;
230
        anim_speed = 0.1;
231
        anim_index = 0;
232
        state_loaded = true;
233
    }
234
}
235
if (state == 15)
236
{
237
    if (!state_init)
238
    {
239
        state_init = true;
240
        current_sprite_index = spr_gerson_writing_scratch_loop;
241
        anim_speed = 0.1;
242
        anim_index = 0;
243
        state_loaded = true;
244
    }
245
}
246
if (state == 16)
247
{
248
    if (!state_init)
249
    {
250
        state_init = true;
251
        current_sprite_index = spr_gerson_writing_scratch_aha;
252
        anim_speed = 0;
253
        anim_index = 0;
254
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("anim_index", 0, 1, 6);
255
        scr_delay_var("state_loaded", true, 7);
256
    }
257
}
258
if (state == 17)
259
{
260
    if (!state_init)
261
    {
262
        state_init = true;
263
        state_loaded = true;
264
        writing_loop = true;
265
        writing_timer = 0;
266
    }
267
}
268
if (state == 18)
269
{
270
    if (!state_init)
271
    {
272
        state_init = true;
273
        spintimer = 0;
274
        current_sprite_index = spr_gerson_spin_smear;
275
        anim_speed = 0;
276
        anim_index = 0;
277
    }
278
    spintimer++;
279
    if (spintimer < 10)
280
        anim_index += (2/3);
281
    if (spintimer == 10)
282
    {
283
        anim_index = 0;
284
        current_sprite_index = spr_gerson_spin;
285
        snd_play(snd_mercyadd);
286
    }
287
    if (spintimer >= 10)
288
    {
289
        if (anim_index < 11)
290
            anim_index += 0.5;
291
        if (anim_index >= 11)
292
            anim_index += 0.25;
293
        if (anim_index > 13)
294
            anim_index = 13;
295
    }
296
    if (spintimer == 50)
297
        state_loaded = true;
298
}
299
if (state == 19)
300
{
301
    if (!state_init)
302
    {
303
        state_init = true;
304
        anim_timer = 0;
305
        current_sprite_index = spr_gerson_smear_battle_ready;
306
        anim_speed = 0;
307
        anim_index = 1;
308
    }
309
    anim_timer++;
310
    if (anim_timer == 4)
311
        anim_index = 0;
312
    if (anim_timer == 30)
313
        state_loaded = true;
314
}
315
if (state == 20)
316
{
317
    if (!state_init)
318
    {
319
        state_init = true;
320
        anim_timer = 0;
321
        current_sprite_index = spr_gerson_outfit_genki;
322
        anim_speed = 0;
323
        anim_index = 0;
324
    }
325
    anim_timer++;
326
    if (anim_timer == 1)
327
        
scr_jump_to_point_sprite
scr_jump_to_point_sprite

function
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, arg4, arg5)
{ __jump_to_point = instance_create(x, y, obj_jump_to_point); __jump_to_point.target = id; with (__jump_to_point) { startx = x; starty = y; endx = arg0; endy = arg1; jumpspeed = arg2; jumptime = arg3; jumpsprite = arg4; landsprite = arg5; if (arg4 > 0) usesprites = 1; drawshadow = 0; } return __jump_to_point; }
(x, y, 8, 8, 2203, 2203);
328
    if (anim_timer == 14)
329
    {
330
        current_sprite_index = spr_gerson_outfit_walk_cane;
331
        anim_speed = 0;
332
        anim_index = 0;
333
        state_loaded = true;
334
    }
335
}
336
if (state == 21)
337
{
338
    if (!state_init)
339
    {
340
        state_init = true;
341
        writing_loop = false;
342
        current_sprite_index = spr_gerson_writing_look;
343
        anim_speed = 0;
344
        anim_index = 0;
345
        state_loaded = true;
346
    }
347
}
348
if (thinking_loop)
349
{
350
    thinking_timer++;
351
    if (thinking_timer == 1)
352
        current_state = 2;
353
    if (thinking_timer == 70)
354
        current_state = 3;
355
    if (thinking_timer == 110)
356
        thinking_timer = 0;
357
}
358
if (writing_loop)
359
{
360
    writing_timer++;
361
    if (writing_timer == 1)
362
        current_state = 14;
363
    if (writing_timer == 120)
364
        current_state = 15;
365
    if (writing_timer == 190)
366
        current_state = 16;
367
    if (writing_timer == 210)
368
        writing_timer = 0;
369
}