Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_player_cart_Step_2

(view raw script w/o annotations or w/e)
1
palette_index = obj_pl.palette_index;
2
shader_on = obj_pl.shader_on;
3
if (keyboard_multicheck_pressed(0) && scr_interact
scr_interact

function scr_interact() { if (distance_to_object(obj_pl) < 20 && obj_pl.state == 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; } }
() && waiter == 0)
4
    waiter = 1;
5
if (waiter == 1)
6
{
7
    scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
8
    with (msg)
9
    {
10
        sndfnt_array[0] = 391;
11
        message[0] = "* (An empty cart sits#  on the rails.)";
12
        message[1] = "* (Hop in?)";
13
        ch_msg = 1;
14
        ch[1] = "Yes";
15
        ch[2] = "No";
16
        if (outcome == 1)
17
        {
18
            if (global.party_member != -4)
19
            {
20
                message[2] = "* You takin' a ride? No#  worries! I'll catch up!";
21
                prt[2] = 328;
22
                sndfnt_array[2] = 102;
23
            }
24
            other.waiter = 2;
25
            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; }
();
26
        }
27
        if (outcome == 2)
28
        {
29
            global.dialogue_open = false;
30
            other.waiter = 0;
31
        }
32
    }
33
}
34
if (waiter == 2 && !instance_exists(obj_npc_clover_dunes_20))
35
{
36
    obj_pl.image_alpha = 0;
37
    instance_create(obj_pl.x, obj_pl.y, obj_npc_clover_dunes_20);
38
    waiter = 3;
39
}
40
if (waiter == 3)
41
{
42
    if (global.party_member != -4)
43
    {
44
        if (global.dialogue_open)
45
            exit;
46
        with (obj_martlet_follower)
47
        {
48
            if (!instance_exists(obj_martlet_npc))
49
            {
50
                instance_create_depth(x, y, -y, obj_martlet_fly_away_cart);
51
                instance_destroy();
52
            }
53
        }
54
    }
55
    if (!instance_exists(obj_clover_minesjump) && !instance_exists(obj_npc_clover_dunes_20))
56
    {
57
        obj_pl.image_alpha = 0;
58
        sprite_index = spr_player_cart;
59
        if (global.route == 3)
60
            sprite_index = spr_player_cart_geno;
61
        image_speed = 0;
62
        if (room == rm_dunes_22)
63
            image_xscale = -1;
64
        waiter = 0;
65
        alarm[0] = 30;
gml_Object_obj_player_cart_Alarm_0.gml

can_move = true; if (!audio_is_playing(snd_rock_roll)) audio_play_sound(snd_rock_roll, 1, 1);
66
    }
67
}
68
if (can_move)
69
{
70
    image_speed = 0.2;
71
    obj_pl.x = x;
72
    if (room == rm_dunes_20)
73
    {
74
        if (hspeed < 3)
75
            hspeed += 0.05;
76
        if (x > room_width && !alarm[1])
77
            alarm[1] = 15;
gml_Object_obj_player_cart_Alarm_1.gml

trn = instance_create(0, 0, obj_transition); trn.newRoom = 102; instance_destroy();
78
    }
79
    else if (room == rm_dunes_22)
80
    {
81
        if (hspeed > -3)
82
            hspeed -= 0.05;
83
        if (x < 0 && !alarm[1])
84
            alarm[1] = 15;
gml_Object_obj_player_cart_Alarm_1.gml

trn = instance_create(0, 0, obj_transition); trn.newRoom = 102; instance_destroy();
85
    }
86
}