Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_homealone_dess_closet_controller_Step_0

(view raw script w/o annotations or w/e)
1
if (con < 0)
2
    exit;
3
if (con == 1)
4
{
5
    con = 99;
6
    global.interact = 1;
7
    with (obj_homealone_heart)
8
        instance_destroy();
9
    closet = instance_create(108, 1, obj_noellehouse_dess_closet);
10
    closet.depth = 30000;
11
    if (!i_ex(obj_homealone_heart))
12
    {
13
        heart = instance_create(110, 65, obj_homealone_heart);
14
        heart.depth = 40000;
15
        heart.cutscene = 1;
16
        with (obj_mainchara)
17
        {
18
            y = -200;
19
            cutscene = 1;
20
            freeze = 1;
21
            visible = 0;
22
        }
23
    }
24
    kris = instance_create(135, 78, obj_homealone_dess_closet_kris);
25
    kris.visible = false;
26
    kris.depth = obj_homealone_heart.depth - 20;
27
    pile_marker = 
scr_marker
scr_marker

function
scr_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; } return thismarker; }
(closet.x + 1, closet.y + 68, spr_noellehouse_dess_closet_pile);
28
    pile_marker.depth = kris.depth - 100;
29
    santa[0] = instance_create(144, closet.y + 45, obj_homealone_dancing_santa_mini);
30
    santa[1] = instance_create(174, closet.y + 63, obj_homealone_dancing_santa_mini);
31
    santa[1].santa_type = 1;
32
    for (var i = 0; i < array_length_1d(santa); i++)
33
        santa[i].depth = pile_marker.depth + 200;
34
    target_santa = -4;
35
    pan_closet = false;
36
    heart_pushback = false;
37
    kris_ready = 0;
38
    push_velocity = 0;
39
    push_timer = 0;
40
    present = instance_create(162, closet.y + 40, obj_homealone_present);
41
    present.depth = pile_marker.depth + 200;
42
    present2 = instance_create(222, closet.y + 45, obj_homealone_present);
43
    present2.sprite_index = spr_noellehouse_present_thin;
44
    present2.depth = pile_marker.depth + 200;
45
    present2.movespeed = 2;
46
    var santa_xpos_a = santa[0].x;
47
    var santa_ypos_a = santa[0].y;
48
    var santa_xpos_b = santa[1].x + 10;
49
    var santa_ypos_b = santa[1].y;
50
    with (kris)
51
    {
52
        santax[0] = santa_xpos_a;
53
        santay[0] = santa_ypos_a;
54
        santax[1] = santa_xpos_b;
55
        santay[1] = santa_ypos_b;
56
    }
57
    guitar_marker = instance_create(277, 40, obj_homealone_dess_guitar);
58
    guitar_marker.depth = obj_homealone_heart.depth + 20;
59
    ladder_marker = 
scr_marker
scr_marker

function
scr_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; } return thismarker; }
(295, 69, spr_noellehouse_dess_closet_ladder);
60
    ladder_marker.depth = kris.depth + 10;
61
    with (obj_npc_room)
62
        instance_destroy();
63
    kris_pickup = true;
64
    with (kris)
65
    {
66
        x = 184;
67
        image_speed = 0;
68
        pickup_stick = true;
69
    }
70
    kris_press_santa = false;
71
    kris_swing_heart = false;
72
    shelf_cover[0] = 
scr_marker
scr_marker

function
scr_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; } return thismarker; }
(162, 58, spr_noellehouse_dess_closet_shelf_cover);
73
    shelf_cover[1] = 
scr_marker
scr_marker

function
scr_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; } return thismarker; }
(132, 58, spr_noellehouse_dess_closet_shelf_cover);
74
    shelf_cover[2] = 
scr_marker
scr_marker

function
scr_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; } return thismarker; }
(193, 58, spr_noellehouse_dess_closet_shelf_cover);
75
    shelf_cover[3] = 
scr_marker
scr_marker

function
scr_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; } return thismarker; }
(281, 58, spr_noellehouse_dess_closet_shelf_cover);
76
    for (var i = 0; i < array_length_1d(shelf_cover); i++)
