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(gml_Script_scr_depth, 0, 0, 0, 0, 0)
2
if (fadeout == true)
3
    scr_npc_fade
scr_npc_fade

function scr_npc_fade() //gml_Script_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
    }
25
    else
26
    {
27
        switch (direction div 90)
28
        {
29
            case 0:
30
                sprite_index = cdalv_rightt
31
                break
32
            case 1:
33
                sprite_index = cdalv_up
34
                break
35
            case 2:
36
                sprite_index = cdalv_leftt
37
                break
38
            case 3:
39
                sprite_index = cdalv_downt
40
                break
41
        }
42
43
        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))
44
        {
45
            if (obj_dialogue.cutoff == string_length(obj_dialogue.message[obj_dialogue.message_current]))
46
            {
47
                image_speed = 0
48
                image_index = 0
49
            }
50
            else
51
                image_speed = 0.2
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() //gml_Script_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 = gml_Script_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
                    return;
122
                }
123
                scr_text
scr_text

function scr_text() //gml_Script_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(argument0, argument1, argument2, argument3, argument4) //gml_Script_scr_walk_ai { dalv_walk_speed = argument3 condition_1 = false if (no_loop_destination_dalv == false) { var destination_x = abs(x - argument0) var destination_y = abs(y - argument1) var axis_override = argument4 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(argument0 - x)) * dalv_walk_speed dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed no_loop_destination_dalv = true } if (x == argument0 && y == argument1) { npc_walking = false path_speed = 0 image_speed = 0 image_index = 0 return; } switch dalv_walk_axis { case "x": x_previous = x x += dalv_walk_speed_x if (abs(argument0 - x) < dalv_walk_speed && place_free(argument0, y) && (!(place_meeting(argument0, y, argument2)))) x = argument0 if (place_free(x, y) && (!(place_meeting(x, y, argument2))) && x_previous != argument0) { 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, argument2) || x_previous == argument0) { x = x_previous dalv_walk_axis = "y" return; } dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed i = x + dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) { condition_1 = true break } else continue } if (condition_1 == true) { while (i != argument0) { i += dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if (i == argument0 && j == argument1) return; else if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) break else { if (j == argument1) return; continue ...
(destination_x_dalv, destination_y_dalv, obj_pl, 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 = gml_Script_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(argument0, argument1, argument2, argument3, argument4) //gml_Script_scr_walk_ai { dalv_walk_speed = argument3 condition_1 = false if (no_loop_destination_dalv == false) { var destination_x = abs(x - argument0) var destination_y = abs(y - argument1) var axis_override = argument4 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(argument0 - x)) * dalv_walk_speed dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed no_loop_destination_dalv = true } if (x == argument0 && y == argument1) { npc_walking = false path_speed = 0 image_speed = 0 image_index = 0 return; } switch dalv_walk_axis { case "x": x_previous = x x += dalv_walk_speed_x if (abs(argument0 - x) < dalv_walk_speed && place_free(argument0, y) && (!(place_meeting(argument0, y, argument2)))) x = argument0 if (place_free(x, y) && (!(place_meeting(x, y, argument2))) && x_previous != argument0) { 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, argument2) || x_previous == argument0) { x = x_previous dalv_walk_axis = "y" return; } dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed i = x + dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) { condition_1 = true break } else continue } if (condition_1 == true) { while (i != argument0) { i += dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if (i == argument0 && j == argument1) return; else if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) break else { if (j == argument1) return; continue ...
(destination_x_dalv, destination_y_dalv, obj_pl, 3, "x")
185
                        else
186
                            scr_walk_ai
scr_walk_ai

function scr_walk_ai(argument0, argument1, argument2, argument3, argument4) //gml_Script_scr_walk_ai { dalv_walk_speed = argument3 condition_1 = false if (no_loop_destination_dalv == false) { var destination_x = abs(x - argument0) var destination_y = abs(y - argument1) var axis_override = argument4 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(argument0 - x)) * dalv_walk_speed dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed no_loop_destination_dalv = true } if (x == argument0 && y == argument1) { npc_walking = false path_speed = 0 image_speed = 0 image_index = 0 return; } switch dalv_walk_axis { case "x": x_previous = x x += dalv_walk_speed_x if (abs(argument0 - x) < dalv_walk_speed && place_free(argument0, y) && (!(place_meeting(argument0, y, argument2)))) x = argument0 if (place_free(x, y) && (!(place_meeting(x, y, argument2))) && x_previous != argument0) { 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, argument2) || x_previous == argument0) { x = x_previous dalv_walk_axis = "y" return; } dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed i = x + dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) { condition_1 = true break } else continue } if (condition_1 == true) { while (i != argument0) { i += dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if (i == argument0 && j == argument1) return; else if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) break else { if (j == argument1) return; continue ...
(destination_x_dalv, destination_y_dalv, obj_pl, 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(argument0, argument1, argument2, argument3, argument4) //gml_Script_scr_walk_ai { dalv_walk_speed = argument3 condition_1 = false if (no_loop_destination_dalv == false) { var destination_x = abs(x - argument0) var destination_y = abs(y - argument1) var axis_override = argument4 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(argument0 - x)) * dalv_walk_speed dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed no_loop_destination_dalv = true } if (x == argument0 && y == argument1) { npc_walking = false path_speed = 0 image_speed = 0 image_index = 0 return; } switch dalv_walk_axis { case "x": x_previous = x x += dalv_walk_speed_x if (abs(argument0 - x) < dalv_walk_speed && place_free(argument0, y) && (!(place_meeting(argument0, y, argument2)))) x = argument0 if (place_free(x, y) && (!(place_meeting(x, y, argument2))) && x_previous != argument0) { 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, argument2) || x_previous == argument0) { x = x_previous dalv_walk_axis = "y" return; } dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed i = x + dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) { condition_1 = true break } else continue } if (condition_1 == true) { while (i != argument0) { i += dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if (i == argument0 && j == argument1) return; else if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) break else { if (j == argument1) return; continue ...
(destination_x_dalv, destination_y_dalv, obj_pl, 3, "x")
192
                        else
193
                            scr_walk_ai
scr_walk_ai

function scr_walk_ai(argument0, argument1, argument2, argument3, argument4) //gml_Script_scr_walk_ai { dalv_walk_speed = argument3 condition_1 = false if (no_loop_destination_dalv == false) { var destination_x = abs(x - argument0) var destination_y = abs(y - argument1) var axis_override = argument4 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(argument0 - x)) * dalv_walk_speed dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed no_loop_destination_dalv = true } if (x == argument0 && y == argument1) { npc_walking = false path_speed = 0 image_speed = 0 image_index = 0 return; } switch dalv_walk_axis { case "x": x_previous = x x += dalv_walk_speed_x if (abs(argument0 - x) < dalv_walk_speed && place_free(argument0, y) && (!(place_meeting(argument0, y, argument2)))) x = argument0 if (place_free(x, y) && (!(place_meeting(x, y, argument2))) && x_previous != argument0) { 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, argument2) || x_previous == argument0) { x = x_previous dalv_walk_axis = "y" return; } dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed i = x + dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) { condition_1 = true break } else continue } if (condition_1 == true) { while (i != argument0) { i += dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if (i == argument0 && j == argument1) return; else if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) break else { if (j == argument1) return; continue ...
(destination_x_dalv, destination_y_dalv, obj_pl, 3, "y")
194
                    }
195
                    else if (obj_dalv2.waiter > 0 || obj_doorway_blocker_dalvshouse.waiter > 0)
196
                        scr_walk_ai
scr_walk_ai

function scr_walk_ai(argument0, argument1, argument2, argument3, argument4) //gml_Script_scr_walk_ai { dalv_walk_speed = argument3 condition_1 = false if (no_loop_destination_dalv == false) { var destination_x = abs(x - argument0) var destination_y = abs(y - argument1) var axis_override = argument4 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(argument0 - x)) * dalv_walk_speed dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed no_loop_destination_dalv = true } if (x == argument0 && y == argument1) { npc_walking = false path_speed = 0 image_speed = 0 image_index = 0 return; } switch dalv_walk_axis { case "x": x_previous = x x += dalv_walk_speed_x if (abs(argument0 - x) < dalv_walk_speed && place_free(argument0, y) && (!(place_meeting(argument0, y, argument2)))) x = argument0 if (place_free(x, y) && (!(place_meeting(x, y, argument2))) && x_previous != argument0) { 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, argument2) || x_previous == argument0) { x = x_previous dalv_walk_axis = "y" return; } dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed i = x + dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) { condition_1 = true break } else continue } if (condition_1 == true) { while (i != argument0) { i += dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if (i == argument0 && j == argument1) return; else if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) break else { if (j == argument1) return; continue ...
(destination_x_dalv, destination_y_dalv, obj_pl, 3, "x")
197
                    else
198
                        scr_walk_ai
scr_walk_ai

function scr_walk_ai(argument0, argument1, argument2, argument3, argument4) //gml_Script_scr_walk_ai { dalv_walk_speed = argument3 condition_1 = false if (no_loop_destination_dalv == false) { var destination_x = abs(x - argument0) var destination_y = abs(y - argument1) var axis_override = argument4 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(argument0 - x)) * dalv_walk_speed dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed no_loop_destination_dalv = true } if (x == argument0 && y == argument1) { npc_walking = false path_speed = 0 image_speed = 0 image_index = 0 return; } switch dalv_walk_axis { case "x": x_previous = x x += dalv_walk_speed_x if (abs(argument0 - x) < dalv_walk_speed && place_free(argument0, y) && (!(place_meeting(argument0, y, argument2)))) x = argument0 if (place_free(x, y) && (!(place_meeting(x, y, argument2))) && x_previous != argument0) { 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, argument2) || x_previous == argument0) { x = x_previous dalv_walk_axis = "y" return; } dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed i = x + dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) { condition_1 = true break } else continue } if (condition_1 == true) { while (i != argument0) { i += dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if (i == argument0 && j == argument1) return; else if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) break else { if (j == argument1) return; continue ...
(destination_x_dalv, destination_y_dalv, obj_pl, 3, "0")
199
                }
