Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_heroparent_Step_0

(view raw script w/o annotations or w/e)
1
if (global.hp[global.char[myself]] > 0)
2
{
3
    if (global.myfight == 3 && global.faceaction[myself] == 6 && state != 8)
4
        state = 6;
5
    if (state == 0 && hurt == 0)
6
    {
7
        acttimer = 0;
8
        thissprite = idlesprite;
9
        if (global.faceaction[myself] == 1)
10
            thissprite = attackreadysprite;
11
        if (global.faceaction[myself] == 3)
12
            thissprite = itemreadysprite;
13
        if (global.faceaction[myself] == 2)
14
        {
15
            thissprite = spellreadysprite;
16
            if (i_ex(obj_titan_enemy) && thissprite == spr_susieb_spellready)
17
            {
18
            }
19
        }
20
        if (global.faceaction[myself] == 6)
21
            thissprite = actreadysprite;
22
        if (global.charcond[myself] == 5)
23
        {
24
            thissprite = defeatsprite;
25
            global.faceaction[myself] = 9;
26
        }
27
        if (global.faceaction[myself] == 4)
28
        {
29
            thissprite = defendsprite;
30
            index = defendtimer;
31
            if (defendtimer < defendframes)
32
                defendtimer += 0.5;
33
        }
34
        else
35
        {
36
            defendtimer = 0;
37
            index = siner / 5;
38
        }
39
        siner += 1;
40
    }
41
    if (state == 1 && hurt == 0)
42
    {
43
        siner += 1;
44
        if (attacked == 0)
45
        {
46
            snd_stop(snd_laz_c);
47
            if (object_index == obj_herokris)
48
                snd_play(snd_laz_c);
49
            if (object_index == obj_heroralsei)
50
            {
51
                ls = snd_play(snd_laz_c);
52
                snd_pitch(ls, 1.15);
53
            }
54
            if (object_index == obj_herosusie)
55
            {
56
                ls = snd_play(snd_laz_c);
57
                snd_pitch(ls, 0.9);
58
            }
59
            if (object_index == obj_heronoelle)
60
            {
61
                ls = snd_play(snd_laz_c);
62
                snd_pitch(ls, 1.5);
63
            }
64
            if (global.chapter == 4 && i_ex(obj_sound_of_justice_enemy) && object_index == obj_herokris)
65
            {
66
                _ripple = instance_create(obj_herokris.x + 30, obj_herokris.y + 48, obj_church_old_man_ripple_effect);
67
                _ripple.type = 2;
68
                _ripple.version = 1;
69
                _ripple.color = merge_color(c_aqua, c_black, 0);
70
                _ripple.colorstart = 16776960;
71
            }
72
            if (global.chapter == 4 && i_ex(obj_sound_of_justice_enemy) && object_index == obj_herosusie)
73
            {
74
                _ripple = instance_create(camerax() + 140, cameray() + 198, obj_church_old_man_ripple_effect);
75
                _ripple.type = 2;
76
                _ripple.version = 1;
77
                _ripple.color = merge_color(c_fuchsia, c_black, 0);
78
                _ripple.colorstart = 16711935;
79
            }
80
            if (global.chapter == 4 && i_ex(obj_hammer_of_justice_enemy))
81
                obj_hammer_of_justice_enemy.haveattacked = true;
82
            if (points == 150)
83
            {
84
                snd_stop(snd_criticalswing);
85
                snd_play(snd_criticalswing);
86
                repeat (3)
87
                {
88
                    anim = instance_create(x + mywidth + random(50), y + 30 + random(30), obj_afterimage);
89
                    anim.sprite_index = spr_lightfairy;
90
                    anim.image_speed = 0.25;
91
                    anim.depth = -20;
92
                    anim.image_xscale = 2;
93
                    anim.image_yscale = 2;
94
                    anim.hspeed = 2 + random(4);
95
                    anim.friction = -0.25;
96
                }
97
            }
98
            attacked = 1;
99
            finishattacktimer = 11;
100
        }
101
        if (attacktimer < attackframes)
102
            image_index = attacktimer;
103
        else
104
            image_index = attackframes;
105
        thissprite = attacksprite;
106
        index = image_index;
107
        attacktimer += attackspeed;
108
        if (force == 1 && image_index == attackframes)
109
        {
110
            force = 0;
111
            state = 0;
112
            attacktimer = 0;
113
            attacked = 0;
114
        }
115
    }
116
    if (state == 2 && hurt == 0)
117
    {
118
        siner += 1;
119
        if (itemed == 0)
120
        {
121
            itemed = 1;
122
            spelltimer = 16;
123
        }
124
        if (attacktimer < spellframes && spellframes != 0)
125
            image_index = attacktimer;
126
        else
127
            image_index = spellframes;
128
        if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
129
            attacktimer = 0;
130
        thissprite = spellsprite;
131
        if (thissprite == spr_susieb_spell && i_ex(obj_titan_enemy) && i_ex(obj_rudebuster_anim))
132
        {
133
            obj_titan_enemy.gerson.sprite_index = spr_gerson_rudebuster_ready2;
134
            obj_titan_enemy.gerson.image_index = 0;
135
        }
136
        index = image_index;
137
        attacktimer += 0.5;
138
        if (force == 1 && image_index == attackframes)
139
        {
140
            force = 0;
141
            state = 0;
142
            attacktimer = 0;
143
            itemed = 0;
144
        }
145
    }
146
    if (state == 4 && hurt == 0)
147
    {
148
        siner += 1;
149
        if (itemed == 0)
150
        {
151
            itemed = 1;
152
            spelltimer = 16;
153
        }
154
        if (attacktimer < itemframes)
155
            image_index = attacktimer;
156
        else
157
            image_index = itemframes;
158
        if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
159
            attacktimer = 0;
160
        index = image_index;
161
        thissprite = itemsprite;
162
        attacktimer += 0.5;
163
        if (global.chapter == 4 && i_ex(obj_hammer_of_justice_enemy) && attacktimer == 2)
164
            instance_create(obj_heroparent.x + 63, obj_heroparent.y + 60, obj_gerson_item_throw);
165
    }
166
    if (state == 6)
167
    {
168
        if (global.myfight == 3)
169
        {
170
            if (acttimer < actframes)
171
                acttimer += 0.5;
172
        }
173
        else
174
        {
175
            acttimer += 0.5;
176
        }
177
        thissprite = actsprite;
178
        index = acttimer;
179
        if (acttimer >= actreturnframes)
180
        {
181
            acttimer = 0;
182
            state = 0;
183
            global.faceaction[myself] = 0;
184
        }
185
    }
186
    if (state == 7)
187
    {
188
        hurt = 0;
189
        hurttimer = 0;
190
        if (_sideb == 1 && _victoried == 0)
191
        {
192
            _victorysequence = instance_create(x, y, obj_noellevictory_example);
193
            _victorysequence.depth = depth - 1;
194
            _victoried = 1;
195
            image_alpha = 0;
196
        }
197
        if (victoryanim < victoryframes)
198
        {
199
            thissprite = victorysprite;
200
            index = victoryanim;
201
            victoryanim += 0.334;
202
        }
203
        else
204
        {
205
            thissprite = normalsprite;
206
            index = 0;
207
        }
208
    }
209
    if (state == 8)
210
    {
211
        if ((image_index + image_speed) >= maxframes && maxframes != 0)
212
        {
213
            state = 0;
214
            hurt = 0;
215
            attacktimer = 0;
216
            maxframes = 0;
217
            global.faceaction[myself] = 0;
218
            thissprite = idlesprite;
219
        }
220
    }
221
    if (hurt == 1 && global.hp[global.char[myself]] > 0)
222
    {
223
        hurtindex = hurttimer / 2;
224
        if (hurtindex > 2)
225
            hurtindex = 2;
226
        if (global.charcond[myself] == 5)
227
        {
228
            global.faceaction[myself] = 5;
229
            global.charmove[myself] = 1;
230
            global.charcond[myself] = 0;
231
        }
232
        if (global.faceaction[myself] == 0)
233
            global.faceaction[myself] = 5;
234
        if (hurttimer > 15)
235
        {
236
            hurttimer = 0;
237
            hurt = 0;
238
            if (global.faceaction[myself] == 5)
239
                global.faceaction[myself] = 0;
240
        }
241
        hurttimer += 1;
242
    }
243
}
244
else
245
{
246
    global.charcond[myself] = 0;
247
    hurttimer = 0;
248
    hurt = 0;
249
    thissprite = defeatsprite;
250
    index = 0;
251
    siner += 1;
252
}
253
if (global.targeted[myself] != 1)
254
{
255
    if (combatdarken == 1 && instance_exists(obj_darkener))
256
    {
257
        if (darkify == 1)
258
        {
259
            if (darkentimer < 15)
260
                darkentimer += 1;
261
            image_blend = merge_color(c_white, c_black, darkentimer / 30);
262
        }
263
    }
264
}
265
if (darkify == 0)
266
{
267
    if (darkentimer > 0)
268
        darkentimer -= 3;
269
    image_blend = merge_color(c_white, c_black, darkentimer / 30);
270
}
271
if (poisonamount > 0)
272
{
273
    poisontimer++;
274
    if (poisontimer >= 10)
275
    {
276
        if (global.hp[global.char[myself]] > 1)
277
        {
278
            global.hp[global.char[myself]]--;
279
            poisonamount--;
280
        }
281
        else
282
        {
283
            poisonamount = 0;
284
        }
285
        poisontimer = 0;
286
    }
287
}
288
if (finishattacktimer > 0)
289
{
290
    finishattacktimer--;
291
    if (finishattacktimer == 0)
292
    {
293
        global.faceaction[myself] = 0;
294
        
scr_retarget
scr_retarget

function
scr_retarget(arg0)
{ thistarget = global.chartarget[arg0]; cancelattack = 0; if (thistarget == 0) { if (global.monster[0] == 0) thistarget = 1; } if (thistarget == 1) { if (global.monster[1] == 0) thistarget = 2; } if (thistarget == 2) { if (global.monster[2] == 0) thistarget = 3; if (thistarget == 3 && global.monster[0] == 1) thistarget = 0; if (thistarget == 3 && global.monster[1] == 1) thistarget = 1; if (thistarget == 3) cancelattack = 1; } global.chartarget[arg0] = thistarget; }
(myself);
295
        if (cancelattack == 0)
296
        {
297
            damage = round(((global.battleat[myself] * points) / 20) - (global.monsterdf[global.chartarget[myself]] * 3));
298
            if (global.chapter == 4)
299
            {
300
                if (object_index == obj_herokris && (
scr_weaponcheck_equipped
scr_weaponcheck_equipped

function
scr_weaponcheck_equipped(arg0, arg1)
{ var __equipped = 0; if (global.charweapon[arg0] == arg1) __equipped++; return __equipped; }
(1, 26) ||
scr_weaponcheck_equipped
scr_weaponcheck_equipped

function
scr_weaponcheck_equipped(arg0, arg1)
{ var __equipped = 0; if (global.charweapon[arg0] == arg1) __equipped++; return __equipped; }
(1, 11)))
301
                {
302
                    if (i_ex(obj_titan_enemy))
303
                    {
304
                        if ((obj_titan_enemy.unleashed && obj_titan_enemy.drawstate != "defense end" && obj_titan_enemy.drawstate != "defense" && obj_titan_enemy.starshootcon > 0) || obj_titan_enemy.drawstate == "crack")
305
                            damage = ceil(damage * 10 * obj_titan_enemy.unleashmultiplier);
306
                        else if (obj_titan_enemy.drawstate == "defense end" || obj_titan_enemy.drawstate == "defense")
307
                            damage = ceil(damage * 0.1);
308
                        else
309
                            damage = ceil(damage * 3);
310
                    }
311
                    else if (i_ex(obj_titan_spawn_enemy))
312
                    {
313
                        damage = ceil(damage * 10);
314
                    }
315
                }
316
                else if (i_ex(obj_titan_enemy))
317
                {
318
                    if ((obj_titan_enemy.unleashed && obj_titan_enemy.drawstate != "defense end" && obj_titan_enemy.drawstate != "defense" && obj_titan_enemy.starshootcon > 0) || obj_titan_enemy.drawstate == "crack")
319
                        damage = ceil(damage * 5 * obj_titan_enemy.unleashmultiplier);
320
                    else if (obj_titan_enemy.drawstate == "defense end" || obj_titan_enemy.drawstate == "defense")
321
                        damage = ceil(damage * 0.1);
322
                    else
323
                        damage = ceil(damage * 0.5);
324
                }
325
                else if (i_ex(obj_titan_spawn_enemy))
326
                {
327
                }
328
            }
329
            
scr_damage_enemy
scr_damage_enemy

function
scr_damage_enemy(arg0, arg1)
{ dm = instance_create(global.monsterx[arg0], (global.monstery[arg0] + 20) - (global.hittarget[arg0] * 20), obj_dmgwriter); if (caster < 4) { dm.type = global.char[caster] - 1; if (global.char[caster] == 4) dm.type = 6; } if (caster == 5) dm.type = 5; dm.damage = arg1; global.monsterhp[arg0] -= arg1; if (arg1 > 0) { with (global.monsterinstance[arg0]) { shakex = 9; state = 3; hurttimer = 30; } if (i_ex(global.monsterinstance[arg0])) global.monsterinstance[arg0].hurtamt = arg1; } global.hittarget[arg0] += 1; if (arg1 == 0) { with (global.monsterinstance[arg0]) { hurtamt = 0; if (hurttimer <= 15 && candodge == 1) { dodgetimer = 0; state = 4; } } } var a = 0; if (global.chapter == 4 && i_ex(obj_titan_enemy)) { if (global.monsterhp[arg0] < 1) global.monsterhp[arg0] = 1; } if (global.monsterhp[arg0] <= 0 && a == 0) { with (global.monsterinstance[arg0])
scr_monsterdefeat();
} }
(global.chartarget[myself], damage);
330
            dm.type = char - 1;
331
            if (char == 4)
332
                dm.type = 6;
333
            dm.delay = 8;
334
            if (object_index == obj_herosusie && 
scr_weaponcheck_equipped_any
scr_weaponcheck_equipped_any

function
scr_weaponcheck_equipped_any(arg0)
{ var __totalwearing = 0; for (var __weari = 0; __weari < array_length_1d(global.charweapon); __weari++) __totalwearing +=
scr_weaponcheck_equipped(__weari, arg0);
return __totalwearing; }
(54))
335
            {
336
                star = 1;
337
                var healamt = ceil(global.maxhp[2] * 0.1);
338
                if (i_ex(obj_sound_of_justice_enemy) || i_ex(obj_hammer_of_justice_enemy))
339
                {
340
                    healamt = 2;
341
                    star = 0;
342
                }
343
                
scr_healitemspell
scr_healitemspell

function
scr_healitemspell(arg0)
{ var __healAmount = arg0;
scr_heal(star, __healAmount);
global.spelldelay = 15; with (global.charinstance[star]) { ha = instance_create(x, y, obj_healanim); ha.target = id; dmgwr =
scr_dmgwriter_selfchar();
with (dmgwr) { delay = 8; type = 3; damage = arg0; } if (global.hp[global.char[myself]] >= global.maxhp[global.char[myself]]) { with (dmgwr) specialmessage = 3; } tu += 1; return ha; } }
(healamt);
344
            }
345
            if (damage > 0)
346
            {
347
                if (i_ex(obj_titan_enemy) || i_ex(obj_titan_spawn_enemy) || i_ex(obj_jackenstein_enemy) || i_ex(obj_sound_of_justice_enemy))
348
                    
scr_tensionheal
scr_tensionheal

function
scr_tensionheal(arg0)
{ if (i_ex(obj_jackenstein_enemy) && global.tempflag[89] >= 3) global.tension += ceil(arg0 * 1.5); else global.tension += arg0; if (global.tension > global.maxtension) global.tension = global.maxtension; }
(round(points / 26));
349
                else
350
                    
scr_tensionheal
scr_tensionheal

function
scr_tensionheal(arg0)
{ if (i_ex(obj_jackenstein_enemy) && global.tempflag[89] >= 3) global.tension += ceil(arg0 * 1.5); else global.tension += arg0; if (global.tension > global.maxtension) global.tension = global.maxtension; }
(round(points / 10));
351
                attack = instance_create(global.monsterx[global.chartarget[myself]] + random(6), global.monstery[global.chartarget[myself]] + random(6), obj_basicattack);
352
                if (object_index == obj_herokris && i_ex(obj_titan_enemy) && (obj_titan_enemy.drawstate == "defense" || obj_titan_enemy.drawstate == "defense end"))
353
                {
354
                    attack.sprite_index = spr_attack_slap1_purple;
355
                    attack.maxindex = 4;
356
                    attack.image_speed = 0.5;
357
                }
358
                if (object_index == obj_herosusie)
359
                {
360
                    if (i_ex(obj_titan_enemy) && (obj_titan_enemy.drawstate == "defense" || obj_titan_enemy.drawstate == "defense end"))
361
                    {
362
                        attack.sprite_index = spr_attack_slap1_purple;
363
                        attack.maxindex = 4;
364
                        attack.image_speed = 0.5;
365
                    }
366
                    else
367
                    {
368
                        attack.sprite_index = spr_attack_mash2;
369
                        attack.image_speed = 0.5;
370
                        attack.maxindex = 4;
371
                        snd_play(snd_impact);
372
                        instance_create(0, 0, obj_shake);
373
                    }
374
                }
375
                if (object_index == obj_heroralsei)
376
                {
377
                    attack.sprite_index = spr_attack_slap1;
378
                    attack.maxindex = 4;
379
                    attack.image_speed = 0.5;
380
                }
381
                if (object_index == obj_heronoelle)
382
                {
383
                    attack.sprite_index = spr_attack_slap2;
384
                    attack.maxindex = 4;
385
                    attack.image_speed = 0.5;
386
                }
387
                if (global.charweapon[global.char[myself]] == 26)
388
                {
389
                    attack.sprite_index = spr_attack_shard;
390
                    attack.image_speed = 0.334;
391
                }
392
                if (points == 150)
393
                {
394
                    attack.image_xscale = 2.5;
395
                    attack.image_yscale = 2.5;
396
                }
397
                with (global.monsterinstance[global.chartarget[myself]])
398
                {
399
                    shakex = 9;
400
                    state = 3;
401
                    hurttimer = 30;
402
                }
403
                if (instance_exists(global.monsterinstance[global.chartarget[myself]]))
404
                    global.monsterinstance[global.chartarget[myself]].hurtamt = damage;
405
            }
406
        }
407
    }
408
}
409
if (spelltimer > 0)
410
{
411
    spelltimer--;
412
    if (spelltimer == 0)
413
    {
414
        if (spellframes > 0)
415
            global.faceaction[myself] = 0;
416
        if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() > 0)
417
            
scr_spell
scr_spell

function
scr_spell(arg0, arg1)
{ spell = arg0; caster = arg1; star = global.chartarget[arg1]; global.spelldelay = 10; var item_use = false; if (global.chapter == 4 && i_ex(obj_hammer_of_justice_enemy) && spell != 4 && spell != 5 && spell != 11 && spell != 100) { if (obj_hammer_of_justice_enemy.justice_item < 1) obj_hammer_of_justice_enemy.justice_item++; global.spelldelay = 300; exit; } switch (spell) { case 0: break; case 1: cancelattack = 0; if (global.monster[star] == 0)
scr_retarget_spell();
if (cancelattack == 0) { damage = ceil(
scr_heal_amount_modify_by_equipment((global.battleat[arg1] * 10) - (global.monsterdf[star] * 3)));
if (global.automiss[star] == 1) damage = 0;
scr_damage_enemy(star, damage);
attack = instance_create(global.monsterx[star] + random(6), global.monstery[star] + random(6), obj_basicattack); attack.sprite_index = spr_attack_mash1; dm.delay = 8; } global.spelldelay = 30; break; case 2: healnum = ceil(
scr_heal_amount_modify_by_equipment(global.battlemag[arg1] * 5));
scr_heal(star, healnum);
global.charinstance[star].healnum = healnum; with (global.charinstance[star]) { ha = instance_create(x, y, obj_healanim); ha.target = id; dmgwr =
scr_dmgwriter_selfchar();
with (dmgwr) { delay = 8; type = 3; } if (global.hp[global.char[myself]] >= global.maxhp[global.char[myself]]) { with (dmgwr) specialmessage = 3; } dmgwr.damage = healnum; tu += 1; } global.spelldelay = 15; break; case 3: if (global.monster[star] == 0)
scr_retarget_spell();
if (global.monster[star] == 1) { if (global.monsterstatus[star] == 1) { with (global.monsterinstance[star]) { if (global.monstertype[myself] != 19 && global.monstertype[myself] != 3 && global.monstertype[myself] != 52 && global.monstertype[myself] != 43Berdly (coaster)) { var yoffy; if (global.monstertype[myself] == 33Werewire) yoffy = -60; else yoffy = 0; _pspell = instance_create(global.monsterx[myself], global.monstery[myself] + yoffy, obj_pacifyspell); _pspell.con = 20; _pspell.target = id; global.flag[51 + myself] = 3; event_user(10);
scr_monsterdefeat();
} else { if (global.monstertype[myself] == 52Jigsaw Joe) { _pspell = instance_create(global.monsterx[myself], global.monstery[myself], obj_pacifyspell); _pspell.con = 20; _pspell.target = id; } pacifycon = 1; global.spelldelay = 999; } } } else { if (global.monstertype[myself] == 52Jigsaw Joe) pacifycon = -2; _pspell = instance_create(0, 0, obj_pacifyspell); _pspell.target = global.monsterinstance[star]; _pspell.fail = 1; ...
(global.charspecial[myself], myself);
418
        state = 0;
419
        attacktimer = 0;
420
    }
421
}