Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_dalv2_Step_0

(view raw script w/o annotations or w/e)
1
script_execute(scr_depth, 0, 0, 0, 0, 0);
2
if (fadeout == true)
3
    scr_npc_fade
scr_npc_fade

function scr_npc_fade() { solid = false; if (image_alpha > 0) image_alpha -= 0.2; if (image_alpha == 0 && fade_kill == true) instance_destroy(); }
();
4
if (spritelock == true)
5
{
6
    if (vspeed != 0 || hspeed != 0 || path_speed != 0 || npc_walking == true)
7
    {
8
        switch (direction div 90)
9
        {
10
            case 0:
11
                sprite_index = cdalv_right;
12
                break;
13
            case 1:
14
                sprite_index = cdalv_up;
15
                break;
16
            case 2:
17
                sprite_index = cdalv_left;
18
                break;
19
            case 3:
20
                sprite_index = cdalv_down;
21
                break;
22
        }
23
    }
24
    else
25
    {
26
        switch (direction div 90)
27
        {
28
            case 0:
29
                sprite_index = cdalv_rightt;
30
                break;
31
            case 1:
32
                sprite_index = cdalv_up;
33
                break;
34
            case 2:
35
                sprite_index = cdalv_leftt;
36
                break;
37
            case 3:
38
                sprite_index = cdalv_downt;
39
                break;
40
        }
41
        if (instance_exists(obj_dialogue) && (obj_dialogue.sndfnt == 100 || obj_dialogue.sndfnt_array[clamp(obj_dialogue.message_current, 0, array_length(obj_dialogue.sndfnt_array) - 1)] == 100))
42
        {
43
            if (obj_dialogue.cutoff == string_length(obj_dialogue.message[obj_dialogue.message_current]))
44
            {
45
                image_speed = 0;
46
                image_index = 0;
47
            }
48
            else
49
            {
50
                image_speed = 0.2;
51
            }
52
        }
53
    }
54
}
55
if (speed > 0)
56
    image_speed = 0.2;
