Deltarune (Chapter 3) 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 (gachapondead)
4
    {
5
        gachapondead = false;
6
        x = xstart;
7
        y = ystart;
8
    }
9
    if (global.myfight == 3 && global.faceaction[myself] == 6 && state != 8)
10
        state = 6;
11
    if (state == 0 && hurt == 0)
12
    {
13
        acttimer = 0;
14
        thissprite = idlesprite;
15
        if (global.faceaction[myself] == 1)
16
            thissprite = attackreadysprite;
17
        if (global.faceaction[myself] == 3)
18
            thissprite = itemreadysprite;
19
        if (global.faceaction[myself] == 2)
20
            thissprite = spellreadysprite;
21
        var drawact = true;
22
        if (global.faceaction[myself] == 6 && drawact == true)
23
            thissprite = actreadysprite;
24
        if (global.charcond[myself] == 5)
25
        {
26
            thissprite = defeatsprite;
27
            global.faceaction[myself] = 9;
28
        }
29
        if (global.faceaction[myself] == 4)
30
        {
31
            thissprite = defendsprite;
32
            index = defendtimer;
33
            if (defendtimer < defendframes)
34
                defendtimer += 0.5;
35
        }
36
        else
37
        {
38
            defendtimer = 0;
39
            index = siner / 5;
40
        }
41
        siner += 1;
42
    }
43
    if (state == 1 && hurt == 0)
44
    {
45
        siner += 1;
46
        if (attacked == 0)
47
        {
48
            snd_stop(snd_laz_c);
49
            if (object_index == obj_herokris)
50
                snd_play(snd_laz_c);
51
            if (object_index == obj_heroralsei)
52
            {
53
                ls = snd_play(snd_laz_c);
54
                snd_pitch(ls, 1.15);
55
            }
56
            if (object_index == obj_herosusie)
57
            {
58
                ls = snd_play(snd_laz_c);
59
                snd_pitch(ls, 0.9);
60
            }
61
            if (object_index == obj_heronoelle)
62
            {
63
                ls = snd_play(snd_laz_c);
64
                snd_pitch(ls, 1.5);
65
            }
66
            if (points == 150)
67
            {
68
                snd_stop(snd_criticalswing);
69
                snd_play(snd_criticalswing);
70
                repeat (3)
71
                {
72
                    anim = instance_create(x + mywidth + random(50), y + 30 + random(30), obj_afterimage);
73
                    anim.sprite_index = spr_lightfairy;
74
                    anim.image_speed = 0.25;
75
                    anim.depth = -20;
76
                    anim.image_xscale = 2;
77
                    anim.image_yscale = 2;
78
                    anim.hspeed = 2 + random(4);
79
                    anim.friction = -0.25;
80
                }
81
            }
82
            attacked = 1;
83
            finishattacktimer = 11;
84
        }
85
        if (attacktimer < attackframes)
86
            image_index = attacktimer;
87
        else
88
            image_index = attackframes;
89
        thissprite = attacksprite;
90
        index = image_index;
91
        attacktimer += attackspeed;
92
        if (force == 1 && image_index == attackframes)
93
        {
94
            force = 0;
95
            state = 0;
96
            attacktimer = 0;
97
            attacked = 0;
98
        }
99
    }
100
    if (state == 2 && hurt == 0)
101
    {
102
        siner += 1;
103
        if (itemed == 0)
104
        {
105
            itemed = 1;
106
            spelltimer = 16;
107
        }
108
        if (attacktimer < spellframes && spellframes != 0)
109
            image_index = attacktimer;
110
        else
111
            image_index = spellframes;
112
        if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
113
            attacktimer = 0;
114
        thissprite = spellsprite;
115
        index = image_index;
116
        attacktimer += 0.5;
117
        if (force == 1 && image_index == attackframes)
118
        {
119
            force = 0;
120
            state = 0;
121
            attacktimer = 0;
122
            itemed = 0;
123
        }
124
    }
