Undertale script viewer

← back to main script listing

gml_Object_obj_mkid_actor_Step_1

(view raw script w/o annotations or w/e)
1
if (d == 0)
2
    scr_depth
scr_depth

depth = 50000 - ((y * 10) + (sprite_height * 10));
();
3
if (follow == 0)
4
    scr_npc_anim
scr_npc_anim

tt = 0; if (myinteract == 3) { if (instance_exists(OBJ_WRITER)) { image_speed = 0.2; if (OBJ_WRITER.halt != 0) tt = 1; } else { tt = 1; } } if (tt == 1) { image_speed = 0; image_index = 0; }
();
5
if (follow == 1)
6
{
7
    tmp_idealy = obj_mainchara.y + 8;
8
    if (room == room_water_waterfall && obj_mainchara.y >= 142)
9
        tmp_idealy = obj_mainchara.y - 2;
10
    if (room == room_water_waterfall2 && obj_mainchara.y >= 906)
11
        tmp_idealy = obj_mainchara.y - 2;
12
    move_towards_point(obj_mainchara.x - 6, tmp_idealy, 2);
13
    image_speed = 0.25;
14
    follow = 2;
15
}
16
if (follow == 2)
17
{
18
    if (collision_point(obj_mainchara.x - 6, obj_mainchara.y + 28, object_index, 0, 0))
19
    {
20
        speed = 0;
21
        follow = 3;
22
    }
23
}
24
if (follow == 2.1)
25
{
26
    image_speed = 0.25;
27
    x -= 4;
28
    done = 0;
29
    if (sprite_index == rsprite || sprite_index == usprite)
30
        move_towards_point(obj_mainchara.x - 2, obj_mainchara.y + 8, 4);
31
    if (sprite_index == lsprite)
32
        move_towards_point(obj_mainchara.x + 6, obj_mainchara.y + 8, 4);
33
    if (sprite_index == dsprite)
34
        move_towards_point(obj_mainchara.x, obj_mainchara.y - 12, 4);
35
    move_towards_point(obj_mainchara.x, obj_mainchara.y, 4);
36
    if (collision_rectangle(obj_mainchara.bbox_left - 6, obj_mainchara.bbox_top - 4, obj_mainchara.bbox_right + 4, obj_mainchara.bbox_bottom + 4, object_index, 0, 0))
37
    {
38
        speed = 0;
39
        follow = 3;
40
    }
41
    x += 4;
42
}
43
alcovecheck = 0;
44
if (room == room_water_waterfall && obj_mainchara.y < 100)
45
{
46
    alcovecheck = 1;
47
    image_speed = 0;
48
    image_index = 0;
49
    sprite_index = usprite;
50
}
51
if (room == room_water_waterfall && y > 156)
52
{
53
    if (obj_mainchara.x > 1518)
54
    {
55
        if (x < 1520)
56
            x += 3;
57
    }
58
}
59
if (follow == 3 && alcovecheck == 0)
60
{
61
    if (obj_mainchara.moving == 1)
62
    {
63
        if (distance_to_object(obj_mainchara) > 12)
64
        {
65
            alarm[3] = 3;
66
            follow = 4;
67
        }
68
        if (distance_to_object(obj_mainchara) > 4 || distance_to_object(obj_mainchara) < 0)
69
        {
70
            if (distance_to_object(obj_mainchara) < 10)
71
                closemove = 1;
72
        }
73
    }
74
    else
75
    {
76
        image_speed = 0;
77
        image_index = 0;
78
    }
79
    facing2 = global.facing;
80
}
81
if (follow == 5)
82
{
83
    scr_npc_watch
scr_npc_watch

if (argument0 == 0) { if (instance_exists(obj_mainchara)) { xdist = (obj_mainchara.x + (obj_mainchara.sprite_width / 2)) - (x + (sprite_width / 2)); ydist = obj_mainchara.bbox_top - bbox_top; if (abs(xdist) >= abs(ydist)) { if (xdist >= 0) sprite_index = rtsprite; else sprite_index = ltsprite; } else if (ydist >= 0) { sprite_index = dtsprite; } else { sprite_index = utsprite; } } } if (argument0 == 1) { if (instance_exists(obj_mainchara)) { xdist = (obj_mainchara.x + (obj_mainchara.sprite_width / 2)) - (x + (sprite_width / 2)); ydist = obj_mainchara.bbox_top - bbox_top; if (abs(xdist) >= abs(ydist)) { if (xdist >= 0) sprite_index = rsprite; else sprite_index = lsprite; } else if (ydist >= 0) { sprite_index = dsprite; } else { sprite_index = usprite; } } }
(1);
84
    follow = 6;
85
    alarm[3] = 3;
86
}
87
if (follow == 7)
88
    follow = 2.1;