200
                else if (room == rm_dalvroomhall)
201
                {
202
                    if (obj_broom.waiter > 0)
203
                    {
204
                        if (destination_x_dalv == default_x_dalvroomhall && destination_y_dalv == default_y_dalvroomhall)
205
                            scr_walk_ai
scr_walk_ai

function scr_walk_ai(argument0, argument1, argument2, argument3, argument4) //gml_Script_scr_walk_ai { dalv_walk_speed = argument3 condition_1 = false if (no_loop_destination_dalv == false) { var destination_x = abs(x - argument0) var destination_y = abs(y - argument1) var axis_override = argument4 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(argument0 - x)) * dalv_walk_speed dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed no_loop_destination_dalv = true } if (x == argument0 && y == argument1) { npc_walking = false path_speed = 0 image_speed = 0 image_index = 0 return; } switch dalv_walk_axis { case "x": x_previous = x x += dalv_walk_speed_x if (abs(argument0 - x) < dalv_walk_speed && place_free(argument0, y) && (!(place_meeting(argument0, y, argument2)))) x = argument0 if (place_free(x, y) && (!(place_meeting(x, y, argument2))) && x_previous != argument0) { 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, argument2) || x_previous == argument0) { x = x_previous dalv_walk_axis = "y" return; } dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed i = x + dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) { condition_1 = true break } else continue } if (condition_1 == true) { while (i != argument0) { i += dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if (i == argument0 && j == argument1) return; else if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) break else { if (j == argument1) return; continue ...
(destination_x_dalv, destination_y_dalv, obj_pl, 3, "x")
206
                        else
207
                            scr_walk_ai
scr_walk_ai

function scr_walk_ai(argument0, argument1, argument2, argument3, argument4) //gml_Script_scr_walk_ai { dalv_walk_speed = argument3 condition_1 = false if (no_loop_destination_dalv == false) { var destination_x = abs(x - argument0) var destination_y = abs(y - argument1) var axis_override = argument4 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(argument0 - x)) * dalv_walk_speed dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed no_loop_destination_dalv = true } if (x == argument0 && y == argument1) { npc_walking = false path_speed = 0 image_speed = 0 image_index = 0 return; } switch dalv_walk_axis { case "x": x_previous = x x += dalv_walk_speed_x if (abs(argument0 - x) < dalv_walk_speed && place_free(argument0, y) && (!(place_meeting(argument0, y, argument2)))) x = argument0 if (place_free(x, y) && (!(place_meeting(x, y, argument2))) && x_previous != argument0) { 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, argument2) || x_previous == argument0) { x = x_previous dalv_walk_axis = "y" return; } dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed i = x + dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) { condition_1 = true break } else continue } if (condition_1 == true) { while (i != argument0) { i += dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if (i == argument0 && j == argument1) return; else if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) break else { if (j == argument1) return; continue ...
(destination_x_dalv, destination_y_dalv, obj_pl, 3, "y")
208
                    }
209
                    else if (obj_doorway_blocker_dalvsroom.waiter > 0)
210
                        scr_walk_ai
scr_walk_ai

function scr_walk_ai(argument0, argument1, argument2, argument3, argument4) //gml_Script_scr_walk_ai { dalv_walk_speed = argument3 condition_1 = false if (no_loop_destination_dalv == false) { var destination_x = abs(x - argument0) var destination_y = abs(y - argument1) var axis_override = argument4 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(argument0 - x)) * dalv_walk_speed dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed no_loop_destination_dalv = true } if (x == argument0 && y == argument1) { npc_walking = false path_speed = 0 image_speed = 0 image_index = 0 return; } switch dalv_walk_axis { case "x": x_previous = x x += dalv_walk_speed_x if (abs(argument0 - x) < dalv_walk_speed && place_free(argument0, y) && (!(place_meeting(argument0, y, argument2)))) x = argument0 if (place_free(x, y) && (!(place_meeting(x, y, argument2))) && x_previous != argument0) { 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, argument2) || x_previous == argument0) { x = x_previous dalv_walk_axis = "y" return; } dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed i = x + dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) { condition_1 = true break } else continue } if (condition_1 == true) { while (i != argument0) { i += dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if (i == argument0 && j == argument1) return; else if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) break else { if (j == argument1) return; continue ...
(destination_x_dalv, destination_y_dalv, obj_pl, 3, "x")
211
                    else
212
                        scr_walk_ai
scr_walk_ai

function scr_walk_ai(argument0, argument1, argument2, argument3, argument4) //gml_Script_scr_walk_ai { dalv_walk_speed = argument3 condition_1 = false if (no_loop_destination_dalv == false) { var destination_x = abs(x - argument0) var destination_y = abs(y - argument1) var axis_override = argument4 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(argument0 - x)) * dalv_walk_speed dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed no_loop_destination_dalv = true } if (x == argument0 && y == argument1) { npc_walking = false path_speed = 0 image_speed = 0 image_index = 0 return; } switch dalv_walk_axis { case "x": x_previous = x x += dalv_walk_speed_x if (abs(argument0 - x) < dalv_walk_speed && place_free(argument0, y) && (!(place_meeting(argument0, y, argument2)))) x = argument0 if (place_free(x, y) && (!(place_meeting(x, y, argument2))) && x_previous != argument0) { 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, argument2) || x_previous == argument0) { x = x_previous dalv_walk_axis = "y" return; } dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed i = x + dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) { condition_1 = true break } else continue } if (condition_1 == true) { while (i != argument0) { i += dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if (i == argument0 && j == argument1) return; else if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) break else { if (j == argument1) return; continue ...
(destination_x_dalv, destination_y_dalv, obj_pl, 3, "0")
213
                }
