Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_heroparent_Draw_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)
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
            thissprite = spellreadysprite;
15
        if (global.faceaction[myself] == 6)
16
            thissprite = actreadysprite;
17
        if (global.charcond[myself] == 5)
18
        {
19
            thissprite = defeatsprite;
20
            global.faceaction[myself] = 9;
21
        }
22
        if (global.faceaction[myself] == 4)
23
        {
24
            thissprite = defendsprite;
25
            index = defendtimer;
26
            if (defendtimer < defendframes)
27
                defendtimer += 0.5;
28
        }
29
        else
30
        {
31
            defendtimer = 0;
32
            index = siner / 5;
33
        }
34
        siner += 1;
35
    }
36
    if (state == 1 && hurt == 0)
37
    {
38
        siner += 1;
39
        if (attacked == 0)
40
        {
41
            snd_stop(snd_laz_c);
42
            if (object_index == obj_herokris)
43
                snd_play(snd_laz_c);
44
            if (object_index == obj_heroralsei)
45
            {
46
                ls = snd_play(snd_laz_c);
47
                snd_pitch(ls, 1.15);
48
            }
49
            if (object_index == obj_herosusie)
50
            {
51
                ls = snd_play(snd_laz_c);
52
                snd_pitch(ls, 0.9);
53
            }
54
            if (object_index == obj_heronoelle)
55
            {
56
                ls = snd_play(snd_laz_c);
57
                snd_pitch(ls, 1.5);
58
            }
59
            if (points == 150)
60
            {
61
                snd_stop(snd_criticalswing);
62
                snd_play(snd_criticalswing);
63
                repeat (3)
64
                {
65
                    anim = instance_create(x + mywidth + random(50), y + 30 + random(30), obj_afterimage);
66
                    anim.sprite_index = spr_lightfairy;
67
                    anim.image_speed = 0.25;
68
                    anim.depth = -20;
69
                    anim.image_xscale = 2;
70
                    anim.image_yscale = 2;
71
                    anim.hspeed = 2 + random(4);
72
                    anim.friction = -0.25;
73
                }
74
            }
75
            attacked = 1;
76
            alarm[1]
 = 10;
gml_Object_obj_heroparent_Alarm_1.gml

global.faceaction[myself] = 0;
scr_retarget(myself);
if (cancelattack == 0) { dm = instance_create(global.monsterx[global.chartarget[myself]], (global.monstery[global.chartarget[myself]] - (global.hittarget[global.chartarget[myself]] * 20)) + 20, obj_dmgwriter); dm.type = char - 1; if (char == 4) dm.type = 6; dm.delay = 8; if (i_ex(obj_rouxls_enemy)) dm.depth = -999999; if (global.chapter == 2 && instance_exists(obj_spamton_neo_enemy) && obj_spamton_neo_enemy.weirdpathendcon > 0) { damage = round((global.battleat[myself] * points) / 150); if (damage < 5) damage = 5; if (damage > 10) damage = 10; } else { damage = round(((global.battleat[myself] * points) / 20) - (global.monsterdf[global.chartarget[myself]] * 3)); } if (global.monstertype[global.chartarget[myself]] == 19Susie (w/ Lancer)) damage = ceil(damage * 0.3); if (damage < 0) damage = 0; if (damage == 0) { dm.delay = 2; with (global.monsterinstance[global.chartarget[myself]]) { if (hurttimer <= 15 && candodge == 1) { dodgetimer = 0; state = 4; } } } dm.damage = damage; global.hittarget[global.chartarget[myself]] += 1; var queenshield; if (global.chapter == 2) queenshield = 0; if (global.chapter == 2 && instance_exists(obj_queen_enemy)) { if (instance_exists(obj_queenshield_enemy)) { obj_queen_enemy.shieldhp -= damage; queenshield = 1; } else { global.monsterhp[global.chartarget[myself]] -= damage; if (damage != 0) { with (obj_queen_enemy) shieldbrokecon = 1; } } } else { global.monsterhp[global.chartarget[myself]] -= damage; } if (is_auto_susie == 1 && global.monsterhp[global.chartarget[myself]] <= 0) { with (global.chartarget[myself]) global.flag[51 + myself] = 5; } if (damage > 0) { if (global.monstertype[0] != 20JEVIL)
scr_tensionheal(round(points / 10));
if (global.monstertype[0] == 20JEVIL)
scr_tensionheal(round(points / 15));
attack = instance_create(global.monsterx[global.chartarget[myself]] + random(6), global.monstery[global.chartarget[myself]] + random(6), obj_basicattack); if (object_index == obj_herosusie) { attack.sprite_index = spr_attack_mash2; attack.image_speed = 0.5; attack.maxindex = 4; snd_play(snd_impact); instance_create(0, 0, obj_shake); } if (object_index == obj_heroralsei) { attack.sprite_index = spr_attack_slap1; attack.maxindex = 4; attack.image_speed = 0.5; } if (object_index == obj_heronoelle) { attack.sprite_index = spr_attack_slap2; attack.maxindex = 4; attack.image_speed = 0.5; } if (points == 150) { attack.image_xscale = 2.5; attack.image_yscale = 2.5; ...
77
        }
78
        if (attacktimer < attackframes)
79
            image_index = attacktimer;
80
        else
81
            image_index = attackframes;
82
        thissprite = attacksprite;
83
        index = image_index;
84
        attacktimer += attackspeed;
85
    }
86
    if (state == 2 && hurt == 0)
87
    {
88
        siner += 1;
89
        if (itemed == 0)
90
        {
91
            itemed = 1;
92
            alarm[4]
 = 15;
gml_Object_obj_heroparent_Alarm_4.gml

if (spellframes > 0) global.faceaction[myself] = 0; if (
scr_monsterpop() > 0)
scr_spell(global.charspecial[myself], myself);
state = 0; attacktimer = 0;
93
        }
94
        if (attacktimer < spellframes && spellframes != 0)
95
            image_index = attacktimer;
96
        else
97
            image_index = spellframes;
98
        if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
99
            attacktimer = 0;
100
        thissprite = spellsprite;
101
        index = image_index;
102
        attacktimer += 0.5;
103
    }
104
    if (state == 4 && hurt == 0)
105
    {
106
        siner += 1;
107
        if (itemed == 0)
108
        {
109
            itemed = 1;
110
            alarm[4]
 = 15;
gml_Object_obj_heroparent_Alarm_4.gml

if (spellframes > 0) global.faceaction[myself] = 0; if (
scr_monsterpop() > 0)
scr_spell(global.charspecial[myself], myself);
state = 0; attacktimer = 0;
111
        }
112
        if (attacktimer < itemframes)
113
            image_index = attacktimer;
114
        else
115
            image_index = itemframes;
116
        if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
117
            attacktimer = 0;
118
        index = image_index;
119
        thissprite = itemsprite;
120
        attacktimer += 0.5;
121
    }
122
    if (state == 6)
123
    {
124
        if (global.myfight == 3)
125
        {
126
            if (acttimer < actframes)
127
                acttimer += 0.5;
128
        }
129
        else
130
        {
131
            acttimer += 0.5;
132
        }
133
        thissprite = actsprite;
134
        index = acttimer;
135
        if (acttimer >= actreturnframes)
136
        {
137
            acttimer = 0;
138
            state = 0;
139
            global.faceaction[myself] = 0;
140
        }
141
    }
142
    if (state == 7)
143
    {
144
        hurt = 0;
145
        hurttimer = 0;
146
        if (_sideb == 1 && _victoried == 0)
147
        {
148
            _victorysequence = instance_create(x, y, obj_noellevictory_example);
149
            _victorysequence.depth = depth - 1;
150
            _victoried = 1;
151
            image_alpha = 0;
152
        }
153
        if (victoryanim < victoryframes)
154
        {
155
            thissprite = victorysprite;
156
            index = victoryanim;
157
            victoryanim += 0.334;
158
        }
159
        else
160
        {
161
            thissprite = normalsprite;
162
            index = 0;
163
        }
164
    }
165
    if (hurt == 1)
166
    {
167
        hurtindex = hurttimer / 2;
168
        if (hurtindex > 2)
169
            hurtindex = 2;
170
        if (global.charcond[myself] == 5)
171
        {
172
            global.faceaction[myself] = 5;
173
            global.charmove[myself] = 1;
174
            global.charcond[myself] = 0;
175
        }
176
        if (global.faceaction[myself] == 0)
177
            global.faceaction[myself] = 5;
178
        if (global.faceaction[myself] != 4)
179
        {
180
            specdraw = 1;
181
            draw_sprite_ext(hurtsprite, hurtindex, (x - 20) + (hurtindex * 10), y, 2, 2, 0, image_blend, image_alpha);
182
        }
183
        else
184
        {
185
            specdraw = 1;
186
            thissprite = defendsprite;
187
            index = defendtimer;
188
            draw_sprite_ext(defendsprite, defendtimer, (x - 20) + (hurtindex * 10), y, 2, 2, 0, image_blend, image_alpha);
189
        }
190
        if (hurttimer > 15)
191
        {
192
            hurttimer = 0;
193
            hurt = 0;
194
            if (global.faceaction[myself] == 5)
195
                global.faceaction[myself] = 0;
196
        }
197
        hurttimer += 1;
198
    }
199
}
200
else
201
{
202
    global.charcond[myself] = 0;
203
    hurttimer = 0;
204
    hurt = 0;
205
    thissprite = defeatsprite;
206
    index = 0;
207
    siner += 1;
208
}
209
if (specdraw == 0)
210
{
211
    sprite_index = thissprite;
212
    image_index = index;
213
    draw_sprite_ext(thissprite, index, x, y, 2, 2, 0, image_blend, image_alpha);
214
    if (flash == 1)
215
    {
216
        fsiner += 1;
217
        d3d_set_fog(true, c_white, 0, 1);
218
        draw_sprite_ext(thissprite, index, x, y, 2, 2, 0, image_blend, (-cos(fsiner / 5) * 0.4) + 0.6);
219
        d3d_set_fog(false, c_black, 0, 0);
220
    }
221
}
222
specdraw = 0;
223
if (becomeflash == 0)
224
    flash = 0;
225
if (global.targeted[myself] == 1)
226
{
227
    if (global.mnfight == 1 && global.chapter == 1)
228
        draw_sprite_ext(spr_chartarget, siner / 10, x, y, 2, 2, 0, c_white, 1);
229
}
230
else if (combatdarken == 1 && instance_exists(obj_darkener))
231
{
232
    if (darkify == 1)
233
    {
234
        if (darkentimer < 15)
235
            darkentimer += 1;
236
        image_blend = merge_color(c_white, c_black, darkentimer / 30);
237
    }
238
}
239
if (darkify == 0)
240
{
241
    if (darkentimer > 0)
242
        darkentimer -= 3;
243
    image_blend = merge_color(c_white, c_black, darkentimer / 30);
244
}
245
becomeflash = 0;
246
if (poisonamount > 0)
247
{
248
    poisontimer++;
249
    if (poisontimer >= 10)
250
    {
251
        if (global.hp[global.char[myself]] > 1)
252
        {
253
            global.hp[global.char[myself]]--;
254
            poisonamount--;
255
        }
256
        else
257
        {
258
            poisonamount = 0;
259
        }
260
        poisontimer = 0;
261
    }
262
}