Undertale script viewer

← back to main script listing

gml_Object_obj_undynea_chaser_Step_0

(view raw script w/o annotations or w/e)
1
global.flag[17 menu_disabled] = 1;
2
if (STOPPER == 0)
3
{
4
    if (d == 0)
5
        scr_depth
scr_depth

depth = 50000 - ((y * 10) + (sprite_height * 10));
();
6
    if (fun == 0)
7
    {
8
        myinteract = 0;
9
        if (speed == 0)
10
        {
11
            image_index = 0;
12
            image_speed = 0;
13
        }
14
        if (speed > 0)
15
        {
16
            image_speed = 0.2;
17
            if (image_index == 1 || image_index == 3)
18
                snd_play(snd_undynestep);
19
        }
20
    }
21
    if (fun == 3)
22
    {
23
        if (image_index == 1 || image_index == 3)
24
            snd_play(snd_undynestep);
25
    }
26
    if (con == 0)
27
    {
28
        alarm[4] = 32;
29
        con = 1;
30
        if (new == 1)
31
        {
32
            alarm[4] = 20;
33
            blc = instance_create(999, 999, obj_cosmeticblcon);
34
            new = 0;
35
            con = 3;
36
        }
37
    }
38
    if (con == 2)
39
    {
40
        blc = instance_create(x, y, obj_cosmeticblcon);
41
        snd_play(snd_b);
42
        con = 3;
43
        alarm[4] = 25;
44
    }
45
    if (con == 4 && room != room_fire1)
46
    {
47
        with (blc)
48
            instance_destroy();
49
        spd = 5;
50
        if (global.flag[99 undyne_times_fought] > 3)
51
            spd = 4;
52
        move_towards_point(obj_mainchara.x - 4, obj_mainchara.y - 20, spd);
53
        if (abs(vspeed) > abs(hspeed))
54
        {
55
            if (vspeed < 0)
56
                sprite_index = usprite;
57
            else
58
                sprite_index = dsprite;
59
        }
60
        else if (hspeed < 0)
61
        {
62
            sprite_index = lsprite;
63
        }
64
        else
65
        {
66
            sprite_index = rsprite;
67
        }
68
    }
69
    if (con == 4 && room == room_fire1)
70
    {
71
        with (blc)
72
            instance_destroy();
73
        if (obj_mainchara.x > (x + 20))
74
        {
75
            hspeed = 3;
76
            image_speed = 0.2;
77
            sprite_index = rsprite;
78
        }
79
        if (obj_mainchara.x <= (x + 20))
80
        {
81
            hspeed = -3;
82
            image_speed = 0.2;
83
            sprite_index = lsprite;
84
        }
85
        if (x > 140 && x < 160 && sans == 0)
86
        {
87
            con = 8;
88
            sans = 1;
89
        }
90
    }
91
    if (active == 1 && global.interact == 0)
92
    {
93
        if (collision_rectangle(x + 6, (y + sprite_height) - 20, (x + sprite_width) - 6, (y + sprite_height) - 2, obj_mainchara, 0, 1))
94
        {
95
            speed = 0;
96
            con = 5;
97
        }
98
    }
99
    if (active == 1 && global.interact == 0 && room == room_fire1)
100
    {
101
        if (collision_rectangle(x + 6, y + sprite_height + 60, (x + sprite_width) - 6, (y + sprite_height) - 80, obj_mainchara, 0, 1))
102
        {
103
            speed = 0;
104
            con = 5;
105
        }
106
    }
107
    if (con == 5)
108
    {
109
        alarm[4] = -1;
110
        active = 0;
111
        speed = 0;
112
        global.interact = 1;
113
        con = 6;
114
        global.border = 12;
115
        global.battlegroup = 47;
116
        global.mercy = 1;
117
        instance_create(0, 0, obj_battler);
118
        talkedto = 0;
119
    }
120
    if (con == 6 && global.interact == 0)
121
    {
122
        active = 1;
123
        con = 0;
124
        if (room == room_water_undynefinal)
125
        {
126
            if (obj_mainchara.y > 600)
127
                y = 500;
128
            else
129
                y = 640;
130
            x = 160;
131
        }
132
        if (room == room_water_undynefinal2)
133
        {
134
            if (global.entrance == 1)
135
                y = obj_mainchara.y + 130;
136
            if (global.entrance == 2)
137
                y = obj_mainchara.y - 100;
138
        }
139
        if (room == room_water_undynefinal3)
140
        {
141
            if (global.entrance == 1)
142
                x = obj_mainchara.x - 100;
143
            if (global.entrance == 2)
144
                x = obj_mainchara.x + 100;
145
        }
146
        if (room == room_fire1)
147
        {
148
            if (global.entrance == 1)
149
                x = obj_mainchara.x - 60;
150
            if (global.entrance == 2)
151
                x = obj_mainchara.x + 60;
152
        }
153
        if (global.flag[350 status_undyne] == 1)
154
        {
155
            global.mercy = 0;
156
            caster_free(all);
157
            global.plot = 122;
158
            instance_destroy();
159
        }
160
    }
161
    if (con == 8)
162
    {
163
        hspeed = 0;
164
        con = 9;
165
        alarm[4] = 15;
166
    }
167
    if (con == 10)
168
    {
169
        sprite_index = usprite;
170
        con = 11;
171
        alarm[4] = 30;
172
    }
173
    if (con == 12)
174
    {
175
        sprite_index = spr_undyne_helmet_d_pissed;
176
        image_speed = 0.2;
177
        con = 13;
178
        alarm[4] = 30;
179
    }
180
    if (con == 14)
181
    {
182
        sans = 1;
183
        con = 4;
184
        active = 1;
185
    }
186
    if (con == 20)
187
    {
188
        if (distance_to_object(obj_mainchara) < 60)
189
        {
190
            speed = 0;
191
            image_index = 0;
192
            image_speed = 0;
193
            active = 0;
194
            con = 21;
195
        }
196
    }
197
    if (instance_exists(OBJ_WRITER) == 0 && con == 21)
198
    {
199
        active = 1;
200
        con = 4;
201
    }
202
    if (active == 4)
203
    {
204
        rememberx[i] = x;
205
        remembery[i] = y;
206
        for (i = 60; i > 0; i -= 1)
207
        {
208
            rememberx[i] = rememberx[i - 1];
209
            remembery[i] = remembery[i - 1];
210
        }
211
    }
212
    if (global.flag[350 status_undyne] == 1 && STOPPER == 0)
213
    {
214
        global.mercy = 0;
215
        caster_free(all);
216
        audio_stop_all();
217
        global.plot = 122;
218
        global.interact = 0;
219
        STOPPER = 1;
220
        visible = false;
221
        con = 40;
222
        alarm[4] = 2;
223
    }
224
}
225
if (con == 41)
226
{
227
    global.flag[17 menu_disabled] = 0;
228
    audio_stop_all();
229
    instance_destroy();
230
}