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() //gml_Script_cutscene_npc_walk_wait
2
{
3
    if (!instance_exists(argument[0]))
4
        return;
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
                npc_direction = "down"
20
            else
21
                npc_direction = "up"
22
        }
23
        else if (distance_to_object(obj_pl) < 50)
24
            can_walk = true
25
        if (x_dest[0] != argument[1] || y_dest[0] != argument[2])
26
        {
27
            x_dest = 0
28
            y_dest = 0
29
            x_dest[0] = argument[1]
30
            y_dest[0] = argument[2]
31
            axis_override = argument[4]
32
            end_direction = argument[5]
33
            if (argument_count > 6)
34
                walk_collider = argument[6]
35
            if (argument_count > 7)
36
                x_dest[1] = argument[7]
37
            if (argument_count > 8)
38
                y_dest[1] = argument[8]
39
            if (argument_count > 9)
40
                x_dest[2] = argument[9]
41
            if (argument_count > 10)
42
                y_dest[2] = argument[10]
43
            if (x != x_dest[(array_length_1d(x_dest) - 1)] || y != y_dest[(array_length_1d(y_dest) - 1)])
44
                npc_arrived = false
45
        }
46
        actor_speed = argument[3] + obj_pl.is_sprinting * 2
47
        if (npc_arrived == true)
48
        {
49
            can_walk = false
50
            npc_arrived = false
51
            with (other)
52
                cutscene_advance()
53
            return true;
54
        }
55
    }
56
    return false;
57
}