Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_steamworks_manta_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
switch manta_state
4
{
5
    case 0:
6
        if (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; } }
() && keyboard_multicheck_pressed(0))
7
            manta_prompt = true
8
        if (manta_prompt == true)
9
        {
10
            scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
11
            with (msg)
12
            {
13
                message[0] = "* (Take a ride?)"
14
                ch_msg = 0
15
                ch[1] = "Yes"
16
                ch[2] = "No"
17
                if (outcome == 1)
18
                {
19
                    with (other)
20
                        scr_follower_into_actor
scr_follower_into_actor

function scr_follower_into_actor() //gml_Script_scr_follower_into_actor { if (global.party_member == noone) return false; actor_follower = instance_create(global.party_member.x, global.party_member.y, global.party_member.npc_actor) with (global.party_member) { switch sprite_index { case up_sprite: case up_sprite_idle: case up_sprite_run: other.actor_follower.npc_direction = "up" other.actor_follower.sprite_index = other.actor_follower.up_sprite break case down_sprite: case down_sprite_idle: case down_sprite_run: other.actor_follower.npc_direction = "down" other.actor_follower.sprite_index = other.actor_follower.down_sprite break case left_sprite: case left_sprite_idle: case left_sprite_run: other.actor_follower.npc_direction = "left" other.actor_follower.sprite_index = other.actor_follower.left_sprite break case right_sprite: case right_sprite_idle: case right_sprite_run: other.actor_follower.sprite_index = other.actor_follower.right_sprite break } instance_destroy() } return true; }
()
21
                    instance_create(obj_pl.x, obj_pl.y, obj_player_npc)
22
                    other.manta_state = 2
23
                }
24
                else if (outcome == 2)
25
                    other.manta_state = 0
26
                if (outcome != 0)
27
                    other.manta_prompt = false
28
            }
29
        }
30
        if (manta_has_passengers == true)
31
        {
32
            if (arrows_alpha < 1)
33
                arrows_alpha += 0.25
34
            if (arrows_alpha > 0.35)
35
            {
36
                if global.down_keyp
37
                    move_in_direction = "down"
38
                else if global.up_keyp
39
                    move_in_direction = "up"
40
                else if global.right_keyp
41
                    move_in_direction = "right"
42
                else if global.left_keyp
43
                    move_in_direction = "left"
44
            }
45
        }
46
        break
47
    case 1:
48
        if (!audio_is_playing(snd_manta_sail))
49
            audio_play_sound(snd_manta_sail, 1, 0)
50
        var check_distance = 40
51
        var hor_dir = (sprite_index == (spr_steamworks_manta_right - sprite_index)) == 1344
52
        var ver_dir = (sprite_index == (spr_steamworks_manta_down - sprite_index)) == 1341
53
        var checkpoint = collision_line(x, y, (x + hor_dir * check_distance), (y + ver_dir * check_distance), obj_steamworks_manta_checkpoint, false, true)
54
        if (checkpoint != noone && checkpoint.active == false)
55
        {
56
            if (x < (checkpoint.x + 4) && x > (checkpoint.x - 4) && y < (checkpoint.y + 4) && y > (checkpoint.y - 4))
57
            {
58
                hspeed_current = 0
59
                vspeed_current = 0
60
                hspeed_decc = 0
61
                vspeed_decc = 0
62
                manta_state = 0
63
                audio_play_sound(snd_manta_stop_go, 1, 0)
64
                x = checkpoint.x
65
                y = checkpoint.y
66
                checkpoint.active = true
67
            }
68
            up_free = checkpoint.mpoint_up_free
69
            down_free = checkpoint.mpoint_down_free
70
            left_free = checkpoint.mpoint_left_free
71
            right_free = checkpoint.mpoint_right_free
72
            can_dock = checkpoint.mpoint_can_dock
73
            dock_x = checkpoint.mpoint_dock_xx
74
            dock_y = checkpoint.mpoint_dock_yy
75
        }
76
        if (arrows_alpha > 0)
77
            arrows_alpha -= 0.3
78
        break
79
    case 2:
80
        if (manta_get_on_noloop == false)
81
        {
82
            audio_play_sound(snd_manta_startup, 1, 0)
83
            manta_get_on_noloop = true
84
        }