77
    {
78
        shelf_cover[i].image_xscale = 1.2;
79
        shelf_cover[i].depth = obj_homealone_heart.depth - 5;
80
    }
81
}
82
if (open_closet)
83
{
84
    open_closet = false;
85
    with (closet)
86
        open_door = true;
87
}
88
if (close_closet)
89
{
90
    close_closet = false;
91
    with (closet)
92
        close_door = true;
93
}
94
if (closet_fadein)
95
{
96
    closet_fadein = false;
97
    kris.visible = true;
98
    with (closet)
99
    {
100
        kris_active = false;
101
        closet_fadein = true;
102
    }
103
    scr_delay_var("pan_closet", true, 30);
104
    scr_delay_var("kris_pickup", true, 30);
105
}
106
if (pan_closet)
107
{
108
    if (camerax() != 20 || cameray() != -20)
109
    {
110
        camerax_set(
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(camerax(), 20, 1));
111
        cameray_set(
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(cameray(), -20, 1));
112
    }
113
    else
114
    {
115
        pan_closet = false;
116
        global.interact = 0;
117
    }
118
}
119
if (finish_sequence)
120
{
121
    with (obj_homealone_heart)
122
    {
123
        x = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(x, other.guitar_marker.x + 20, 2);
124
        y = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(y, other.guitar_marker.y + 10, 2);
125
    }
126
    finish_timer++;
127
    if (finish_timer == 1)
128
    {
129
        snd_play(snd_susie_strum_mistake);
130
        global.interact = 1;
131
        with (obj_homealone_dancing_santa_mini)
132
        {
133
            if (is_active)
134
            {
135
                turn_on = false;
136
alarm[0]
137
            }
138
        }
139
    }
140
    else if (finish_timer == 8)
141
    {
142
        with (obj_homealone_dess_convo)
143
            interrupt_convo();
144
        with (kris)
145
        {
146
            kris_ready = 0;
147
            visible = 0;
148
        }
149
        var _kris_x = kris.x;
150
        var _kris_y = kris.y;
151
        var _kris_sprite = 5572;
152
        var _emote = 
scr_marker
scr_marker

function
scr_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; } return thismarker; }
(_kris_x + 10, _kris_y - 10, spr_exc);
153
        
scr_doom
scr_doom

function
scr_doom(arg0 = id, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; persistent = arg0.persistent; } }
(_emote, 31);
154
        with (closet)
155
        {
156
            kris_sprite = _kris_sprite;
157
            kris_x = _kris_x;
158
            kris_y = _kris_y;
159
            kris_active = true;
160
            
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; }
("kris_index", 0, 2, 6);
161
        }
162
        finish_con = 1;
163
        scr_delay_var("finish_con", 5, 31);
164
    }
165
    if (finish_con == 5)
166
    {
167
        if (closet.kris_x != 232)
168
        {
169
            with (closet)
170
            {
171
                kris_sprite = spr_noellehouse_dess_kris_walk_right;
172
                kris_anim_speed = 0.2;
173
                kris_x = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(kris_x, 232, 6);
174
            }
175
        }
176
        else
177
        {
178
            finish_con = 6;
179
        }
180
    }
181
    if (finish_con == 6)
182
    {
183
        finish_con = 7;
184
        scr_delay_var("finish_con", 8, 45);
185
        with (closet)
186
        {
187
            kris_sprite = spr_noellehouse_dess_kris_hockey_swing;
188
            kris_index = 0;
189
            kris_anim_speed = 0;
190
            scr_delay_var("kris_index", 1, 20);
191
            
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; }
(scr_lerpvar, 20, "kris_y", kris_y, kris_y - 30, 12, 3, "out");
192
            
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; }
(scr_lerpvar, 20, "kris_x", kris_x, kris_x + 10, 12, 3, "out");
193
        }
194
        with (obj_noellehouse_dess_closet)
195
            
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; }
(scr_lerpvar, 24, "door_alpha", 0, 1, 6);
196
        with (obj_homealone_vent_overlay)
197
            scr_delay_var("dess_closet_alpha_target", 0.5, 16);
198
    }
199
    if (finish_con == 8)
200
    {
201
        finish_con = -1;
202
        with (obj_noellehouse_dess)
203
            con = 50;
204
    }
205
}