Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_crystal_tree_Step_0

(view raw script w/o annotations or w/e)
1
depth = -y;
2
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 && waiter == 0 && !instance_exists(obj_dialogue))
3
{
4
    if (global.snowdin_flag[4] == 0)
5
    {
6
        waiter = 1;
7
        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; }
();
8
        audio_play_sound(snd_snowdin_crystal_tree, 20, 0);
9
        image_speed = 0.35;
10
    }
11
    else if (global.snowdin_flag[4] == 1)
12
    {
13
        waiter = 3;
14
    }
15
    else if (global.snowdin_flag[4] == 2)
16
    {
17
        scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
18
        with (msg)
19
        {
20
            sndfnt = 99;
21
            portrait = false;
22
            if (global.route == 3)
23
                message[0] = "* (It's a tree. Nothing special.)";
24
            message[0] = "* (An old and fragile tree.)";
25
        }
26
        waiter = 2;
27
    }
28
}
29
if (waiter == 1)
30
{
31
    if (image_index >= (image_number - 1))
32
    {
33
        image_speed = 0;
34
        waiter = 2;
35
    }
36
}
37
if (waiter == 2 && !instance_exists(obj_dialogue))
38
{
39
    scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
40
    if (global.snowdin_flag[4] == 0)
41
        global.snowdin_flag[4] = 1;
42
    waiter = 0;
43
}
44
if (waiter == 3)
45
{
46
    scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
47
    with (msg)
48
    {
49
        sndfnt = 99;
50
        portrait = false;
51
        message[0] = "* (Take the Ice Pellets?)";
52
        ch_msg = 0;
53
        ch[1] = "Yes";
54
        ch[2] = "No";
55
        if (outcome == 1 && message_current == 0)
56
        {
57
            if (scr_item
scr_item

function scr_item(arg0) { nm = arg0; for (var i = 1; i <= 8; i++) { if (global.item_slot[i] == "Nothing") { global.item_slot[i] = nm; return true; break; } else if (i == 8) { return false; } } }
("Ice Pellets"))
58
            {
59
                global.snowdin_flag[4] = 2;
60
                message[1] = "* (Obtained Ice Pellets!)";
61
                other.sprite_index = spr_crystal_tree_no_pellets_snowdin_yellow;
62
            }
63
            else
64
            {
65
                audio_play_sound(snd_fail, 10, 0);
66
                message[1] = "* (Not enough space.)";
67
            }
68
            other.waiter = 2;
69
        }
70
        if (outcome == 2 && message_current == 0)
71
        {
72
            other.waiter = 2;
73
            global.dialogue_open = false;
74
        }
75
    }
76
}