Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_b1enemy_Step_0

(view raw script w/o annotations or w/e)
1
if (kris == 0)
2
{
3
    with (obj_mainchara_board)
4
    {
5
        if (name == "kris")
6
            other.kris = id;
7
    }
8
}
9
if (susie == 0)
10
{
11
    with (obj_mainchara_board)
12
    {
13
        if (name == "susie")
14
            other.susie = id;
15
    }
16
}
17
if (ralsei == 0)
18
{
19
    with (obj_mainchara_board)
20
    {
21
        if (name == "ralsei")
22
            other.ralsei = id;
23
    }
24
}
25
if (init == 0)
26
{
27
    if (i_ex(obj_board_tree_static))
28
    {
29
        var image_ind = obj_board_tree_static.image_index;
30
        tree[0] = instance_create(x + 128, y + 192, obj_board_tree_static);
31
        tree[1] = instance_create(x + 160, y + 192, obj_board_tree_static);
32
        tree[2] = instance_create(x + 128, y + -32, obj_board_tree_static);
33
        tree[3] = instance_create(x + 160, y + -32, obj_board_tree_static);
34
        tree[4] = instance_create(x - 32, y + 64, obj_board_tree_static);
35
        tree[5] = instance_create(x - 32, y + 96, obj_board_tree_static);
36
        for (var i = 0; i < array_length(tree); i++)
37
            tree[i].image_index = image_ind;
38
        init = 1;
39
    }
40
}
41
if (active == 1)
42
{
43
    if (con == 0 && obj_board_camera.con == 0)
44
    {
45
        con = 1;
46
        if (visitcon == 0)
47
            visitcon = 1;
48
    }
49
    if (susiewalkcon == 0 && obj_board_camera.con == 0)
50
    {
51
        
scr_pathfind_end
scr_pathfind_end

function
scr_pathfind_end(arg0)
{ with (obj_mainchara_board) { if (name == arg0) { path_end(); path_target_x = -1; path_target_y = -1; is_moving_timer = 0; is_moving = false; } } }
("ralsei");
52
        
scr_pathfind_end
scr_pathfind_end

function
scr_pathfind_end(arg0)
{ with (obj_mainchara_board) { if (name == arg0) { path_end(); path_target_x = -1; path_target_y = -1; is_moving_timer = 0; is_moving = false; } } }
("susie");
53
        ralsei.follow = true;
54
        var enemcount = 0;
55
        with (obj_chaseenemy_board)
56
        {
57
            if (
scr_board_onscreen
scr_board_onscreen

function
scr_board_onscreen()
{ if (x >= 128 && x < 512 && y >= 64 && y <= 320) return 1; else return 0; }
())
58
                enemcount++;
59
        }
60
        if (enemcount == 0)
61
        {
62
            susiewalkcon = 1;
63
            susietime = 0;
64
        }
65
    }
66
    if (susiewalkcon == 1)
67
    {
68
        var weedcount = 0;
69
        with (obj_board_grabbablegrass)
70
        {
71
            if (active)
72
            {
73
                weedcount++;
74
                show_debug_message_concat(weedcount, ": ", xstart, " , ", ystart);
75
            }
76
        }
77
        if (global.flag[1020 got_power_croissant] == 0)
78
            weedcount = 0;
79
        if (weedcount != 0)
80
        {
81
            susiewalkcon = 10;
82
        }
83
        else
84
        {
85
            
scr_pathfind_to_point
scr_pathfind_to_point

function
scr_pathfind_to_point(arg0, arg1, arg2)
{ var __destx = arg1 + 16; var __desty = arg2 + 16; if (arg1 < 12 && arg2 < 8) { __destx = 128 + (32 * arg1) + 16; __desty = 64 + (32 * arg2) + 16; } with (obj_mainchara_board) { if (name == arg0) { path_end(); is_moving_timer = 0; is_moving = true; path_target_x = __destx; path_target_y = __desty; follow = false; if (argument_count == 4) { if (argument3 != -1) path_end_facing = argument3; } if (argument_count == 5) { if (argument4 != -1) allow_diagonals = argument4; } } } }
("susie", 5.5, 4, 0);
86
            susiewalkcon = 2;
87
        }
88
    }
89
    if (susiewalkcon == 2)
90
    {
91
        if (abs(susie.x - board_tilex(5.5)) < 4 && abs(susie.y - board_tiley(4)) < 4)
92
        {
93
            with (susie)
94
                setxy(board_tilex(5.5), board_tiley(4));
95
            
scr_pathfind_end
scr_pathfind_end

function
scr_pathfind_end(arg0)
{ with (obj_mainchara_board) { if (name == arg0) { path_end(); path_target_x = -1; path_target_y = -1; is_moving_timer = 0; is_moving = false; } } }
("susie");
96
            susie.facing = 0;
97
            susiewalkcon = 3;
98
        }
99
    }
100
    if (susiewalkcon == 3)
101
    {
102
        susiewalkcon++;
103
        susie.sleepy = true;
104
        
scr_play_susie_recording
scr_play_susie_recording

function
scr_play_susie_recording(arg0)
{ with (obj_mainchara_board) { if (name == "susie") { susierecordcon = 2; susierecordcount = 0; susierecordstring = arg0; susierecordsave = false; } } }
("0D0D0D0D0D0D0D0RD0R0R0R0R0R0R0R0RU0RU0RU0U0U0U0U0U0U0U0U0U0U0U0U0LU0L0L0L0L0L0L0L0L0L0L0L0L0L0L0L0L0L0L0L0L0LD0D0D0D0D0D0D0D0D0D0D0D0D0RD0RD0R0R0R0R0R0R0R0R0R0R0R0RU0RU0RU0U0U0U0U0U0U0U0U0U0U0U0LU0LU0L0L0L0L0L0L0L0L0L0L0L0LD0D0D0D0D0D0D0D0D0D0D0RD0R0R0R0R0R0R0R0R0RU0RU0RU0U0U0U0U0U0U0U0U0LU0L0L0L0L0L0L0L0L0LD0LD0LD0D0D0D0D0D0RD0RD0R0R0R0R0R0R0R0R0RU0RU0U0U0U0U0U0U0LU0LU0LU0L0L0L0L0L0L0LD0LD0D0D0D0D0D0RD0RD0RD0R0R0R0R0RU0RU0RU0U0U0LU0LU0L0L0LD0D0D0");
105
    }
106
    if (susiewalkcon == 10)
107
    {
108
        targ = instance_nearest(susie.x, susie.y, obj_board_grabbablegrass);
109
        if (i_ex(targ))
110
        {
111
            if (point_in_rectangle(targ.x, targ.y, board_tilex(0), board_tiley(0), board_tilex(11), board_tiley(7)))
112
            {
113
                
scr_pathfind_to_point
scr_pathfind_to_point

function
scr_pathfind_to_point(arg0, arg1, arg2)
{ var __destx = arg1 + 16; var __desty = arg2 + 16; if (arg1 < 12 && arg2 < 8) { __destx = 128 + (32 * arg1) + 16; __desty = 64 + (32 * arg2) + 16; } with (obj_mainchara_board) { if (name == arg0) { path_end(); is_moving_timer = 0; is_moving = true; path_target_x = __destx; path_target_y = __desty; follow = false; if (argument_count == 4) { if (argument3 != -1) path_end_facing = argument3; } if (argument_count == 5) { if (argument4 != -1) allow_diagonals = argument4; } } } }
("susie", targ.x, targ.y, 0);
114
            }
115
            else
116
            {
117
                
scr_pathfind_end
scr_pathfind_end

function
scr_pathfind_end(arg0)
{ with (obj_mainchara_board) { if (name == arg0) { path_end(); path_target_x = -1; path_target_y = -1; is_moving_timer = 0; is_moving = false; } } }
("susie");
118
                targ = -4;
119
                debug_print("no target");
120
                susiewalkcon = 99;
121
                susie.sleepy = true;
122
                
scr_play_susie_recording
scr_play_susie_recording

function
scr_play_susie_recording(arg0)
{ with (obj_mainchara_board) { if (name == "susie") { susierecordcon = 2; susierecordcount = 0; susierecordstring = arg0; susierecordsave = false; } } }
("0W");
123
            }
124
        }
125
        susietime = 0;
126
        susiewalkcon = 11;
127
    }
128
    if (susiewalkcon == 11)
129
    {
130
        if (instance_exists(targ))
131
        {
132
            if (abs(susie.x - targ.x) < 2 && abs(susie.y - targ.y) < 2)
133
            {
134
                
scr_pathfind_end
scr_pathfind_end

function
scr_pathfind_end(arg0)
{ with (obj_mainchara_board) { if (name == arg0) { path_end(); path_target_x = -1; path_target_y = -1; is_moving_timer = 0; is_moving = false; } } }
("susie");
135
                susiewalkcon = 12;
136
            }
137
        }
138
    }
139
    if (susiewalkcon == 12)
140
    {
141
        susietime++;
142
        if (susietime == 5)
143
            
scr_play_susie_recording
scr_play_susie_recording

function
scr_play_susie_recording(arg0)
{ with (obj_mainchara_board) { if (name == "susie") { susierecordcon = 2; susierecordcount = 0; susierecordstring = arg0; susierecordsave = false; } } }
("0101");
144
        if (susietime == 30)
145
            susie.facing = 0;
146
        if (susietime == 60)
147
            susiewalkcon = 0;
148
    }
149
}
150
else
151
{
152
    con = 0;
153
    timer = 0;
154
    susiewalkcon = 0;
155
}
156
if (visitcon == 1)
157
{
158
    if (talkcon == 0)
159
    {
160
        talktimer++;
161
        if (talktimer >= 8)
162
            talkcon++;
163
    }
164
    if (talkcon == 1 && active)
165
    {
166
        with (obj_actor_tenna)
167
            bounce = 1;
168
        var tetalk = stringsetloc(
Enemy!! Careful, brave heroes!!
"Enemy!! Careful, brave heroes!!", "obj_b1enemy_slash_Step_0_gml_145_0"
);
169
        
scr_couchtalk
scr_couchtalk

function scr_couchclear(arg0) { with (obj_couchwriter) { if (speaker == arg0) instance_destroy(); } } function
scr_couchtalk(arg0, arg1)
{ var ix = -1; var iy = -1; if (argument_count >= 6) { ix = argument4; iy = argument5; } var couchtext = instance_create_depth(ix, iy, 5000, obj_couchwriter); couchtext.mystring = arg0; couchtext.speaker = arg1; if (argument_count >= 3) couchtext.cleartext = argument2; if (argument_count >= 4) couchtext.drawtime = argument3; if (argument_count >= 7) couchtext.customsnd = argument6; if (argument_count >= 8) couchtext.customcolor = argument7; if (argument_count >= 9) couchtext.talkrate = argument8; if (argument_count >= 10) couchtext.talklength = argument9; return couchtext; }
(tetalk, "tenna", 2, 90);
170
        talkcon++;
171
    }
172
    if (talkcon == 2)
173
    {
174
        if (obj_board_camera.con != 0)
175
        {
176
            if (obj_board_camera.shift == "right")
177
                debug_message("right");
178
            if (obj_board_camera.shift == "left")
179
                debug_message("left");
180
            visitcon = 200;
181
        }
182
    }
183
}
184
if (visitcon == 200)
185
{
186
    with (obj_actor_tenna)
187
        bounce = 1;
188
    var tetalk = stringsetloc(
Wow, absolutely spineless, folks!!
"Wow, absolutely spineless, folks!!", "obj_b1enemy_slash_Step_0_gml_167_0"
);
189
    
scr_couchtalk
scr_couchtalk

function scr_couchclear(arg0) { with (obj_couchwriter) { if (speaker == arg0) instance_destroy(); } } function
scr_couchtalk(arg0, arg1)
{ var ix = -1; var iy = -1; if (argument_count >= 6) { ix = argument4; iy = argument5; } var couchtext = instance_create_depth(ix, iy, 5000, obj_couchwriter); couchtext.mystring = arg0; couchtext.speaker = arg1; if (argument_count >= 3) couchtext.cleartext = argument2; if (argument_count >= 4) couchtext.drawtime = argument3; if (argument_count >= 7) couchtext.customsnd = argument6; if (argument_count >= 8) couchtext.customcolor = argument7; if (argument_count >= 9) couchtext.talkrate = argument8; if (argument_count >= 10) couchtext.talklength = argument9; return couchtext; }
(tetalk, "tenna", 2);
190
    snd_play_delay(snd_laughtrack_short_temp, 15);
191
    visitcon = 201;
192
}
193
if (visitcon == 1 || visitcon == 201)
194
{
195
    if (i_ex(obj_battleback))
196
        visitcon = 300;
197
}
198
if (visitcon == 300)
199
{
200
    scr_delay_var("visitcon", visitcon + 1, 120);
201
    visitcon = -1;
202
}
203
if (visitcon == 301)
204
{
205
    if (!i_ex(obj_battleback) && global.boardbattleresult == "won" && !i_ex(obj_gameshow_battlemanager))
206
    {
207
        var tetalk = stringsetloc(
A rousing battle! Mike! Give them a free tube yogurt!
"A rousing battle! Mike! Give them a free tube yogurt!", "obj_b1enemy_slash_Step_0_gml_191_0"
);
208
        
scr_couchtalk
scr_couchtalk

function scr_couchclear(arg0) { with (obj_couchwriter) { if (speaker == arg0) instance_destroy(); } } function
scr_couchtalk(arg0, arg1)
{ var ix = -1; var iy = -1; if (argument_count >= 6) { ix = argument4; iy = argument5; } var couchtext = instance_create_depth(ix, iy, 5000, obj_couchwriter); couchtext.mystring = arg0; couchtext.speaker = arg1; if (argument_count >= 3) couchtext.cleartext = argument2; if (argument_count >= 4) couchtext.drawtime = argument3; if (argument_count >= 7) couchtext.customsnd = argument6; if (argument_count >= 8) couchtext.customcolor = argument7; if (argument_count >= 9) couchtext.talkrate = argument8; if (argument_count >= 10) couchtext.talklength = argument9; return couchtext; }
(tetalk, "tenna", 2, 120);
209
        snd_play_delay(snd_applause, 10);
210
        scr_delay_var("visitcon", visitcon + 1, 30);
211
        visitcon = -1;
212
    }
213
}
214
if (visitcon == 302)
215
{
216
    snd_play(snd_wing);
217
    var throwtime = 24;
218
    var yogurt = 
scr_dark_marker
scr_dark_marker

function
scr_dark_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; image_xscale = 2; image_yscale = 2; } return thismarker; }
(-20, 380, spr_gameshow_yogurttube);
219
    with (yogurt)