85
        switch manta_dir
86
        {
87
            case 0:
88
                var end_dir = "right"
89
                var plx = x + 5
90
                var ply = y - 15
91
                var npcx = x - 10
92
                var npcy = y - 15
93
                break
94
            case 90:
95
                end_dir = "up"
96
                plx = x
97
                ply = y - 10
98
                npcx = x
99
                npcy = y
100
                break
101
            case 180:
102
                end_dir = "left"
103
                plx = x - 5
104
                ply = y - 15
105
                npcx = x + 10
106
                npcy = y - 15
107
                break
108
            case 270:
109
                end_dir = "down"
110
                plx = x
111
                ply = y
112
                npcx = x
113
                npcy = y - 10
114
                break
115
        }
116
117
        if (abs(obj_player_npc.x - x) > abs(obj_player_npc.y - y))
118
            var dir_prio = "y"
119
        else
120
            dir_prio = "x"
121
        var follower_arrived = false
122
        if (global.party_member != -4)
123
        {
124
            cutscene_npc_walk(actor_follower, npcx, npcy, 3, dir_prio, end_dir)
125
            if (actor_follower.x == npcx && actor_follower.y == npcy)
126
                follower_arrived = true
127
        }
128
        if (scr_camera_move
scr_camera_move

function scr_camera_move(argument0, argument1, argument2) //gml_Script_scr_camera_move { if (!instance_exists(obj_camera)) { instance_create(__view_get((9 << 0), 0).x, __view_get((9 << 0), 0).y, obj_camera) __view_set((9 << 0), 0, 1120) } else { obj_camera.x = __view_get((9 << 0), 0).x obj_camera.y = __view_get((9 << 0), 0).y __view_set((9 << 0), 0, 1120) } obj_camera.move = true obj_camera.xx = argument0 obj_camera.yy = argument1 obj_camera.spd = argument2 if (abs(argument0 - obj_camera.x) <= argument2 && abs(argument1 - obj_camera.y) <= argument2) return true; else return false; }
(x, y, 3) && cutscene_npc_walk(1168, plx, ply, 3, dir_prio, end_dir))
129
        {
130
            if (global.party_member != -4 && follower_arrived == false)
131
                return;
132
            instance_destroy(obj_player_npc)
133
            manta_state = 0
134
            manta_has_passengers = true
135
            __view_set((9 << 0), 0, id)
136
        }
137
        checkpoint = instance_nearest(x, y, obj_steamworks_manta_checkpoint)
138
        if (checkpoint != noone)
139
        {
140
            up_free = checkpoint.mpoint_up_free
141
            down_free = checkpoint.mpoint_down_free
142
            left_free = checkpoint.mpoint_left_free
143
            right_free = checkpoint.mpoint_right_free
144
            can_dock = checkpoint.mpoint_can_dock
145
            dock_x = checkpoint.mpoint_dock_xx
146
            dock_y = checkpoint.mpoint_dock_yy
147
        }
148
        break
149
    case 3:
150
        if (global.sworks_flag[5] < 2 && room == rm_steamworks_19)
151
        {
152
            scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
153
            with (msg)
154
            {
155
                if (global.route == 2)
156
                {
157
                    sndfnt_array[0] = 391
158
                    sndfnt_array[1] = 108
159
                    sndfnt_array[2] = 108
160
                    sndfnt_array[3] = 391
161
                    message[0] = "* You h-ave reached your#  destination-bzzt."
162
                    message[1] = "* Thanks for the help."
163
                    message[2] = "* Let's keep moving,#  Clover."
164
                    message[3] = "* If you need another#  r-ride, I'll be#  here......bzzt."
165
                    prt[1] = 377
166
                    prt[2] = 370
167
                }
168
                else
169
                {
170
                    message[0] = "* You h-ave reached your#  destination-bzzt."
171
                    message[1] = "* If you need another#  r-ride, I'll be#  here......bzzt."
172
                }
173
            }
174
            global.sworks_flag[5] = 2
175
        }
176
        if global.dialogue_open
177
            return;
178
        if (!instance_exists(obj_player_npc))
179
            instance_create(obj_pl.x, obj_pl.y, obj_player_npc)
180
        follower_arrived = true