57
with (other)
58
{
59
    if (room == rm_dalvshouse && global.flag[28 Spoken to Dalv in his house] == 0)
60
    {
61
        if (image_alpha == 1 && waiter == 0)
62
            waiter = 1;
63
        if (waiter > 2 && waiter < 15)
64
            waiter++;
65
        if (waiter == 1)
66
        {
67
            image_speed = 0.2;
68
            path_start(pt_dalvhouse2, 3, path_action_stop, false);
69
            waiter++;
70
        }
71
        if (waiter == 2 && path_position == 1)
72
        {
73
            waiter++;
74
            image_speed = 0;
75
        }
76
        if (waiter == 15)
77
        {
78
            path_speed = 0;
79
            speed = 0;
80
            scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
81
            with (msg)
82
            {
83
                sndfnt = 100;
84
                message[0] = "* Alright, I know you're#  probably eager to get#  going.";
85
                message[1] = "* But feel free to#  stay as long as#  you like.";
86
                prt[0] = 1755;
87
                prt[1] = 1769;
88
            }
89
            waiter++;
90
        }
91
        if (waiter == 16 && !instance_exists(obj_dialogue))
92
        {
93
            path_start(pt_dalvhouse3, 3, path_action_stop, false);
94
            image_speed = 0.2;
95
            waiter++;
96
        }
97
        if (waiter == 17 && path_position == 1)
98
        {
99
            image_speed = 0;
100
            path_speed = 0;
101
            npc_walking = false;
102
            direction = 270;
103
            image_index = 0;
104
            global.cutscene = false;
105
            global.flag[28 Spoken to Dalv in his house] = 1;
106
            global.dalv_house_enter_count = 2;
107
            obj_pl.state = scr_normal_state;
108
            waiter++;
109
        }
110
    }
111
    if (global.flag[28 Spoken to Dalv in his house] == 1 && room != rm_dalvhallway)
112
    {
113
        if (image_alpha == 1 && waiter == 0)
114
        {
115
            if (global.dalv_house_enter_count == 2 && room == rm_dalvshouse && global.lastroom != "rm_dalvroomhall" && global.lastroom != "rm_dalvhallway")
116
            {
117
                if (global.flag[17 Dalv fate] != 1)
118
                {
119
                    obj_pl.alarm[0] = 1;
120
                    instance_destroy();
121
                    exit;
122
                }
123
                scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
124
                with (msg)
125
                {
126
                    sndfnt = 100;
127
                    message[0] = "* Welcome back.";
128
                    message[1] = "* Um... I'm not sure what#  to say...";
129
                    message[2] = "* I had some cards made#  for emergency friend#  situations...#";
130
                    message[3] = "* ...but I've misplaced#  them.";
131
                    message[4] = "* Make yourself at home...#  again.";
132
                    prt[0] = 1769;
133
                    prt[1] = 1780;
134
                    prt[2] = 1763;
135
                    prt[3] = 1763;
136
                    prt[4] = 1755;
137
                }
138
            }
139
            waiter++;
140
        }
141
        if (waiter > 2 && waiter < 15)
142
            waiter++;
143
        if (waiter == 1 && !instance_exists(obj_dialogue))
144
        {
145
            image_speed = 0.2;
146
            npc_walking = false;
147
            if (global.lastroom != "rm_dalvshouse" && global.lastroom != "rm_dalvroomhall")
148
                axis_override = "x";
149
            else
150
                axis_override = "0";
151
            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; ...
(destination_x_dalv, destination_y_dalv, 1031, 3, axis_override);
152
            if (x == destination_x_dalv && y == destination_y_dalv)
153
                waiter++;
154
        }
155
        if (waiter == 2)
156
        {
157
            waiter++;
158
            image_speed = 0;
159
        }
160
        if (waiter == 15)
161
        {
162
            image_speed = 0;
163
            direction = 270;
164
            image_index = 0;
165
            obj_pl.state = scr_normal_state;
166
            waiter++;
167
        }
168
        if (global.cutscene == true)
169
        {
170
            if (no_loop_room_specific_walking == false)
171
            {
172
                no_loop_destination_dalv = false;
173
                no_loop_room_specific_walking = true;
174
            }
175
            if (x != destination_x_dalv || y != destination_y_dalv)
176
            {
177
                image_speed = 0.2;
178
                npc_walking = false;
179
                if (room == rm_dalvshouse)
180
                {
181
                    if (obj_fridge.waiter > 0)
182
                    {
183
                        if (destination_x_dalv == default_x_dalvshouse && destination_y_dalv == default_y_dalvshouse)
184
                            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; ...
(destination_x_dalv, destination_y_dalv, 1031, 3, "x");
185
                        else
186
                            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; ...
(destination_x_dalv, destination_y_dalv, 1031, 3, "y");
187
                    }
188
                    else if (obj_books.waiter > 0)
189
                    {
190
                        if (destination_x_dalv == default_x_dalvshouse && destination_y_dalv == default_y_dalvshouse)
191
                            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; ...
(destination_x_dalv, destination_y_dalv, 1031, 3, "x");
192
                        else
193
                            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; ...
(destination_x_dalv, destination_y_dalv, 1031, 3, "y");
194
                    }
195
                    else if (obj_dalv2.waiter > 0 || obj_doorway_blocker_dalvshouse.waiter > 0)
196
                    {
197
                        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; ...
(destination_x_dalv, destination_y_dalv, 1031, 3, "x");
198
                    }
199
                    else
200
                    {
201
                        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; ...
(destination_x_dalv, destination_y_dalv, 1031, 3, "0");
202
                    }
203
                }
204
                else if (room == rm_dalvroomhall)
205
                {
206
                    if (obj_broom.waiter > 0)
207
                    {
208
                        if (destination_x_dalv == default_x_dalvroomhall && destination_y_dalv == default_y_dalvroomhall)
209
                            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; ...
(destination_x_dalv, destination_y_dalv, 1031, 3, "x");
210
                        else
211
                            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; ...
(destination_x_dalv, destination_y_dalv, 1031, 3, "y");
212
                    }
213
                    else if (obj_doorway_blocker_dalvsroom.waiter > 0)
214
                    {
215
                        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; ...
(destination_x_dalv, destination_y_dalv, 1031, 3, "x");
216
                    }
217
                    else
218
                    {
219
                        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; ...
(destination_x_dalv, destination_y_dalv, 1031, 3, "0");
220
                    }
221
                }
222
            }
223
            else if (x == destination_x_dalv && y == destination_y_dalv)
224
            {
225
                if (sprite_index == cdalv_right || sprite_index == cdalv_left || sprite_index == cdalv_up || sprite_index == cdalv_down)
226
                {
227
                    image_speed = 0;
228
                    image_index = 0;
229
                }
230
                no_loop_room_specific_walking = false;
231
                if (room == rm_dalvshouse)
232
                {
233
                    if (obj_wardrobe.waiter > 0 || obj_flower_pot.waiter > 0 || destination_x_dalv != default_x_dalvshouse || destination_y_dalv != default_y_dalvshouse)
234
                    {
235
                        if (x > obj_pl.x)
236
                            direction = 180;
237
                        else if (x < obj_pl.x)
238
                            direction = 0;
239
                        else if (y > obj_pl.y)
240
                            direction = 90;
241
                        else
242
                            direction = 270;
243
                    }
244
                    else
245
                    {
246
                        direction = 270;
247
                    }
248
                }
249
                else if (room == rm_dalvroomhall)
250
                {
251
                    if (obj_painting.waiter > 0 || destination_x_dalv != default_x_dalvroomhall || destination_y_dalv != default_y_dalvroomhall)
252
                    {
253
                        if (x > obj_pl.x)
254
                            direction = 180;
255
                        else if (x < obj_pl.x)
256
                            direction = 0;
257
                        else if (y > obj_pl.y)
258
                            direction = 90;
259
                        else
260
                            direction = 270;
261
                    }
262
                    else
263
                    {
264
                        direction = 270;
265
                    }
266
                }
267
                else
268
                {
269
                    direction = 270;
270
                }
271
            }
272
        }
273
        else if (room == rm_dalvshouse && x == default_x_dalvshouse && y == default_y_dalvshouse)
274
        {
275
            direction = 270;
276
        }
277
        else if (room == rm_dalvroomhall && x == default_x_dalvroomhall && y == default_y_dalvroomhall)
278
        {
279
            direction = 270;
280
        }
281
    }
282
}
283
if (room == rm_dalvhallway && obj_pl.player_mode == "DalvExit")
284
{
285
    obj_dalv2.destination_x_dalv = 156;
286
    obj_dalv2.destination_y_dalv = -40;
287
    if (no_loop_dalv_hallway == false)
288
    {
289
        no_loop_destination_dalv = false;
290
        no_loop_dalv_hallway = true;
291
    }
292
    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; ...
(destination_x_dalv, destination_y_dalv, 1031, 3, "y");
293
    if (obj_dalv2.x == 156 && obj_dalv2.y <= 20)
294
    {
295
        with (obj_pl)
296
        {
297
            if (!instance_exists(obj_transition))
298
            {
299
                obj_pl.state = scr_frozen_state;
300
                alarm[0] = 8;
301
                trn = instance_create(x, y, obj_transition);
302
                trn.newRoom = 41;
303
                trn.xx = 160;
304
                trn.yy = 170;
305
            }
306
        }
307
    }
308
}
309
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; } }
() == true) && dalv_talk_waiter == 0 && !instance_exists(obj_dialogue))
310
    dalv_talk_waiter = 1;