214
            }
215
            else if (x == destination_x_dalv && y == destination_y_dalv)
216
            {
217
                if (sprite_index == cdalv_right || sprite_index == cdalv_left || sprite_index == cdalv_up || sprite_index == cdalv_down)
218
                {
219
                    image_speed = 0
220
                    image_index = 0
221
                }
222
                no_loop_room_specific_walking = false
223
                if (room == rm_dalvshouse)
224
                {
225
                    if (obj_wardrobe.waiter > 0 || obj_flower_pot.waiter > 0 || destination_x_dalv != default_x_dalvshouse || destination_y_dalv != default_y_dalvshouse)
226
                    {
227
                        if (x > obj_pl.x)
228
                            direction = 180
229
                        else if (x < obj_pl.x)
230
                            direction = 0
231
                        else if (y > obj_pl.y)
232
                            direction = 90
233
                        else
234
                            direction = 270
235
                    }
236
                    else
237
                        direction = 270
238
                }
239
                else if (room == rm_dalvroomhall)
240
                {
241
                    if (obj_painting.waiter > 0 || destination_x_dalv != default_x_dalvroomhall || destination_y_dalv != default_y_dalvroomhall)
242
                    {
243
                        if (x > obj_pl.x)
244
                            direction = 180
245
                        else if (x < obj_pl.x)
246
                            direction = 0
247
                        else if (y > obj_pl.y)
248
                            direction = 90
249
                        else
250
                            direction = 270
251
                    }
252
                    else
253
                        direction = 270
254
                }
255
                else
256
                    direction = 270
257
            }