89
if (follow == 8)
90
    sprite_index = rtsprite;
91
if (follow == 9)
92
{
93
    if (global.interact == 0)
94
    {
95
        global.interact = 1;
96
        scr_npc_watch
scr_npc_watch

if (argument0 == 0) { if (instance_exists(obj_mainchara)) { xdist = (obj_mainchara.x + (obj_mainchara.sprite_width / 2)) - (x + (sprite_width / 2)); ydist = obj_mainchara.bbox_top - bbox_top; if (abs(xdist) >= abs(ydist)) { if (xdist >= 0) sprite_index = rtsprite; else sprite_index = ltsprite; } else if (ydist >= 0) { sprite_index = dtsprite; } else { sprite_index = utsprite; } } } if (argument0 == 1) { if (instance_exists(obj_mainchara)) { xdist = (obj_mainchara.x + (obj_mainchara.sprite_width / 2)) - (x + (sprite_width / 2)); ydist = obj_mainchara.bbox_top - bbox_top; if (abs(xdist) >= abs(ydist)) { if (xdist >= 0) sprite_index = rsprite; else sprite_index = lsprite; } else if (ydist >= 0) { sprite_index = dsprite; } else { sprite_index = usprite; } } }
(0);
97
        alarm[3] = 3;
98
        follow = 9.1;
99
    }
100
}
101
if (follow == 10.1)
102
{
103
    global.facechoice = 0;
104
    global.msg[0] = 
* So,Delay 11 one time.Wait for input
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("obj_mkid_actor_337")
;
105
    global.msg[1] = 
* We had a school project where
we had to take care of
a flower.Wait for input
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("obj_mkid_actor_338")
;
106
    global.msg[2] = 
* The king -Delay 11 we had to call him
"Mr. Dreemurr" -Delay 11 volunteered
to donate his own flowers.Wait for input
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("obj_mkid_actor_339")
;
107
    global.msg[3] = 
* He ended up coming to school
and teaching the class about
responsibility and stuff.Wait for input
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("obj_mkid_actor_340")
;
108
    global.msg[4] = 
* That got me thinking...Wait for input
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("obj_mkid_actor_341")
;
109
    global.msg[5] = 
* YO!Delay 11
* How COOL would it be if
UNDYNE came to school!?Wait for input
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("obj_mkid_actor_342")
;
110
    global.msg[6] = 
* She could beat up ALL
the teachers!!Wait for inputClose MessageClose Message
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("obj_mkid_actor_343")
;
111
    global.typer = 5;
112
    global.msc = 0;
113
    instance_create(x, y, obj_dialoguer);
114
    follow = 10;
115
}
116
if (follow == 10 && instance_exists(OBJ_WRITER) == 0)
117
{
118
    sprite_index = dsprite;
119
    global.interact = 0;
120
    follow = 2.1;
121
}
122
if (follow == 99)
123
{
124
    if (obj_mainchara.moving == 1)
125
    {
126
        x += (obj_mainchara.x - obj_mainchara.xprevious);
127
        y += (obj_mainchara.y - obj_mainchara.yprevious);
128
        facing = global.facing;
129
        image_speed = obj_mainchara.image_speed;
130
        if (facing == 0)
131
            sprite_index = dsprite;
132
        if (facing == 1)
133
            sprite_index = rsprite;
134
        if (facing == 2)
135
            sprite_index = usprite;
136
        if (facing == 3)
137
            sprite_index = lsprite;
138
    }
139
    else
140
    {
141
        image_speed = 0;
142
        image_index = 0;
143
    }
144
}
145
if (instance_exists(obj_mainchara))
146
{
147
    xfer = obj_mainchara.x;
148
    yfer = obj_mainchara.y;
149
}