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() //gml_Script_scr_interact { if (distance_to_object(obj_pl) < 20 && obj_pl.state == gml_Script_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() //gml_Script_scr_cutscene_start { global.cutscene = true obj_pl.state = gml_Script_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
        waiter = 3
13
    else if (global.snowdin_flag[4] == 2)
14
    {
15
        scr_text
scr_text

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

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

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

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