311
if (dalv_talk_waiter >= 1 && dalv_talk_waiter <= 7)
312
    direction = obj_pl.direction + 180;
313
if (dalv_talk_waiter == 1)
314
{
315
    global.cutscene = true;
316
    response = "nothing";
317
    dalv_talk_waiter++;
318
}
319
if (dalv_talk_waiter == 2)
320
{
321
    scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
322
    with (msg)
323
    {
324
        if (room == rm_dalvshouse)
325
        {
326
            if (!instance_exists(obj_dialoguebox_dummy))
327
                instance_create(0, 0, obj_dialoguebox_dummy);
328
            portrait = true;
329
            sndfnt = 100;
330
            message[0] = "* Are you ready to leave?";
331
            prt[0] = 1755;
332
        }
333
        else
334
        {
335
            portrait = true;
336
            sndfnt = 100;
337
            message[0] = "* I hope I'm being a good#  host!";
338
            prt[0] = 1769;
339
        }
340
    }
341
    dalv_talk_waiter++;
342
}
343
if (dalv_talk_waiter == 3 && !instance_exists(obj_dialogue))
344
{
345
    if (room == rm_dalvshouse)
346
        dalv_talk_waiter++;
347
    else
348
        dalv_talk_waiter = 10;
349
}
350
if (dalv_talk_waiter == 4)
351
{
352
    scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
353
    with (msg)
354
    {
355
        portrait = false;
356
        sndfnt = 99;
357
        message[0] = "* Leave Dalv's house?";
358
        if (outcome == 1 && message_current == 0)
359
        {
360
            obj_dalv2.response = "yes";
361
            obj_dalv2.dalv_talk_waiter++;
362
        }
363
        else if (outcome == 2 && message_current == 0)
364
        {
365
            obj_dalv2.response = "no";
366
            obj_dalv2.dalv_talk_waiter++;
367
        }
368
        ch_msg = 0;
369
        ch[1] = "Yes";
370
        ch[2] = "No";
371
    }
372
}
373
if (dalv_talk_waiter == 5 && !instance_exists(obj_dialogue))
374
    dalv_talk_waiter++;
