Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_npc_doctor_Step_0

(view raw script w/o annotations or w/e)
1
event_inherited();
2
if (interact == true)
3
    interact_hold = true;
4
var gold_missing_check = false;
5
if (interact_hold == true)
6
{
7
    switch (npc_flag)
8
    {
9
        case 0:
10
            if (scene == 0)
11
            {
12
                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; }
();
13
                scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
14
                with (msg)
15
                {
16
                    ch_msg = 4;
17
                    ch[1] = "Uh...";
18
                    ch[2] = "Hurt";
19
                    talker[0] = other.object_index;
20
                    message[0] = "* Welcome to the Wild East#  Clinic!";
21
                    message[1] = "* We put the \"hospital\" in#  hospitality!";
22
                    message[2] = "* They call me The Doc!";
23
                    message[3] = "* Are you sick? Hurt? ";
24
                    message[4] = "* What is your diagnosis?";
25
                    if (outcome == 1)
26
                        message[5] = "* Ah, a shy one! No problem!";
27
                    if (outcome == 2)
28
                    {
29
                        message[5] = "* Yes of course!";
30
                        message[6] = "* We have a tough one!";
31
                    }
32
                }
33
                if (!global.dialogue_open)
34
                    scene++;
35
            }
36
            else if (scene == 1)
37
            {
38
                scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
39
                with (msg)
40
                {
41
                    ch_msg = 3;
42
                    ch[1] = "Deal";
43
                    ch[2] = "No thanks";
44
                    talker[0] = other.object_index;
45
                    message[0] = "* I have just the boost you need!";
46
                    message[1] = "* For an upfront price of 30G I#  can OVERCHARGE your health!";
47
                    message[2] = "* It is an... experimental#  medicine but who said#  I was qualified?";
48
                    message[3] = "* What do you say?";
49
                    if (outcome == 1)
50
                    {
51
                        if (global.player_gold < 30)
52
                        {
53
                            gold_missing_check = true;
54
                            other.interact_hold = false;
55
                            other.npc_flag += 1;
56
                            other.scene = 0;
57
                            global.dialogue_open = false;
58
                            instance_destroy();
59
                        }
60
                        message[4] = "* Come closer and I'll begin the#  procedure!";
61
                    }
62
                    if (outcome == 2)
63
                    {
64
                        message[4] = "* Sorry to hear that!";
65
                        message[5] = "* I'll always be here if you need#  anything!";
66
                        other.interact_hold = false;
67
                        other.npc_flag += 1;
68
                        other.scene = 0;
69
                        global.cutscene = false;
70
                    }
71
                }
72
                if (!global.dialogue_open)
73
                    scene++;
74
            }
75
            else if (scene == 2)
76
            {
77
                scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
78
                with (msg)
79
                {
80
                    talker[0] = other.object_index;
81
                    message[0] = "* Mhm, I see.";
82
                    message[1] = "* Little bit of this...";
83
                    message[2] = "* Aaaand done!";
84
                    message[3] = "* (You gained +15 extra HP!)";
85
                    message[4] = "* When the energy wears off, it's#  gone for good!";
86
                    message[5] = "* You can always visit me again#  for more but only one at a time!";
87
                    message[6] = "* I might take risks but I'm not#  crazy! Ha ha... Ahem.";
88
                    if (message_current == 3 && global.current_hp_self <= global.max_hp_self)
89
                    {
90
                        audio_play_sound(snd_success, 1, 0);
91
                        global.max_hp_boosted = global.max_hp_self + 15;
92
                        global.current_hp_self = global.max_hp_boosted;
93
                        global.player_gold -= 30;
94
                    }
95
                }
96
                if (!global.dialogue_open)
97
                {
98
                    scene = 0;
99
                    npc_flag += 1;
100
                    interact_hold = false;
101
                    scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
102
                }
103
            }
104
            break;
105
        case 1:
106
            if (global.current_hp_self > global.max_hp_self)
107
            {
108
                scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
109
                with (msg)
110
                {
111
                    talker[0] = other.object_index;
112
                    message[0] = "* Your overcharge needs to#  deplete before I can do another#  procedure!";
113
                }
114
                interact_hold = false;
115
            }
116
            else
117
            {
118
                scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
119
                with (msg)
120
                {
121
                    ch_msg = 1;
122
                    ch[1] = "Yes";
123
                    ch[2] = "No thanks";
124
                    talker[0] = other.object_index;
125
                    message[0] = "* Hello again!";
126
                    message[1] = "* Need a boost?";
127
                    if (outcome == 1)
128
                    {
129
                        if (global.player_gold < 30)
130
                        {
131
                            gold_missing_check = true;
132
                            other.interact_hold = false;
133
                            instance_destroy();
134
                        }
135
                        message[2] = "* Alright! Let's begin!";
136
                        message[3] = "* Little bit of this...";
137
                        message[4] = "* Aaaand done!";
138
                        message[5] = "* (You gained +15 extra HP!)";
139
                        message[6] = "* Thank you! Come again soon!";
140
                    }
141
                    if (message_current == 5 && global.current_hp_self <= global.max_hp_self)
142
                    {
143
                        audio_play_sound(snd_success, 1, 0);
144
                        global.current_hp_self = global.max_hp_self + 15;
145
                        global.player_gold -= 30;
146
                        other.interact_hold = false;
147
                    }
148
                    if (outcome == 2)
149
                    {
150
                        message[2] = "* Sorry to hear that!";
151
                        message[3] = "* I'll always be here if you need#  anything!";
152
                    }
153
                }
154
                if (!global.dialogue_open)
155
                    interact_hold = false;
156
            }
157
            break;
158
    }
159
}
160
if (gold_missing_check == true)
161
{
162
    global.cutscene = false;
163
    scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
164
    with (msg)
165
    {
166
        talker[0] = other.object_index;
167
        message[0] = "* I'm going to need the exact#  payment, sorry!";
168
        message[1] = "* Gotta keep the doors open#  somehow!";
169
    }
170
}