Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_wishing_well_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
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; } }
())
4
    object_is_active = true
5
if (object_is_active == false)
6
    return;
7
var party_member_present_martlet = false
8
if (global.party_member == 1170)
9
    party_member_present_martlet = true
10
if (global.dunes_flag[18] < 2)
11
{
12
    if (party_member_present_martlet == false)
13
    {
14
        scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
15
        with (msg)
16
        {
17
            if (global.dunes_flag[18] == 0)
18
            {
19
                ch_msg = 1
20
                ch[1] = "Yes"
21
                ch[2] = "No"
22
                message[0] = "* (A wishing well with a large#  amount of G inside.)"
23
                message[1] = "* (Take the G?)"
24
                message[2] = "* (You got 5G!)"
25
                message[3] = "* (You also retracted many#  monster wishes.)"
26
                if (outcome == 1)
27
                {
28
                    global.dunes_flag[18] = 1
29
                    global.player_gold += 50
30
                    other.object_is_active = false
31
                    audio_play_sound(snd_success, 1, 0)
32
                }
33
                if (outcome == 2)
34
                {
35
                    global.dialogue_open = false
36
                    other.object_is_active = false
37
                }
38
            }
39
            else if (global.dunes_flag[18] == 1)
40
            {
41
                message[0] = "* (There is only water.)"
42
                other.object_is_active = false
43
            }
44
        }
45
    }
46
    else if (party_member_present_martlet == true && cutscene_event == 0)
47
    {
48
        scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
49
        with (msg)
50
        {
51
            sndfnt = 102
52
            ch_msg = 2
53
            ch[1] = "Yes"
54
            ch[2] = "No"
55
            talker[0] = 1170
56
            message[0] = "* Well well well, what do#  we have here?"
57
            message[1] = "* Aw, I left all my G#  at home."
58
            message[2] = "* Would you lend me one?"
59
            prt[0] = 337
60
            prt[1] = 338
61
            prt[2] = 328
62
            if (outcome == 1)
63
            {
64
                message[3] = "* Thank you!!"
65
                prt[3] = 318
66
                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 }
()
67
                other.cutscene_event = 1
68
            }
69
            if (outcome == 2)
70
            {
71
                message[3] = "* Oh, alright."
72
                message[4] = "* I knew I shoulda grabbed#  some money before#  leaving Snowdin."
73
                prt[3] = 323
74
                prt[4] = 321
75
                other.object_is_active = false
76
            }
77
        }
78
    }
79
    switch cutscene_event
80
    {
81
        case 1:
82
            if global.dialogue_open
83
                return;
84
            with (instance_create(obj_martlet_follower.x, obj_martlet_follower.y, obj_martlet_npc))
85
            {
86
                axis_override = "y"
87
                if (obj_martlet_follower.y < (obj_wishing_well.y + 10))
88
                {
89
                    x_dest[0] = 260
90
                    y_dest[0] = 320
91
                    end_direction = "down"
92
                }
93
                else
94
                {
95
                    x_dest[0] = 260
96
                    y_dest[0] = 360
97
                    end_direction = "up"
98
                }
99
                can_walk = true
100
                walk_collider = -4
101
            }
102
            with (instance_create(obj_pl.x, obj_pl.y, obj_player_npc))
103
            {
104
                if (x > obj_wishing_well.x)
105
                {
106
                    end_direction = "left"
107
                    x_dest[0] = 300
108
                }
109
                else
110
                {
111
                    end_direction = "right"
112
                    x_dest[0] = 220
113
                }
114
                axis_override = "x"
115
                if (obj_martlet_follower.y < (obj_wishing_well.y + 10))
116
                    y_dest[0] = 320
117
                else
118
                    y_dest[0] = 360
119
                can_walk = true
120
                walk_collider = -4
121
            }
122
            obj_martlet_follower.image_alpha = 0
123
            cutscene_event++
124
            break
125
        case 2:
126
            if (obj_martlet_npc.npc_arrived && obj_player_npc.npc_arrived)
127
            {
128
                timer = 20
129
                cutscene_event++
130
            }
131
            break
132
        case 3:
133
            if (!scr_timer
scr_timer

function scr_timer() //gml_Script_scr_timer { if (timer > 0) { timer-- return false; } else return true; }
())
134
                return;
135
            scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
136
            with (msg)
137
            {
138
                sndfnt = 102
139
                talker[0] = 1164
140
                message[0] = "* Hmmm..."
141
                message[1] = "* I wish..."
142
                message[2] = "* That Clover will make it#  back home safely!"
143
                prt[0] = 338
144
                prt[1] = 321
145
                prt[2] = 313
146
            }
147
            if (!global.dialogue_open)
148
            {
149
                cutscene_event++
150
                timer = 20
151
            }
152
            break
153
        case 4:
154
            if (!scr_timer
scr_timer

function scr_timer() //gml_Script_scr_timer { if (timer > 0) { timer-- return false; } else return true; }
())
155
                return;
156
            cutscene_event++
157
            timer = 30
158
            audio_play_sound(snd_splash, 1, 0)
159
            break
160
        case 5:
161
            if (!scr_timer
scr_timer

function scr_timer() //gml_Script_scr_timer { if (timer > 0) { timer-- return false; } else return true; }
())
162
                return;
163
            scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
164
            with (msg)
165
            {
166
                sndfnt = 102
167
                talker[0] = 1164
168
                message[0] = "* Now you have me, AND a#  wish on your side!"
169
                prt[0] = 312
170
            }
171
            if (obj_pl.x < obj_martlet_npc.x)
172
                obj_martlet_npc.npc_direction = "left"
173
            else
174
                obj_martlet_npc.npc_direction = "right"
175
            obj_pl.direction = 0
176
            cutscene_event++
177
            break
178
        case 6:
179
            if (!global.dialogue_open)
180
            {
181
                global.dunes_flag[18] = 2
182
                obj_pl.image_alpha = 1
183
                with (obj_martlet_follower)
184
                {
185
                    image_alpha = 1
186
                    x = obj_martlet_npc.x
187
                    y = obj_martlet_npc.y
188
                    direction = 180
189
                    npc_reset = true
190
                }
191
                object_is_active = false
192
                scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() //gml_Script_scr_cutscene_end { global.cutscene = false obj_pl.alarm[0] = 1 }
()
193
                instance_destroy(obj_martlet_npc)
194
                instance_destroy(obj_player_npc)
195
            }
196
            break
197
    }
198
199
}
200
else if (global.dunes_flag[18] >= 2)
201
{
202
    scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
203
    with (msg)
204
        message[0] = "* (A wishing well with a large#  amount of G inside.)"
205
    object_is_active = false
206
}