375
if (dalv_talk_waiter == 6)
376
{
377
    scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
378
    with (msg)
379
    {
380
        if (obj_dalv2.response == "yes")
381
        {
382
            portrait = true;
383
            sndfnt = 100;
384
            message[0] = "* If that's what you want,#  I'll lead the way.";
385
            prt[0] = 1776;
386
        }
387
        else if (obj_dalv2.response == "no")
388
        {
389
            portrait = true;
390
            sndfnt = 100;
391
            message[0] = "* Alright, take as long as#  you like.";
392
            prt[0] = 1776;
393
        }
394
    }
395
    dalv_talk_waiter++;
396
}
397
if (dalv_talk_waiter == 7 && !instance_exists(obj_dialogue))
398
{
399
    with (obj_dialoguebox_dummy)
400
        instance_destroy();
401
    if (response == "yes" && !instance_exists(obj_transition))
402
    {
403
        with (obj_pl)
404
        {
405
            if (obj_dalv2.no_loop_autowalk == false)
406
            {
407
                clover_walk_backwards = true;
408
                autowalk_direction = "down";
409
                state = scr_autowalk_state;
410
alarm[1]
411
                obj_dalv2.no_loop_autowalk = true;
412
            }
413
            else if (alarm[1] <= 0)
414
            {
415
                obj_dalv2.dalv_talk_waiter++;
416
            }
417
        }
418
    }
419
    if (response == "no")
420
    {
421
        direction = 270;
422
        dalv_talk_waiter = 10;
423
    }
424
}
425
if (dalv_talk_waiter == 8)
426
{
427
    obj_dalv2.destination_x_dalv = 140;
428
    obj_dalv2.destination_y_dalv = 90;
429
    if (obj_dalv2.x == 140 && obj_dalv2.y == 90)
430
    {
431
        no_loop_room_specific_walking = false;
432
        dalv_talk_waiter++;
433
    }
434
}
435
if (dalv_talk_waiter == 9)
436
{
437
    obj_dalv2.destination_x_dalv = 220;
438
    obj_dalv2.destination_y_dalv = -60;
439
    if (obj_dalv2.x == 220 && obj_dalv2.y <= 40)
440
    {
441
        with (obj_pl)
442
        {
443
            if (!instance_exists(obj_transition))
444
            {
445
                obj_pl.state = scr_frozen_state;
446
                alarm[0] = 8;
447
                trn = instance_create(x, y, obj_transition);
448
                trn.newRoom = 36;
449
                trn.xx = 156;
450
                trn.yy = 530;
451
            }
452
        }
453
    }
454
    with (obj_pl)
455
        player_mode = "DalvExit";
456
}
457
if (dalv_talk_waiter == 10)
458
{
459
    global.cutscene = false;
460
    dalv_talk_waiter = 0;
461
    obj_pl.alarm[0] = 1;
462
}
463
var __b__ = action_if_variable(fadein, true, 0);
464
if (__b__)
465
    script_execute(anim_fade, 0.05, 0, 0, 0, 0);