220
    {
221
        depth = obj_caterpillarchara.depth + 100;
222
        vspeed = -24;
223
        gravity = 2;
224
        hspeed = 10;
225
        friction = 0.24;
226
        
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(id, throwtime);
227
    }
228
    snd_play_delay(snd_item, throwtime);
229
    
scr_var_delay
scr_var_delay

function
scr_var_delay(arg0, arg1, arg2)
{
scr_script_delayed(scr_var, arg2, arg0, arg1);
} function scr_var_delayed(arg0, arg1, arg2) {
scr_script_delayed(scr_var, arg2, arg0, arg1);
} function scr_delay_var(arg0, arg1, arg2) {
scr_script_delayed(scr_var, arg2, arg0, arg1);
}
("visitcon", 303, throwtime + 4);
230
    visitcon = -1;
231
}
232
if (visitcon == 303)
233
{
234
    var sutalk = stringsetloc(
Sweet.
"Sweet.", "obj_b1enemy_slash_Step_0_gml_222_0"
);
235
    
scr_couchtalk
scr_couchtalk

function scr_couchclear(arg0) { with (obj_couchwriter) { if (speaker == arg0) instance_destroy(); } } function
scr_couchtalk(arg0, arg1)
{ var ix = -1; var iy = -1; if (argument_count >= 6) { ix = argument4; iy = argument5; } var couchtext = instance_create_depth(ix, iy, 5000, obj_couchwriter); couchtext.mystring = arg0; couchtext.speaker = arg1; if (argument_count >= 3) couchtext.cleartext = argument2; if (argument_count >= 4) couchtext.drawtime = argument3; if (argument_count >= 7) couchtext.customsnd = argument6; if (argument_count >= 8) couchtext.customcolor = argument7; if (argument_count >= 9) couchtext.talkrate = argument8; if (argument_count >= 10) couchtext.talklength = argument9; return couchtext; }
(sutalk, "susie", 2, 60);
236
    visitcon++;
237
}
238
if (batcon == 0)
239
{
240
    if (x == 160 && y == 96)
241
    {
242
        if (global.fighting == true)
243
            batcon = 1;
244
    }
245
}
246
if (batcon == 1)
247
{
248
    if (global.fighting == false)
249
    {
250
        if (global.boardbattleresult == "won")
251
        {
252
            for (var i = 0; i < array_length(tree); i++)
253
                safe_delete(tree[i]);
254
            
scr_board_gridreset
scr_board_gridreset

function
scr_board_gridreset()
{ with (obj_board_controller) grid_reset = true; }
();
255
            batcon = 2;
256
        }
257
        else
258
        {
259
            batcon = 0;
260
            printval("batcon");
261
        }
262
    }
263
}