Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_snowcastle_Step_0

(view raw script w/o annotations or w/e)
1
if (live_call())
2
    return global.live_result;
3
depth = -y;
4
interact = 0;
5
if (keyboard_multicheck_pressed(0) && scr_interact
scr_interact

function scr_interact() { if (distance_to_object(obj_pl) < 20 && obj_pl.state == scr_normal_state) { var pl_dir = obj_pl.direction; var pl_x = 0; var pl_y = 0; var check_distance_x = 0; var check_distance_y = 0; switch (pl_dir) { case 0: pl_x = obj_pl.bbox_right; pl_y = obj_pl.bbox_top + 1; check_distance_x = 20; break; case 180: pl_x = obj_pl.bbox_left; pl_y = obj_pl.bbox_top + 1; check_distance_x = -20; break; case 90: pl_x = obj_pl.x; pl_y = obj_pl.bbox_top; check_distance_y = -20; break; case 270: pl_x = obj_pl.x; pl_y = obj_pl.bbox_bottom; check_distance_y = 20; break; } if (collision_line_first(pl_x, pl_y, pl_x + check_distance_x, pl_y + check_distance_y, id, false, false)) return true; } }
() == true)
6
    interact = 1;
7
if (instance_exists(obj_dialogue) && is_talking == true)
8
{
9
    if (obj_dialogue.cutoff == string_length(obj_dialogue.message[obj_dialogue.message_current]))
10
    {
11
        image_speed = 0;
12
        image_index = 0;
13
    }
14
    else
15
    {
16
        image_speed = 0.2;
17
    }
18
}
19
else
20
{
21
    image_speed = 0;
22
    is_talking = false;
23
}
24
if (ds_map_find_value(global.npc_map, npc_id) != npc_flag)
25
    ds_map_replace(global.npc_map, npc_id, npc_flag);
26
if (interact)
27
    snow_cutscene = true;
28
if (snow_cutscene)
29
{
30
    if (npc_flag == 0)
31
    {
32
        switch (scene)
33
        {
34
            case 0:
35
                scr_cutscene_start
scr_cutscene_start

function scr_cutscene_start() { global.cutscene = true; obj_pl.state = scr_frozen_state; obj_pl.image_index = 0; obj_pl.image_speed = 0; }
();
36
                scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
37
                with (msg)
38
                {
39
                    message[0] = "* (It's a snowcastle!#* How... cute?)";
40
                    message[1] = "* (You open the doors.)";
41
                }
42
                if (global.dialogue_open == false)
43
                {
44
                    audio_play_sound(snd_snowcastle_door_1, 1, 0);
45
                    scene++;
46
                }
47
                break;
48
            case 1:
49
                image_speed = 0.4;
50
                if (image_index >= 12)
51
                {
52
                    image_speed = 0;
53
                    scene++;
54
                }
55
                break;
56
            case 2:
57
                npc_flag += 1;
58
                scene = 0;
59
                scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
60
                snow_cutscene = false;
61
                break;
62
        }
63
    }
64
    else if (npc_flag == 1)
65
    {
66
        switch (scene)
67
        {
68
            case 0:
69
                scr_cutscene_start
scr_cutscene_start

function scr_cutscene_start() { global.cutscene = true; obj_pl.state = scr_frozen_state; obj_pl.image_index = 0; obj_pl.image_speed = 0; }
();
70
                scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
71
                with (msg)
72
                    message[0] = "* (You open the drawbridge.)";
73
                if (global.dialogue_open == false)
74
                {
75
                    audio_play_sound(snd_snowcastle_door_2, 1, 0);
76
                    scene++;
77
                }
78
                break;
79
            case 1:
80
                image_speed = 0.4;
81
                if (image_index >= (image_number - 1))
82
                {
83
                    image_index = image_number - 1;
84
                    image_speed = 0;
85
                    scene++;
86
                }
87
                break;
88
            case 2:
89
                scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
90
                scene = 0;
91
                npc_flag += 1;
92
                snow_cutscene = false;
93
                break;
94
        }
95
    }
96
    else if (npc_flag == 2)
97
    {
98
        scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
99
        with (msg)
100
            message[0] = "* (Your head hurts too much to#  keep going.)";
101
        if (global.dialogue_open == false)
102
        {
103
            npc_flag = 3;
104
            snow_cutscene = false;
105
        }
106
    }
107
    else if (npc_flag == 3)
108
    {
109
        scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
110
        with (msg)
111
            message[0] = "* (It's a snowcastles.)";
112
        if (global.dialogue_open == false)
113
            snow_cutscene = false;
114
    }
115
}