125
    if (state == 4 && hurt == 0)
126
    {
127
        siner += 1;
128
        if (itemed == 0)
129
        {
130
            itemed = 1;
131
            spelltimer = 16;
132
        }
133
        if (attacktimer < itemframes)
134
            image_index = attacktimer;
135
        else
136
            image_index = itemframes;
137
        if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
138
            attacktimer = 0;
139
        index = image_index;
140
        thissprite = itemsprite;
141
        attacktimer += 0.5;
142
    }
143
    if (state == 6)
144
    {
145
        if (global.myfight == 3)
146
        {
147
            if (acttimer < actframes)
148
                acttimer += 0.5;
149
        }
150
        else
151
        {
152
            acttimer += 0.5;
153
        }
154
        thissprite = actsprite;
155
        index = acttimer;
156
        if (acttimer >= actreturnframes)
157
        {
158
            acttimer = 0;
159
            state = 0;
160
            global.faceaction[myself] = 0;
161
            with (obj_tenna_board4_gacha)
162
            {
163
                if (actor_target == 1411)
164
                    xx = 0;
165
            }
166
        }
167
    }
168
    if (state == 7)
169
    {
170
        hurt = 0;
171
        hurttimer = 0;
172
        if (_sideb == 1 && _victoried == 0)
173
        {
174
            _victorysequence = instance_create(x, y, obj_noellevictory_example);
175
            _victorysequence.depth = depth - 1;
176
            _victoried = 1;
177
            image_alpha = 0;
178
        }
179
        if (victoryanim < victoryframes)
180
        {
181
            thissprite = victorysprite;
182
            index = victoryanim;
183
            victoryanim += 0.334;
184
        }
185
        else
186
        {
187
            thissprite = normalsprite;
188
            index = 0;
189
        }
190
    }
191
    if (state == 8)
192
    {
193
        if ((image_index + image_speed) >= maxframes && maxframes != 0)
194
        {
195
            state = 0;
196
            hurt = 0;
197
            attacktimer = 0;
198
            maxframes = 0;
199
        }
200
    }
201
    if (hurt == 1 && global.hp[global.char[myself]] > 0)
202
    {
203
        hurtindex = hurttimer / 2;
204
        if (hurtindex > 2)
205
            hurtindex = 2;
206
        if (global.charcond[myself] == 5)
207
        {
208
            global.faceaction[myself] = 5;
209
            global.charmove[myself] = 1;
210
            global.charcond[myself] = 0;
211
        }
212
        if (global.faceaction[myself] == 0)
213
            global.faceaction[myself] = 5;
214
        if (hurttimer > 15)
215
        {
216
            hurttimer = 0;
217
            hurt = 0;
218
            if (global.faceaction[myself] == 5)
219
                global.faceaction[myself] = 0;
220
        }
221
        hurttimer += 1;
222
    }
223
    if (gotupcon == 1)
224
    {
225
        gotupcon = 0;
226
        if (global.chapter == 3 && i_ex(obj_tennabattleconvo_controller))
227
        {
228
            snd_stop(snd_applause_single);
229
            snd_play(snd_applause_single);
230
        }
231
    }
