Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_swing_interact_Step_0

(view raw script w/o annotations or w/e)
1
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; } }
())
2
    scene = 1
3
if (scene == 1)
4
{
5
    scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
6
    with (msg)
7
    {
8
        message[0] = "* (It's an empty swing.)"
9
        if (global.route != 3)
10
        {
11
            message[1] = "* (Hop on?)"
12
            ch_msg = 1
13
            ch[1] = "Yes"
14
            ch[2] = "No"
15
            if (outcome == 1)
16
            {
17
                other.npc_clover = instance_create(obj_pl.x, obj_pl.y, obj_player_npc)
18
                with (other.npc_clover)
19
                {
20
                    x_dest[0] = 479
21
                    y_dest[0] = 407
22
                    can_walk = true
23
                    depth = 0
24
                }
25
                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 }
()
26
                other.scene = 2
27
            }
28
            if (outcome == 2)
29
            {
30
                other.scene = 0
31
                global.dialogue_open = false
32
            }
33
        }
34
        else
35
            other.scene = 0
36
    }
37
}
38
if (scene == 2)
39
{
40
    if (npc_clover.npc_arrived == true)
41
    {
42
        npc_clover.action_sprite = true
43
        npc_clover.sprite_index = spr_pl_run_down
44
        npc_clover.image_index = 1
45
        npc_clover.image_speed = 0
46
        with (npc_clover)
47
            path_start(pt_clover_jump_swing, 2, path_action_stop, false)
48
        audio_play_sound(snd_playerjump, 1, 0)
49
        scene = 3
50
    }
51
}
52
if (scene > 3 && scene <= 5)
53
    npc_clover.depth = -1000
54
if (scene == 3)
55
{
56
    alarm[0] = 120
alarm[0]

if instance_exists(obj_player_npc) obj_player_npc.image_speed = 0.2
57
    with (npc_clover)
58
    {
59
        if (path_position >= 0.5)
60
            depth = -1000
61
        if (path_position == 1)
62
        {
63
            sprite_index = spr_clover_sitting
64
            image_index = 0
65
            image_speed = 0
66
            audio_sound_gain(obj_radio.current_song, 0, 800)
67
            other.timer = 120
68
            other.scene++
69
        }
70
    }
71
}
72
if (scene == 4)
73
{
74
    if (keyboard_multicheck_pressed(0) || keyboard_multicheck_pressed(0))
75
    {
76
        alarm[0] = -1
alarm[0]

if instance_exists(obj_player_npc) obj_player_npc.image_speed = 0.2
77
        scene++
78
        npc_clover.sprite_index = spr_pl_run_down
79
        npc_clover.image_index = 1
80
        npc_clover.image_speed = 0
81
        with (npc_clover)
82
            path_start(pt_clover_jump_off_swing, 2, path_action_stop, false)
83
        audio_play_sound(snd_playerjump, 1, 0)
84
    }
85
}
86
if (scene == 5)
87
{
88
    if (npc_clover.path_position == 1)
89
    {
90
        obj_pl.image_alpha = 1
91
        instance_destroy(npc_clover)
92
        audio_sound_gain(obj_radio.current_song, 1, 800)
93
        timer = 15
94
        scene++
95
    }
96
}
97
if (scene == 6)
98
{
99
    if scr_timer
scr_timer

function scr_timer() //gml_Script_scr_timer { if (timer > 0) { timer-- return false; } else return true; }
()
100
    {
101
        scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() //gml_Script_scr_cutscene_end { global.cutscene = false obj_pl.alarm[0] = 1 }
()
102
        with (obj_kanakofriend)
103
        {
104
            if (npc_flag == 1)
105
                npc_flag = 2
106
        }
107
        scene = 0
108
    }
109
}