Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_mainchara_Create_0

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

function
scr_depth()
{ if (argument_count > 0) { with (argument0) depth = 100000 - ((y * 10) + (sprite_height * 10)); } else { depth = 100000 - ((y * 10) + (sprite_height * 10)); } }
();
2
global.currentroom = scr_get_id_by_room_index(room);
3
scr_initialize_charnames
scr_initialize_charnames

function
scr_initialize_charnames()
{ global.lcharname = stringsetloc(
Kris
"Kris", "scr_gamestart_slash_scr_gamestart_gml_396_0"
);
global.charname[0] = stringsetloc(
" ", "scr_gamestart_slash_scr_gamestart_gml_101_0_b"
);
global.charname[1] = stringsetloc(
Kris
"Kris", "scr_gamestart_slash_scr_gamestart_gml_99_0"
);
global.charname[2] = stringsetloc(
Susie
"Susie", "scr_gamestart_slash_scr_gamestart_gml_100_0"
);
global.charname[3] = stringsetloc(
Ralsei
"Ralsei", "scr_gamestart_slash_scr_gamestart_gml_101_0"
);
global.charname[4] = stringsetloc(
Noelle
"Noelle", "scr_gamestart_slash_scr_gamestart_gml_105_0"
);
}
();
4
autorun = 0;
5
bg = 0;
6
if (instance_exists(obj_backgrounderparent))
7
    bg = 1;
8
stepping = 0;
9
stepped = 0;
10
drawbattlemode = 1;
11
battlemode = 0;
12
battleheart = instance_create(x, y, obj_overworldheart);
13
battleheart.image_alpha = 0;
14
battleheart.image_speed = 0;
15
battlealpha = 0;
16
becamebattle = 0;
17
sliding = 0;
18
becamesword = 0;
19
swordmode = 0;
20
swordcon = 0;
21
swordtimer = 0;
22
stop_movement = 0;
23
roomenterfreezeend = 0;
24
climbing = 0;
25
climbbuffer = 0;
26
floorheight = 0;
27
darkmode = global.darkzone;
28
if (darkmode == 1)
29
{
30
    stepping = 1;
31
    image_xscale = 2;
32
    image_yscale = 2;
33
}
34
cutscene = 0;
35
press_l = 0;
36
press_r = 0;
37
press_d = 0;
38
press_u = 0;
39
px = 0;
40
py = 0;
41
wallcheck = 0;
42
wspeed = 3;
43
bwspeed = 3;
44
if (darkmode == 1)
45
{
46
    bwspeed = 4;
47
    wspeed = 4;
48
}
49
canrun = true;
50
run = 0;
51
runtimer = 0;
52
runcounter = 0;
53
drawdebug = 0;
54
ignoredepth = 0;
55
freeze = 0;
56
subxspeed = 0;
57
subyspeed = 0;
58
subx = 0;
59
suby = 0;
60
walkanim = 0;
61
walkbuffer = 0;
62
walktimer = 0;
63
image_speed = 0;
64
dsprite = spr_krisd;
65
rsprite = spr_krisr;
66
usprite = spr_krisu;
67
lsprite = spr_krisl;
68
climbsprite = 3934;
69
if (global.darkzone == 1)
70
{
71
    dsprite = spr_krisd_dark;
72
    rsprite = spr_krisr_dark;
73
    lsprite = spr_krisl_dark;
74
    usprite = spr_krisu_dark;
75
    if (global.chapter == 3)
76
    {
77
        if (
scr_flag_get
scr_flag_get

function
scr_flag_get(arg0)
{ var flag_value = global.flag[arg0]; return flag_value; }
(1076) == 1 ||
scr_flag_get
scr_flag_get

function
scr_flag_get(arg0)
{ var flag_value = global.flag[arg0]; return flag_value; }
(1077) == 1)
78
            usprite = spr_krisu_dark_cool;
79
    }
80
}
81
swordfacing = 1;
82
swordsprite = rsprite;
83
fun = 0;
84
if (global.facing == 0)
85
    sprite_index = dsprite;
86
if (global.facing == 1)
87
    sprite_index = rsprite;
88
if (global.facing == 2)
89
    sprite_index = usprite;
90
if (global.facing == 3)
91
    sprite_index = lsprite;
92
onebuffer = 0;
93
twobuffer = 0;
94
threebuffer = 0;
95
global.menuno = 0;
96
for (i = 0; i < 10; i += 1)
97
    global.menucoord[i] = 0;
