Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_test_dalv_Step_0

(view raw script w/o annotations or w/e)
1
scr_walk_npc_free
scr_walk_npc_free

function scr_walk_npc_free(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { if (arg6 == "nothing") arg6 = -4; is_walking = true; walk_speed = arg2; condition_1 = false; if (no_loop_destination == false) { var destination_x = abs(x - arg0); var destination_y = abs(y - arg1); var axis_override = arg4; if (axis_override == "x" || axis_override == "y") { walk_axis = axis_override; } else { var result = sign(destination_x - destination_y); switch (result) { case 1: walk_axis = "x"; break; case -1: walk_axis = "y"; break; default: walk_axis = "y"; } } walk_speed_x = sign(arg0 - x); walk_speed_y = sign(arg1 - y); if (walk_speed_x == 0) walk_speed_x = walk_speed; if (walk_speed_y == 0) walk_speed_y = walk_speed; no_loop_destination = true; lock_axis = false; } walk_speed_x = sign(walk_speed_x) * walk_speed; walk_speed_y = sign(walk_speed_y) * walk_speed; if (x == arg0 && y == arg1) { no_loop_destination = false; npc_walking = false; is_walking = false; if (arg5 != "nothing") npc_direction = arg5; image_speed = 0; image_index = 0; return true; exit; } switch (walk_axis) { case "x": x_previous = x; x += walk_speed_x; if (abs(arg0 - x) < walk_speed && !place_meeting(arg0, y, arg6)) x = arg0; if (!place_meeting(x, y, arg6) && x_previous != arg0) { npc_walking = true; image_speed = arg3; if (walk_speed_x == -walk_speed) npc_direction = "left"; else if (walk_speed_x == walk_speed) npc_direction = "right"; } if (!place_meeting(x, y + walk_speed_y, arg6) && lock_axis == true) { lock_axis = false; walk_axis = "y"; exit; } if ((place_meeting(x, y, arg6) || x_previous == arg0) && lock_axis == false) { if (place_meeting(x, y, arg6)) lock_axis = true; x = x_previous; walk_axis = "y"; exit; } walk_speed_y = sign(arg1 - y) * walk_speed; i = x + walk_speed_x; j = y; if (abs(arg0 - i) < walk_speed) i = arg0; while (j != arg1) { j += walk_speed_y; if (abs(arg1 - j) < walk_speed) j = arg1; if (place_meeting(i, j, arg6)) { condition_1 = true; break; } } if (condition_1 == true) ...
(300, 120, 2, 0.2, "x", "left", 1031);