258
        }
259
        else if (room == rm_dalvshouse && x == default_x_dalvshouse && y == default_y_dalvshouse)
260
            direction = 270
261
        else if (room == rm_dalvroomhall && x == default_x_dalvroomhall && y == default_y_dalvroomhall)
262
            direction = 270
263
    }
264
}
265
if (room == rm_dalvhallway && obj_pl.player_mode == "DalvExit")
266
{
267
    obj_dalv2.destination_x_dalv = 156
268
    obj_dalv2.destination_y_dalv = -40
269
    if (no_loop_dalv_hallway == false)
270
    {
271
        no_loop_destination_dalv = false
272
        no_loop_dalv_hallway = true
273
    }
274
    scr_walk_ai
scr_walk_ai

function scr_walk_ai(argument0, argument1, argument2, argument3, argument4) //gml_Script_scr_walk_ai { dalv_walk_speed = argument3 condition_1 = false if (no_loop_destination_dalv == false) { var destination_x = abs(x - argument0) var destination_y = abs(y - argument1) var axis_override = argument4 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(argument0 - x)) * dalv_walk_speed dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed no_loop_destination_dalv = true } if (x == argument0 && y == argument1) { npc_walking = false path_speed = 0 image_speed = 0 image_index = 0 return; } switch dalv_walk_axis { case "x": x_previous = x x += dalv_walk_speed_x if (abs(argument0 - x) < dalv_walk_speed && place_free(argument0, y) && (!(place_meeting(argument0, y, argument2)))) x = argument0 if (place_free(x, y) && (!(place_meeting(x, y, argument2))) && x_previous != argument0) { 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, argument2) || x_previous == argument0) { x = x_previous dalv_walk_axis = "y" return; } dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed i = x + dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) { condition_1 = true break } else continue } if (condition_1 == true) { while (i != argument0) { i += dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if (i == argument0 && j == argument1) return; else if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) break else { if (j == argument1) return; continue ...
(destination_x_dalv, destination_y_dalv, obj_pl, 3, "y")
275
    if (obj_dalv2.x == 156 && obj_dalv2.y <= 20)
276
    {
277
        with (obj_pl)
278
        {
279
            if (!instance_exists(obj_transition))
280
            {
281
                obj_pl.state = gml_Script_scr_frozen_state
282
                alarm[0] = 8
alarm[0]

fadein = true
283
                trn = instance_create(x, y, obj_transition)
284
                trn.newRoom = 41
285
                trn.xx = 160
286
                trn.yy = 170
287
            }
288
        }
289
    }
290
}
291
if (keyboard_multicheck_pressed(0) && scr_interact
scr_interact

function scr_interact() //gml_Script_scr_interact { if (distance_to_object(obj_pl) < 20 && obj_pl.state == gml_Script_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)))
292
    dalv_talk_waiter = 1
293
if (dalv_talk_waiter >= 1 && dalv_talk_waiter <= 7)
294
    direction = obj_pl.direction + 180
295
if (dalv_talk_waiter == 1)
296
{
297
    global.cutscene = true
298
    response = "nothing"
299
    dalv_talk_waiter++
300
}
301
if (dalv_talk_waiter == 2)
302
{
303
    scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
304
    with (msg)
305
    {
306
        if (room == rm_dalvshouse)
307
        {
308
            if (!instance_exists(obj_dialoguebox_dummy))
309
                instance_create(0, 0, obj_dialoguebox_dummy)
310
            portrait = true
311
            sndfnt = 100
312
            message[0] = "* Are you ready to leave?"
313
            prt[0] = 1755
314
        }
315
        else
316
        {
317
            portrait = true
318
            sndfnt = 100
319
            message[0] = "* I hope I'm being a good#  host!"
320
            prt[0] = 1769
321
        }
322
    }
323
    dalv_talk_waiter++
324
}
325
if (dalv_talk_waiter == 3 && (!instance_exists(obj_dialogue)))
326
{
327
    if (room == rm_dalvshouse)
328
        dalv_talk_waiter++
329
    else
330
        dalv_talk_waiter = 10
331
}
332
if (dalv_talk_waiter == 4)
333
{
334
    scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
335
    with (msg)
336
    {
337
        portrait = false
338
        sndfnt = 99
339
        message[0] = "* Leave Dalv's house?"
340
        if (outcome == 1 && message_current == 0)
341
        {
342
            obj_dalv2.response = "yes"
343
            obj_dalv2.dalv_talk_waiter++
344
        }
345
        else if (outcome == 2 && message_current == 0)
346
        {
347
            obj_dalv2.response = "no"
348
            obj_dalv2.dalv_talk_waiter++
349
        }
350
        ch_msg = 0
351
        ch[1] = "Yes"
352
        ch[2] = "No"
353
    }
354
}
355
if (dalv_talk_waiter == 5 && (!instance_exists(obj_dialogue)))
356
    dalv_talk_waiter++
357
if (dalv_talk_waiter == 6)
358
{
359
    scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
360
    with (msg)
361
    {
362
        if (obj_dalv2.response == "yes")
363
        {
364
            portrait = true
365
            sndfnt = 100
366
            message[0] = "* If that's what you want,#  I'll lead the way."
367
            prt[0] = 1776
368
        }
369
        else if (obj_dalv2.response == "no")
370
        {
371
            portrait = true
372
            sndfnt = 100
373
            message[0] = "* Alright, take as long as#  you like."
374
            prt[0] = 1776
375
        }
376
    }
377
    dalv_talk_waiter++
378
}
379
if (dalv_talk_waiter == 7 && (!instance_exists(obj_dialogue)))
380
{
381
    with (obj_dialoguebox_dummy)
382
        instance_destroy()
383
    if (response == "yes" && (!instance_exists(obj_transition)))
384
    {
385
        with (obj_pl)
386
        {
387
            if (obj_dalv2.no_loop_autowalk == false)
388
            {
389
                clover_walk_backwards = true
390
                autowalk_direction = "down"
391
                state = gml_Script_scr_autowalk_state
392
               alarm[1]
393
                obj_dalv2.no_loop_autowalk = true
394
            }
395
            else if (alarm[1] <= 0)
396
                obj_dalv2.dalv_talk_waiter++
397
        }
398
    }
399
    if (response == "no")
400
    {
401
        direction = 270
402
        dalv_talk_waiter = 10
403
    }
404
}
405
if (dalv_talk_waiter == 8)
406
{
407
    obj_dalv2.destination_x_dalv = 140
408
    obj_dalv2.destination_y_dalv = 90
409
    if (obj_dalv2.x == 140 && obj_dalv2.y == 90)
410
    {
411
        no_loop_room_specific_walking = false
412
        dalv_talk_waiter++
413
    }
414
}
415
if (dalv_talk_waiter == 9)
416
{
417
    obj_dalv2.destination_x_dalv = 220
418
    obj_dalv2.destination_y_dalv = -60
419
    if (obj_dalv2.x == 220 && obj_dalv2.y <= 40)
420
    {
421
        with (obj_pl)
422
        {
423
            if (!instance_exists(obj_transition))
424
            {
425
                obj_pl.state = gml_Script_scr_frozen_state
426
                alarm[0] = 8
alarm[0]

fadein = true
427
                trn = instance_create(x, y, obj_transition)
428
                trn.newRoom = 36
429
                trn.xx = 156
430
                trn.yy = 530
431
            }
432
        }
433
    }
434
    with (obj_pl)
435
        player_mode = "DalvExit"
436
}
437
if (dalv_talk_waiter == 10)
438
{
439
    global.cutscene = false
440
    dalv_talk_waiter = 0
441
    obj_pl.alarm[0] = 1
442
}
443
var __b__ = action_if_variable(fadein, true, 0)
444
if __b__
445
    script_execute(gml_Script_anim_fade, 0.05, 0, 0, 0, 0)