181
        if (global.party_member != -4)
182
        {
183
            follower_arrived = false
184
            cutscene_npc_walk(actor_follower, dock_x, dock_y, 3, "x", obj_player_npc.npc_direction)
185
            if (actor_follower.x == dock_x && actor_follower.y == dock_y)
186
                follower_arrived = true
187
        }
188
        if (scr_camera_move
scr_camera_move

function scr_camera_move(argument0, argument1, argument2) //gml_Script_scr_camera_move { if (!instance_exists(obj_camera)) { instance_create(__view_get((9 << 0), 0).x, __view_get((9 << 0), 0).y, obj_camera) __view_set((9 << 0), 0, 1120) } else { obj_camera.x = __view_get((9 << 0), 0).x obj_camera.y = __view_get((9 << 0), 0).y __view_set((9 << 0), 0, 1120) } obj_camera.move = true obj_camera.xx = argument0 obj_camera.yy = argument1 obj_camera.spd = argument2 if (abs(argument0 - obj_camera.x) <= argument2 && abs(argument1 - obj_camera.y) <= argument2) return true; else return false; }
(dock_x, dock_y, 3) && cutscene_npc_walk(1168, dock_x, dock_y, 3, "x", obj_player_npc.npc_direction) && follower_arrived == true)
189
        {
190
            manta_state = 0
191
            move_in_direction = "none"
192
            manta_has_passengers = false
193
            __view_set((9 << 0), 0, 1031)
194
            instance_destroy(obj_player_npc)
195
            scr_actor_into_follower
scr_actor_into_follower

function scr_actor_into_follower(argument0, argument1) //gml_Script_scr_actor_into_follower { if (!instance_exists(argument0)) return false; if (argument1 == noone) return false; instance_create(argument0.x, argument0.y, argument1) argument1.x = argument0.x argument1.y = argument0.y with (argument0) { switch npc_direction { case "up": argument1.sprite_index = argument1.up_sprite_idle break case "down": argument1.sprite_index = argument1.down_sprite_idle break case "left": argument1.sprite_index = argument1.left_sprite_idle break case "right": argument1.sprite_index = argument1.right_sprite_idle break } } instance_destroy(argument0) }
(obj_ceroba_npc, obj_ceroba_follower)
196
            scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() //gml_Script_scr_cutscene_end { global.cutscene = false obj_pl.alarm[0] = 1 }
()
197
        }
198
        if (arrows_alpha > 0)
199
            arrows_alpha -= 0.3
200
        break
