Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_dw_fcastle_right_puzzle_Step_0

related scripts: Create_0Draw_0Step_0

(view raw script w/o annotations or w/e)
1
if (!init)
2
{
3
    init = 1;
4
    with (obj_shortcut_door)
5
        reflect_jump_y = -6;
6
    if (global.flag[1455] >= 100)
7
    {
8
        with (obj_doorAny)
9
        {
10
            if (doorRoom == room_dw_fcastle_right_wing_floweryscene)
11
            {
12
                doorRoom = room_dw_fcastle_fusumadodge;
13
                doorEntrance = 2;
14
            }
15
        }
16
    }
17
    doormarker = scr_marker_fromasset(findsprite(spr_fcastle_left_twodoors_orangedoor));
18
    doormarker.depth = 1200400;
19
    doormarker.reflect_jump_y = -4;
20
    with (obj_castlereflect_manager)
21
    {
22
        add_reflection(other.doormarker);
23
        add_reflection(other.npc_sign_left.marker);
24
        add_reflection(other.npc_sign_right.marker);
25
        add_reflection(1203);
26
    }
27
    with (obj_plat_asset)
28
    {
29
        if (flat)
30
            visible = false;
31
    }
32
    with (obj_plat_hanging_key)
33
    {
34
        on_hit = function()
35
        {
36
            obj_dw_fcastle_right_puzzle.keycon = 1;
37
            obj_dw_fcastle_right_puzzle.key_x = x;
38
            obj_dw_fcastle_right_puzzle.key_y = y;
39
        };
40
    }
41
    with (obj_plat_stringed_object)
42
    {
43
        if (extflag == "signery")
44
        {
45
            on_hit = function()
46
            {
47
                snd_play_flowery(678);
48
                obj_dw_fcastle_right_puzzle.signcon = 1;
49
                obj_dw_fcastle_right_puzzle.sign_x = x;
50
                obj_dw_fcastle_right_puzzle.sign_y = y;
51
                broken = true;
52
                with (attached_object)
53
                    instance_destroy();
54
            };
55
        }
56
    }
57
    with (obj_solidblocksized_alt)
58
    {
59
        other.doorinteract = instance_create(x, y, obj_interactable);
60
        with (other.doorinteract)
61
        {
62
            extflag = "door";
63
            sprite_index = other.sprite_index;
64
            image_xscale = other.image_xscale;
65
            image_yscale = other.image_yscale;
66
            visible = 0;
67
            
68
            on_interact = function()
69
            {
70
                global.interact = 1;
71
                with (obj_dw_fcastle_right_puzzle)
72
                    doorcon = 1;
73
            };
74
        }
75
    }
76
    with (obj_plat_antisoftlock_zone)
77
    {
78
        conversation = 1;
79
        
80
        on_softlock_detected = function()
81
        {
82
            with (obj_dw_fcastle_right_puzzle)
83
            {
84
                if (stuckcon == 0)
85
                {
86
                    stuckcon = 1;
87
                    stucktimer = 0;
88
                }
89
            }
90
        };
91
        
92
        on_exit_softlock_zone = function()
93
        {
94
            with (obj_dw_fcastle_right_puzzle)
95
            {
96
                if (stuckcon == 2)
97
                {
98
                    stuckcon = 3;
99
                    stucktimer = 0;
100
                }
101
            }
102
        };
103
    }
104
    if (scr_flag_get_ext(_ROOM_FLAG, _BIT_DOOR, 1))
105
    {
106
        keycon = 3;
107
        with (obj_plat_hanging_key)
108
            broken = true;
109
        scatter_papers();
110
        with (doormarker)
111
            sprite_index = spr_fcastle_left_twodoors_orangedoor_open;
112
        with (obj_solidblocksized_alt)
113
            instance_destroy();
114
        with (doorinteract)
115
            instance_destroy();
116
    }
117
    var signery_state = 0;
118
    if (scr_flag_get_ext(_ROOM_FLAG, _BIT_SIGNERY_LEFT, 1))
119
        signery_state = -1;
120
    else if (scr_flag_get_ext(_ROOM_FLAG, _BIT_SIGNERY_RIGHT, 1))
121
        signery_state = 1;
122
    if (global.flag[1862] > 0 && global.flag[1862] != 3)
123
    {
124
        with (obj_plat_stringed_object)
125
        {
126
            if (extflag == "signery")
127
            {
128
                broken = true;
129
                with (attached_object)
130
                    instance_destroy();
131
            }
132
            with (other.npc_sign_right)
133
                x = -10000;
134
        }
135
    }
136
    else if (signery_state != 0)
137
    {
138
        with (obj_plat_stringed_object)
139
        {
140
            if (extflag == "signery")
141
            {
142
                broken = true;
143
                with (attached_object)
144
                    instance_destroy();
145
            }
146
        }
147
        with (npc_sign_right)
148
            x = (x - 140) + (140 * signery_state);
149
    }
150
}
151
if (stuckcon == 1)
152
{
153
    if (!global.pause_plat)
154
    {
155
        stucktimer++;
156
        if (stucktimer == 60)
157
        {
158
            stuckcon = 2;
159
            stucktimer = 0;
160
            with (obj_plat_block)
161
            {
162
                if (extflag == "shadowplatform")
163
                    mask_index = spr_plat_blankmask;
164
            }
165
            with (obj_shadowplatformController)
166
                
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; 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_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("plat_alpha", 1, 0.3, 5);
167
        }
168
    }
169
}
170
else if (stuckcon == 2)
171
{
172
    if (!i_ex(obj_plat_player))
173
    {
174
        stuckcon = 0;
175
        with (obj_shadowplatformController)
176
            
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; 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_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("plat_alpha", 0.3, 1, 5);
177
    }
178
}
179
else if (stuckcon == 3)
180
{
181
    if (i_ex(obj_plat_player))
182
    {
183
        stuckcon = 0;
184
        with (obj_plat_block)
185
        {
186
            if (extflag == "shadowplatform")
187
                mask_index = -4;
188
        }
189
        with (obj_shadowplatformController)
190
            
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; 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_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("plat_alpha", 0.3, 1, 5);
191
    }
192
}
193
if (doorcon == 1)
194
{
195
    doorcon = 2;
196
    
scr_speaker
scr_speaker

function
scr_speaker(arg0)
{ _speaker = arg0; global.typer = 5; if (global.darkzone == 1) global.typer = 6; if (global.fighting == 1) global.typer = 4; global.fc = 0; global.fe = 0; if (_speaker == "silent" && global.darkzone == 0) global.typer = 2; if (_speaker == "silent" && global.darkzone == 1) global.typer = 36; if (_speaker == "balloon" || _speaker == "enemy") global.typer = 50; if (_speaker == "sans") { global.typer = 14; global.fc = 6; } if (_speaker == "undyne" || _speaker == "und") { global.typer = 17; global.fc = 9; } if (_speaker == "temmie" || _speaker == "tem") global.typer = 21; if (_speaker == "jevil") global.typer = 35; if (_speaker == "catti") global.fc = 13; if (_speaker == "jockington" || _speaker == "joc") global.fc = 14; if (_speaker == "catty" || _speaker == "caddy") global.fc = 16; if (_speaker == "bratty" || _speaker == "bra") global.fc = 17; if (_speaker == "rouxls" || _speaker == "rou") global.fc = 18; if (_speaker == "burgerpants" || _speaker == "bur") global.fc = 19; if (_speaker == "spamton") { if (global.fighting == 0) global.typer = 66; else global.typer = 68; } if (_speaker == "sneo") global.typer = 67; if (_speaker == "susie" || _speaker == "sus") { global.fc = 1; global.typer = 10; if (global.darkzone == 1) { global.typer = 30; if (global.fighting == 1) global.typer = 47; } } if (_speaker == "ralsei" || _speaker == "ral") { global.fc = 2; global.typer = 31; if (global.fighting == 1) global.typer = 45; if (global.flag[30 ralsei_hat_state] == 1) global.typer = 6; } if (_speaker == "noelle" || _speaker == "noe") { global.fc = 3; if (global.darkzone == 0) global.typer = 12; else global.typer = 56; if (global.fighting == 1) global.typer = 59; } if (_speaker == "toriel" || _speaker == "tor") { global.fc = 4; global.typer = 7; } if (_speaker == "asgore" || _speaker == "asg") { global.fc = 10; global.typer = 18; if (global.darkzone == 1) global.typer = 89; } if (_speaker == "king" || _speaker == "kin") { global.fc = 20; global.typer = 33; if (global.chapter == 1) { if (global.plot < 235) global.typer = 36; ...
("no_name");
197
    msgsetloc(0, 
* (It's an orange locked orange door,Delay 11 orange locked by an orange key.)Wait for inputClose Message
"* (It's an orange locked orange door^1, orange locked by an orange key.)/%", "obj_dw_fcastle_right_puzzle_slash_Step_0_gml_187_0"
);
198
    d_make(0);
199
}
200
else if (doorcon == 2 && !instance_exists(obj_dialoguer))
201
{
202
    global.interact = 0;
203
    doorcon = 0;
204
}
205
if (keycon == 1)
206
{
207
    keycon = 2;
208
    scr_flag_set_ext(_ROOM_FLAG, _BIT_DOOR, 1);
209
    keymarker = instance_create(key_x, key_y, obj_marker);
210
    with (keymarker)
211
    {
212
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; 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_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("x", xstart, xstart + (60 * sign(obj_plat_player.image_xscale)), 15, 1, "out");
213
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; 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_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("y", ystart, ystart + 200, 15, 1, "in");
214
        
scr_script_delayed
scr_script_delayed

function
scr_script_delayed()
{ var __scriptdelay = instance_create(0, 0, obj_script_delayed); __scriptdelay.script = argument[0]; __scriptdelay.alarm[0] = argument[1]; __scriptdelay.target = id; for (var __i = 0; __i < (argument_count - 2); __i++) __scriptdelay.script_arg[__i] = argument[__i + 2]; __scriptdelay.arg_count = argument_count - 2; return __scriptdelay; } function scr_script_delayed_until() { var __scriptdelay = instance_create(0, 0, obj_script_delayed_function); __scriptdelay.script = argument[0]; __scriptdelay.condition = argument[1]; __scriptdelay.target = id; for (var __i = 0; __i < (argument_count - 2); __i++) __scriptdelay.script_arg[__i] = argument[__i + 2]; __scriptdelay.arg_count = argument_count - 2; return __scriptdelay; } function delay_function(arg0, arg1) { return
scr_script_delayed(arg0, arg1);
}
(scr_lerpvar, 15, "x", xstart + (60 * sign(obj_plat_player.image_xscale)), xstart - 160, 15, 1, "in");
215
        
scr_script_delayed
scr_script_delayed

function
scr_script_delayed()
{ var __scriptdelay = instance_create(0, 0, obj_script_delayed); __scriptdelay.script = argument[0]; __scriptdelay.alarm[0] = argument[1]; __scriptdelay.target = id; for (var __i = 0; __i < (argument_count - 2); __i++) __scriptdelay.script_arg[__i] = argument[__i + 2]; __scriptdelay.arg_count = argument_count - 2; return __scriptdelay; } function scr_script_delayed_until() { var __scriptdelay = instance_create(0, 0, obj_script_delayed_function); __scriptdelay.script = argument[0]; __scriptdelay.condition = argument[1]; __scriptdelay.target = id; for (var __i = 0; __i < (argument_count - 2); __i++) __scriptdelay.script_arg[__i] = argument[__i + 2]; __scriptdelay.arg_count = argument_count - 2; return __scriptdelay; } function delay_function(arg0, arg1) { return
scr_script_delayed(arg0, arg1);
}
(scr_lerpvar, 15, "y", ystart + 200, ystart + 400, 15, 1, "out");
216
        sprite_index = spr_fcastle_orange_key;
217
        image_speed = 0;
218
        scr_plat_make_pauseable(self);
219
        
scr_darksize
scr_darksize

function
scr_darksize()
{ var inst = id; if (argument_count) inst = argument0; inst.image_xscale = 2; inst.image_yscale = 2; }
();
220
    }
221
}
222
if (keycon == 2)
223
{
224
    if (!global.pause_plat)
225
    {
226
        keycontimer++;
227
        with (keymarker)
228
            
scr_afterimage_monochrome
scr_afterimage_monochrome

function
scr_afterimage_monochrome(arg0, arg1)
{ afterimage = instance_create(x, y, obj_afterimage_onecolor); afterimage.tint = arg0; afterimage.additive = arg1; afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; } function scr_afterimage_monochrome_parallax(arg0, arg1, arg2) { afterimage = instance_create(x, y, obj_afterimage_onecolor_parallax); afterimage.tint = arg0; afterimage.additive = arg1; afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; afterimage.parallax_depth = arg2; return afterimage; }
(4235519, true).image_alpha = 0.3;
229
        keymarker.image_angle = keycontimer * 15;
230
        if (keycontimer == 30)
231
        {
232
            with (doormarker)
233
                sprite_index = spr_fcastle_left_twodoors_orangedoor_open;
234
            snd_play(snd_locker);
235
            with (obj_plat_camera)
236
            {
237
                shakex = 6;
238
                shakey = 6;
239
            }
240
            with (keymarker)
241
                instance_destroy();
242
            with (obj_solidblocksized_alt)
243
                instance_destroy();
244
            with (doorinteract)
245
                instance_destroy();
246
            keycon = 3;
247
        }
248
    }
249
}
250
if (signcon == 1)
251
{
252
    signcon = 2;
253
    if (obj_plat_player.image_xscale > 0)
254
        scr_flag_set_ext(_ROOM_FLAG, _BIT_SIGNERY_RIGHT, 1);
255
    else
256
        scr_flag_set_ext(_ROOM_FLAG, _BIT_SIGNERY_LEFT, 1);
257
    signmarker = instance_create(sign_x, sign_y, obj_marker);
258
    with (signmarker)
259
    {
260
        hspeed = 2.5 * obj_plat_player.image_xscale;
261
        vspeed = max(-5, obj_plat_player.vspeed);
262
        gravity = 1.8;
263
        friction = 0.1;
264
        sprite_index = spr_fcastle_signery_hanging;
265
        image_speed = 0;
266
        
scr_darksize
scr_darksize

function
scr_darksize()
{ var inst = id; if (argument_count) inst = argument0; inst.image_xscale = 2; inst.image_yscale = 2; }
();
267
        scr_plat_make_pauseable();
268
    }
269
}
270
if (signcon == 2)
271
{
272
    if (!global.pause_plat)
273
    {
274
        signcontimer++;
275
        with (signmarker)
276
            
scr_afterimage
scr_afterimage

function
scr_afterimage()
{ afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
().image_alpha = 0.3;
277
        signmarker.image_angle += signmarker.hspeed;
278
        if (signmarker.y >= npc_sign_right.y)
279
        {
280
            with (npc_sign_right)
281
                x -= (1140 - (140 * sign(other.signmarker.hspeed)));
282
            snd_play(snd_bump, 1, 1.3);
283
            with (signmarker)
284
                instance_destroy();
285
            signcon = 3;
286
        }
287
    }
288
}
289
if (concon == 1 && !d_ex())
290
{
291
    global.interact = 0;
292
    concon = 4;
293
}
294
if (concon == 2 && global.choice >= 0)
295
{
296
    k_d();
297
    concon = 3;
298
}
299
if (concon == 3 && !instance_exists(obj_cutscene_master))
300
{
301
    concon = 4;
302
    scr_delay_var("concon", 0, 1);
303
    global.interact = 0;
304
}
305
with (doormarker)
306
    image_index = lerp(0, 2.9, array_get(
scr_platswap_yscale
scr_platswap_yscale

function
scr_platswap_yscale()
{ with (obj_platswap) return __transition_yscale; return [0, 1]; }
(), 0));