Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_pl_follow_Step_0

(view raw script w/o annotations or w/e)
1
if (obj_pl.player_mode == "DalvExit")
2
{
3
    scr_walk_ai
scr_walk_ai

function scr_walk_ai(arg0, arg1, arg2, arg3, arg4) { dalv_walk_speed = arg3; condition_1 = false; if (no_loop_destination_dalv == false) { var destination_x = abs(x - arg0); var destination_y = abs(y - arg1); var axis_override = arg4; if (axis_override == "x" || axis_override == "y") { dalv_walk_axis = axis_override; } else { var result = sign(destination_x - destination_y); switch (result) { case 1: dalv_walk_axis = "x"; break; case -1: dalv_walk_axis = "y"; break; default: dalv_walk_axis = "y"; } } dalv_walk_speed_x = sign(arg0 - x) * dalv_walk_speed; dalv_walk_speed_y = sign(arg1 - y) * dalv_walk_speed; no_loop_destination_dalv = true; } if (x == arg0 && y == arg1) { npc_walking = false; path_speed = 0; image_speed = 0; image_index = 0; exit; } switch (dalv_walk_axis) { case "x": x_previous = x; x += dalv_walk_speed_x; if (abs(arg0 - x) < dalv_walk_speed && place_free(arg0, y) && !place_meeting(arg0, y, arg2)) x = arg0; if (place_free(x, y) && !place_meeting(x, y, arg2) && x_previous != arg0) { npc_walking = true; image_speed = 0.2; if (dalv_walk_speed_x == -dalv_walk_speed) direction = 180; else if (dalv_walk_speed_x == dalv_walk_speed) direction = 0; } if (!place_free(x, y) || place_meeting(x, y, arg2) || x_previous == arg0) { x = x_previous; dalv_walk_axis = "y"; exit; } dalv_walk_speed_y = sign(arg1 - y) * dalv_walk_speed; i = x + dalv_walk_speed_x; j = y; if (abs(arg0 - i) < dalv_walk_speed) i = arg0; while (j != arg1) { j += dalv_walk_speed_y; if (abs(arg1 - j) < dalv_walk_speed) j = arg1; if (!place_free(i, j) || place_meeting(i, j, arg2)) { condition_1 = true; break; } } if (condition_1 == true) { while (i != arg0) { i += dalv_walk_speed_x; j = y; if (abs(arg0 - i) < dalv_walk_speed) i = arg0; while (j != arg1) { j += dalv_walk_speed_y; if (abs(arg1 - j) < dalv_walk_speed) j = arg1; if (i == arg0 && j == arg1) exit; else if (!place_free(i, j) || place_meeting(i, j, arg2)) break; else if (j == arg1) exit; } } dalv_walk_axis = "y"; exit; ...
(obj_dalv2.destination_x_dalv, obj_dalv2.destination_y_dalv, 1021, 3, "x");
4
    obj_pl.x = x;
5
    obj_pl.y = y;
6
    obj_dalv2.solid = false;
7
}
8
if (obj_pl.player_mode == "Normal")
9
    instance_destroy();
10
if (x != xprevious || y != yprevious)
11
{
12
    image_speed = 0.2;
13
}
14
else
15
{
16
    image_speed = 0;
17
    image_index = 0;
18
}
19
if (direction == 0)
20
    sprite_index = rsprite;
21
if (direction == 90)
22
    sprite_index = usprite;
23
if (direction == 180)
24
    sprite_index = lsprite;
25
if (direction == 270)
26
    sprite_index = dsprite;