201
}
202
203
if (move_in_direction != "none" && hspeed_current == 0 && vspeed_current == 0)
204
{
205
    var can_move = false
206
    var pl_xx = 0
207
    var pl_yy = 0
208
    var fl_xx = 0
209
    var fl_yy = 0
210
    if (can_dock == move_in_direction)
211
    {
212
        manta_state = 3
213
        return;
214
    }
215
    else
216
    {
217
        switch move_in_direction
218
        {
219
            case "right":
220
                if right_free
221
                {
222
                    can_move = true
223
                    pl_xx = x + 5
224
                    pl_yy = y - 15
225
                    fl_xx = x - 10
226
                    fl_yy = y - 15
227
                    manta_dir = 0
228
                    hspeed_current = manta_speed
229
                    sprite_index = spr_steamworks_manta_right
230
                    break
231
                }
232
                else
233
                {
234
                    can_move = false
235
                    break
236
                }
237
            case "left":
238
                if left_free
239
                {
240
                    can_move = true
241
                    pl_xx = x - 5
242
                    pl_yy = y - 15
243
                    fl_xx = x + 10
244
                    fl_yy = y - 15
245
                    manta_dir = 180
246
                    hspeed_current = (-manta_speed)
247
                    sprite_index = spr_steamworks_manta_left
248
                    break
249
                }
250
                else
251
                {
252
                    can_move = false
253
                    break
254
                }
255
            case "up":
256
                if up_free
257
                {
258
                    can_move = true
259
                    pl_xx = x
260
                    pl_yy = y - 10
261
                    fl_xx = x
262
                    fl_yy = y - 5
263
                    manta_dir = 90
264
                    vspeed_current = (-manta_speed)
265
                    sprite_index = spr_steamworks_manta_up
266
                    break
267
                }
268
                else
269
                {
270
                    can_move = false
271
                    break
272
                }
273
            case "down":
274
                if down_free
275
                {
276
                    can_move = true
277
                    pl_xx = x
278
                    pl_yy = y
279
                    fl_xx = x
280
                    fl_yy = y - 10
281
                    manta_dir = 270
282
                    vspeed_current = manta_speed
283
                    sprite_index = spr_steamworks_manta_down
284
                    break
285
                }
286
                else
287
                {
288
                    can_move = false
289
                    break
290
                }
291
        }
292
293
    }
294
    if (manta_has_passengers == true)
295
    {
296
        if (can_move == true)
297
        {
298
            audio_play_sound(snd_confirm, 1, 0)
299
            obj_pl.x = pl_xx
300
            obj_pl.y = pl_yy
301
            obj_pl.direction = manta_dir
302
            obj_pl.depth = depth - 1
303
            if (global.party_member != -4)
304
            {
305
                actor_follower.x = fl_xx
306
                actor_follower.y = fl_yy
307
                actor_follower.depth = depth - 1
308
                if (manta_dir == 0)
309
                    actor_follower.npc_direction = "right"
310
                else if (manta_dir == 90)
311
                    actor_follower.npc_direction = "up"
312
                else if (manta_dir == 180)
313
                    actor_follower.npc_direction = "left"
314
                else if (manta_dir == 270)
315
                    actor_follower.npc_direction = "down"
316
                with (actor_follower)
317
                    event_perform(ev_step, ev_step_normal)
318
            }
319
            with (obj_pl)
320
                event_perform(ev_step, ev_step_normal)
321
            var arrow_size_multiply = 1.5
322
            if (manta_dir == 0)
323
                arrow_size[3] = arrow_size_multiply
324
            else if (manta_dir == 90)
325
                arrow_size[0] = arrow_size_multiply
326
            else if (manta_dir == 180)
327
                arrow_size[2] = arrow_size_multiply
328
            else if (manta_dir == 270)
329
                arrow_size[1] = arrow_size_multiply
330
        }
331
        else
332
        {
333
            audio_play_sound(snd_fail, 1, 0)
334
            move_in_direction = "none"
335
            return;
336
        }
337
    }
338
    move_in_direction = "none"
339
    manta_state = 1
340
    audio_play_sound(snd_manta_stop_go, 1, 0)
341
}
342
if (manta_has_passengers == true)
343
{
344
    obj_pl.hspeed = hspeed_current
345
    obj_pl.vspeed = vspeed_current
346
    obj_pl.direction = manta_dir
347
    if (global.party_member != -4)
348
    {
349
        actor_follower.hspeed = other.hspeed_current
350
        actor_follower.vspeed = other.vspeed_current
351
    }
352
}
353
hspeed = hspeed_current
354
vspeed = vspeed_current
355
if (hspeed_current == 0 && vspeed_current == 0)
356
{
357
    var new_sprite = -1
358
    switch manta_dir
359
    {
360
        case 0:
361
            new_sprite = spr_steamworks_manta_right_idle
362
            break
363
        case 90:
364
            new_sprite = spr_steamworks_manta_up_idle
365
            break
366
        case 180:
367
            new_sprite = spr_steamworks_manta_left_idle
368
            break
369
        case 270:
370
            new_sprite = spr_steamworks_manta_down_idle
371
            break
372
    }
373
374
    if (sprite_index != new_sprite)
375
        sprite_index = new_sprite
376
}
377
for (var i = 0; i < array_length_1d(arrow_size); i++)
378
{
379
    if (arrow_size[i] > 1)
380
        arrow_size[i] -= 0.05
381
    var color_mult = (arrow_size[i] - 1) / 0.5
382
    arrow_color[i] = make_colour_rgb(255, 255, (255 - color_mult * 255))
383
}
384
if (manta_get_on_noloop == true && manta_state != 2)
385
    manta_get_on_noloop = false
386
if (manta_state != 1 && audio_is_playing(snd_manta_sail))
387
    audio_stop_sound(snd_manta_sail)
388
arrows_frame += 0.25
389
if (arrows_frame >= 5)
390
    arrows_frame = 0