Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_cutscene_npc_walk_wait

(view raw script w/o annotations or w/e)
1
function cutscene_npc_walk_wait()
2
{
3
    if (!instance_exists(argument[0]))
4
        exit;
5
    with (argument[0])
6
    {
7
        if (distance_to_object(obj_pl) > 80)
8
        {
9
            can_walk = false;
10
            is_walking = false;
11
            if (walk_axis == "x")
12
            {
13
                if (x < obj_pl.x)
14
                    npc_direction = "right";
15
                else
16
                    npc_direction = "left";
17
            }
18
            else if (y < obj_pl.y)
19
            {
20
                npc_direction = "down";
21
            }
22
            else
23
            {
24
                npc_direction = "up";
25
            }
26
        }
27
        else if (distance_to_object(obj_pl) < 50)
28
        {
29
            can_walk = true;
30
        }
31
        if (x_dest[0] != argument[1] || y_dest[0] != argument[2])
32
        {
33
            x_dest = 0;
34
            y_dest = 0;
35
            x_dest[0] = argument[1];
36
            y_dest[0] = argument[2];
37
            axis_override = argument[4];
38
            end_direction = argument[5];
39
            if (argument_count > 6)
40
                walk_collider = argument[6];
41
            if (argument_count > 7)
42
                x_dest[1] = argument[7];
43
            if (argument_count > 8)
44
                y_dest[1] = argument[8];
45
            if (argument_count > 9)
46
                x_dest[2] = argument[9];
47
            if (argument_count > 10)
48
                y_dest[2] = argument[10];
49
            if (x != x_dest[array_length_1d(x_dest) - 1] || y != y_dest[array_length_1d(y_dest) - 1])
50
                npc_arrived = false;
51
        }
52
        actor_speed = argument[3] + (obj_pl.is_sprinting * 2);
53
        if (npc_arrived == true)
54
        {
55
            can_walk = false;
56
            npc_arrived = false;
57
            with (other)
58
                cutscene_advance();
59
            return true;
60
        }
61
    }
62
    return false;
63
}