98
cameFromEntrance = global.entrance;
99
if (global.interact == 3)
100
{
101
    noentrancefound = 0;
102
    if (global.entrance > 0)
103
    {
104
        if (global.flag[21 door_freeze_timer] <= 0)
105
        {
106
            global.interact = 0;
107
            global.flag[21 door_freeze_timer] = -10;
108
            roomenterfreezeend = 1;
109
        }
110
        switch (global.entrance)
111
        {
112
            case 1:
113
                if (i_ex(obj_markerA))
114
                    setxy(obj_markerA.x, obj_markerA.y);
115
                else
116
                    noentrancefound = 1;
117
                break;
118
            case 2:
119
                if (i_ex(obj_markerB))
120
                    setxy(obj_markerB.x, obj_markerB.y);
121
                else
122
                    noentrancefound = 1;
123
                break;
124
            case 3:
125
                if (i_ex(obj_markerC))
126
                    setxy(obj_markerC.x, obj_markerC.y);
127
                else
128
                    noentrancefound = 1;
129
                break;
130
            case 4:
131
                if (i_ex(obj_markerD))
132
                    setxy(obj_markerD.x, obj_markerD.y);
133
                else
134
                    noentrancefound = 1;
135
                break;
136
            case 5:
137
                if (i_ex(obj_markerE))
138
                    setxy(obj_markerE.x, obj_markerE.y);
139
                else
140
                    noentrancefound = 1;
141
                break;
142
            case 6:
143
                if (i_ex(obj_markerF))
144
                    setxy(obj_markerF.x, obj_markerF.y);
145
                else
146
                    noentrancefound = 1;
147
                break;
148
            case 18:
149
                if (i_ex(obj_markerr))
150
                    setxy(obj_markerr.x, obj_markerr.y);
151
                else
152
                    noentrancefound = 1;
153
                break;
154
            case 19:
155
                if (i_ex(obj_markers))
156
                    setxy(obj_markers.x, obj_markers.y);
157
                else
158
                    noentrancefound = 1;
159
                break;
160
            case 20:
161
                if (i_ex(obj_markert))
162
                    setxy(obj_markert.x, obj_markert.y);
163
                else
164
                    noentrancefound = 1;
165
                break;
166
            case 21:
167
                if (i_ex(obj_markeru))
168
                    setxy(obj_markeru.x, obj_markeru.y);
169
                else
170
                    noentrancefound = 1;
171
                break;
172
            case 22:
173
                if (i_ex(obj_markerv))
174
                    setxy(obj_markerv.x, obj_markerv.y);
175
                else
176
                    noentrancefound = 1;
177
                break;
178
            case 23:
179
                if (i_ex(obj_markerw))
180
                    setxy(obj_markerw.x, obj_markerw.y);
181
                else
182
                    noentrancefound = 1;
183
                break;
184
            case 24:
185
                if (i_ex(obj_markerX))
186
                    setxy(obj_markerX.x, obj_markerX.y);
187
                else
188
                    noentrancefound = 1;
189
                break;
190
            default:
191
                noentrancefound = 1;
192
        }
193
        if (noentrancefound == 1)
194
        {
195
            if (i_ex(obj_markerAny))
196
            {
197
                with (obj_markerAny)
198
                {
199
                    if (image_index == global.entrance)
200
                    {
201
                        other.x = x;
202
                        other.y = y;
203
                    }
204
                }
205
            }
206
            else
207
            {
208
                setxy(room_width / 2, room_height / 2);
209
                debug_message("entrance not found, setting to center of room");
210
                debug_message("entrance requested was global.entrance=" + string(global.entrance));
211
            }
212
        }
213
    }
214
}
215
initwd = sprite_width;
216
initht = sprite_height;
217
mywidth = sprite_width;
218
myheight = sprite_height;
219
for (i = 0; i < 3; i += 1)
220
    global.battledf[i] = global.df[global.char[i]] + global.itemdf[global.char[i]][0] + global.itemdf[global.char[i]][1] + global.itemdf[global.char[i]][2];
221
if (global.chapter == 2)
222
{
223
    if (global.flag[302 toy_deliver_progress] == 1)
224
        instance_create(x, y, obj_kris_headobj);
225
}
226
227
function check_heightfloor(arg0, arg1, arg2)
228
{
229
    var __onfloor = 0;
230
    var __inst = instance_position(bbox_right + arg0, bbox_top + arg1, arg2);
231
    if (__inst != -4)
232
    {
233
        if (__inst.floorheight == floorheight)
234
            __onfloor++;
235
    }
236
    __inst = instance_position(bbox_right + arg0, bbox_bottom + arg1, arg2);
237
    if (__inst != -4)
238
    {
239
        if (__inst.floorheight == floorheight)
240
            __onfloor++;
241
    }
242
    __inst = instance_position(bbox_left + arg0, bbox_top + arg1, arg2);
243
    if (__inst != -4)
244
    {
245
        if (__inst.floorheight == floorheight)
246
            __onfloor++;
247
    }
248
    __inst = instance_position(bbox_left + arg0, bbox_bottom + arg1, arg2);
249
    if (__inst != -4)
250
    {
251
        if (__inst.floorheight == floorheight)
252
            __onfloor++;
253
    }
254
    if (__onfloor == 4)
255
        __onfloor = 1;
256
    else
257
        __onfloor = 0;
258
    return __onfloor;
259
}
260
261
noclip = false;