232
}
233
else
234
{
235
    global.charcond[myself] = 0;
236
    hurttimer = 0;
237
    hurt = 0;
238
    if (object_index == obj_herosusie && global.encounterno == 115 && global.chapter == 3)
239
        defeatsprite = spr_susie_dw_fell;
240
    if (gachapondead == false && i_ex(obj_tenna_board4_enemy))
241
    {
242
        gachapondead = true;
243
        if (object_index == obj_herosusie)
244
            x -= 32;
245
        if (object_index == obj_herosusie)
246
            y -= 20;
247
        if (object_index == obj_heroralsei)
248
            y -= 16;
249
    }
250
    thissprite = defeatsprite;
251
    index = 0;
252
    siner += 1;
253
    if (global.chapter == 3 && i_ex(obj_tennabattleconvo_controller) && gotupcon == 0)
254
    {
255
        obj_tennabattleconvo_controller.herodowned = true;
256
        snd_stop(snd_crowd_gasp);
257
        snd_play(snd_crowd_gasp);
258
        gotupcon = 1;
259
    }
260
}
261
if (global.targeted[myself] != 1)
262
{
263
    if (combatdarken == 1 && instance_exists(obj_darkener))
264
    {
265
        if (darkify == 1)
266
        {
267
            if (darkentimer < 15)
268
                darkentimer += 1;
269
            image_blend = merge_color(c_white, c_black, darkentimer / 30);
270
        }
271
    }
272
}
273
if (darkify == 0)
274
{
275
    if (darkentimer > 0)
276
        darkentimer -= 3;
277
    image_blend = merge_color(c_white, c_black, darkentimer / 30);
278
}
279
if (poisonamount > 0)
280
{
281
    poisontimer++;
282
    if (poisontimer >= 10)
283
    {
284
        if (global.hp[global.char[myself]] > 1)
285
        {
286
            global.hp[global.char[myself]]--;
287
            poisonamount--;
288
        }
289
        else
290
        {
291
            poisonamount = 0;
292
        }
293
        poisontimer = 0;
294
    }
295
}
296
if (finishattacktimer > 0)
297
{
298
    finishattacktimer--;
299
    if (finishattacktimer == 0)
300
    {
301
        global.faceaction[myself] = 0;
302
        
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);
303
        var knightblock = 0;
304
        if (global.chapter == 3 && i_ex(obj_knight_enemy) && obj_knight_enemy.blocking == 1 && obj_knight_enemy.damagereduction < 0.1)
305
            knightblock = 1;
306
        if (cancelattack == 0)
307
        {
308
            damage = round(((global.battleat[myself] * points) / 20) - (global.monsterdf[global.chartarget[myself]] * 3));
309
            if (global.chapter == 3 && i_ex(obj_knight_enemy))
310
            {
311
                damage = ceil(damage * obj_knight_enemy.damagereduction);
312
                if (object_index == obj_herokris)
313
                {
314
                    if (global.hp[2] < 0 && global.hp[3] < 0)
315
                        damage *= 2;
316
                    else if (global.hp[2] < 0 || global.hp[3] < 0)
317
                        damage *= 1;
318
                    else
319
                        damage = round(damage * 0.5);
320
                }
321
            }
322
            if (i_ex(obj_tenna_enemy) && normalsprite == spr_krisr_dark)
323
            {
324
                if (obj_tenna_enemy.didkrisdoswordroute == true)
325
                    damage = ceil(damage * 3);
326
                if (obj_tenna_enemy.didkrisdoswordroute == false)
327
                    damage = ceil(damage * 0.5);
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 (global.chapter == 3 && i_ex(obj_knight_enemy) && arg1 >= 100) obj_knight_enemy.stronghurtanim = true; } 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.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 (damage > 0)
335
            {
336
                
scr_tensionheal
scr_tensionheal

function
scr_tensionheal(arg0)
{ global.tension += arg0; if (global.tension > global.maxtension) global.tension = global.maxtension; if (global.chapter == 3 && i_ex(obj_gameshow_battlemanager)) obj_gameshow_battlemanager.tpgained += arg0; if (global.chapter == 3) { obj_battlecontroller.mercytotal += arg0; if (obj_battlecontroller.mercytotal < 0) obj_battlecontroller.mercytotal = 0; if (obj_battlecontroller.mercytotal >= 250) obj_battlecontroller.mercytotal = 250; } }
(round(points / 10));
337
                if (knightblock == 1)
338
                    obj_knight_enemy.blockanim = 1;
339
                if (knightblock == 0)
340
                {
341
                    attack = instance_create(global.monsterx[global.chartarget[myself]] + random(6), global.monstery[global.chartarget[myself]] + random(6), obj_basicattack);
342
                    if (object_index == obj_herosusie)
343
                    {
344
                        attack.sprite_index = spr_attack_mash2;
345
                        attack.image_speed = 0.5;
346
                        attack.maxindex = 4;
347
                        snd_play(snd_impact);
348
                        instance_create(0, 0, obj_shake);
349
                    }
350
                    if (object_index == obj_heroralsei)
351
                    {
352
                        attack.sprite_index = spr_attack_slap1;
353
                        attack.maxindex = 4;
354
                        attack.image_speed = 0.5;
355
                    }
356
                    if (object_index == obj_heronoelle)
357
                    {
358
                        attack.sprite_index = spr_attack_slap2;
359
                        attack.maxindex = 4;
360
                        attack.image_speed = 0.5;
361
                    }
362
                    if (global.charweapon[global.char[myself]] == 26)
363
                    {
364
                        attack.sprite_index = spr_attack_shard;
365
                        attack.image_speed = 0.334;
366
                    }
367
                    if (points == 150)
368
                    {
369
                        attack.image_xscale = 2.5;
370
                        attack.image_yscale = 2.5;
371
                    }
372
                }
373
            }
374
        }
375
    }
376
}
377
if (spelltimer > 0)
378
{
379
    spelltimer--;
380
    if (spelltimer == 0)
381
    {
382
        if (spellframes > 0)
383
            global.faceaction[myself] = 0;
384
        if (
scr_monsterpop
scr_monsterpop

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

function
scr_spell(arg0, arg1)
{ spell = arg0; caster = arg1; star = global.chartarget[arg1]; global.spelldelay = 10; var item_use = false; switch (spell) { case 0: break; case 1: cancelattack = 0; if (global.monster[star] == 0)
scr_retarget_spell();
if (cancelattack == 0) { damage = ceil((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: var _buff = 0; healnum =
scr_heal_amount_modify_by_equipment(global.battlemag[arg1] * (5 + _buff));
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.spelldelay = 20; break; case 4: cancelattack = 0; ...
(global.charspecial[myself], myself);
386
        state = 0;
387
        attacktimer = 0;
388
    }
389
}
390
if (global.chapter == 3 && actspriteobject != -1 && i_ex(actspriteobject) && i_ex(obj_tenna_enemy))
391
{
392
    if ((actspriteobject.image_index == 9 && actspriteobject.sprite_index == spr_kris_zoosuit_card) || (actspriteobject.image_index == 9 && actspriteobject.sprite_index == spr_susie_zoosuit_Card) || (actspriteobject.image_index == 9 && actspriteobject.sprite_index == spr_ralsei_zoosuit_Card))
393
    {
394
        if (actspriteobject.sprite_index == spr_kris_zoosuit_card)
395
            anim = instance_create(x + 54, y + 30, obj_animation);
396
        if (actspriteobject.sprite_index == spr_susie_zoosuit_Card)
397
            anim = instance_create(x + 66, y + 22, obj_animation);
398
        if (actspriteobject.sprite_index == spr_ralsei_zoosuit_Card)
399
            anim = instance_create(x + 58, y + 34, obj_animation);
400
        anim.sprite_index = spr_tenna_card_shine;
401
        anim.image_index = 0.5;
402
        anim.depth = depth - 99999999;
403
        anim.image_xscale = 2;
404
        anim.image_yscale = 2;
405
        snd_stop(snd_boost);
406
        snd_play(snd_boost);
407
        with (actspriteobject)
408
            
scr_oflash
scr_oflash

function
scr_oflash(arg0 = false)
{ var _oflash = instance_create_depth(x, y, depth - 1, obj_oflash); _oflash.image_xscale = image_xscale; _oflash.image_yscale = image_yscale; _oflash.image_speed = 0; _oflash.image_index = image_index; _oflash.sprite_index = sprite_index; _oflash.target = id; _oflash.follow = arg0; return _oflash; }
();
409
    }
410
}