Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_attackpress_Draw_0

(view raw script w/o annotations or w/e)
1
maxdelaytimer += 1;
2
if (spelluse == 1)
3
{
4
    if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() > 0)
5
    {
6
        for (xyz = 0; xyz < 3; xyz += 1)
7
        {
8
            if (maxdelaytimer == spelldelay[xyz])
9
            {
10
                if (charitem[xyz] == 1)
11
                {
12
                    with (global.charinstance[xyz])
13
                        state = 4;
14
                }
15
                if (charspell[xyz] == 1)
16
                {
17
                    with (global.charinstance[xyz])
18
                        state = 2;
19
                }
20
            }
21
        }
22
    }
23
}
24
if (maxdelaytimer >= maxdelay)
25
    active = 1;
26
if (active == 1)
27
{
28
    for (i = 0; i < 3; i += 1)
29
    {
30
        if (havechar[0] == 1 || havechar[1] == 1 || havechar[2] == 1)
31
        {
32
            draw_set_color(bcolor);
33
            if (i == 1 || i == 2)
34
                d_rectangle(x + 77, y + (38 * i), x + 300, y + (38 * i) + 1, false);
35
        }
36
        if (global.char[i] != 0 && global.charauto[global.char[i]] == 0 && havechar[i] == 1)
37
        {
38
            draw_set_color(bcolor);
39
            j = global.char[i];
40
            fullbox = 0;
41
            if (j == 1)
42
            {
43
                draw_set_color(c_blue);
44
                if (pressbuffer[1] > 0)
45
                    draw_set_color(merge_color(c_blue, c_white, pressbuffer[1] / 5));
46
            }
47
            if (j == 2)
48
            {
49
                draw_set_color(c_purple);
50
                if (pressbuffer[2] > 0)
51
                    draw_set_color(merge_color(c_purple, c_white, pressbuffer[2] / 5));
52
            }
53
            if (j == 3)
54
            {
55
                draw_set_color(c_green);
56
                if (pressbuffer[3] > 0)
57
                    draw_set_color(merge_color(c_green, c_white, pressbuffer[3] / 5));
58
            }
59
            if (j == 4)
60
            {
61
                draw_set_color(c_yellow);
62
                if (pressbuffer[2] > 0)
63
                    draw_set_color(merge_color(c_yellow, c_white, pressbuffer[2] / 5));
64
            }
65
            d_rectangle(x + 78, y + (38 * i) + 1, x + 80 + (15 * boltspeed), y + (38 * i) + 36, true);
66
            d_rectangle(x + 79, y + (38 * i) + 2, (x + 80 + (15 * boltspeed)) - 1, y + (38 * i) + 35, true);
67
            draw_sprite(spr_pressfront, j - 1, x, y + (38 * i));
68
            if (global.flag[13 use_old_attack] == 0)
69
                draw_sprite(spr_pressfront_b, 0, x, y + (38 * i));
70
            if (global.flag[13 use_old_attack] == 1)
71
                draw_sprite(spr_pressfront_b, i, x, y + (38 * i));
72
            if (global.charweapon[1] == 33 && j == 1)
73
                draw_sprite(spr_pressspot, 4, x + 80, y + (38 * i));
74
            else
75
                draw_sprite(spr_pressspot, j - 1, x + 80, y + (38 * i));
76
        }
77
    }
78
    boltcount[0] = 0;
79
    boltcount[1] = 0;
80
    boltcount[2] = 0;
81
    if (my_method == 1)
82
    {
83
        for (i = 0; i < bolttotal; i += 1)
84
        {
85
            offset = boltchar[i];
86
            if ((boltframe[i] - boltx) < -5)
87
                boltalive[i] = 0;
88
            boltalpha = 1;
89
            if ((boltframe[i] - boltx) < 0)
90
            {
91
                boltalpha = 1 + ((boltframe[i] - boltx) / 3);
92
            }
93
            else if (imagetimer == 0 && boltalive[i] == 1)
94
            {
95
                img = instance_create((x + 80 + (boltframe[i] * boltspeed)) - (boltx * boltspeed), y + (38 * offset), obj_afterimage);
96
                with (img)
97
                {
98
                    sprite_index = spr_attackspot;
99
                    image_alpha = 0.4;
100
                }
101
            }
102
            if (boltalive[i] == 1)
103
            {
104
                draw_sprite_ext(spr_attackspot, 0, (x + 80 + (boltframe[i] * boltspeed)) - (boltx * boltspeed), y + (38 * offset), 1, 1, 0, c_white, boltalpha);
105
                boltcount[boltchar[i]] += 1;
106
            }
107
        }
108
        for (i = 0; i < 3; i += 1)
109
        {
110
            if (boltcount[i] == 0 && havechar[i] == 1 && attacked[i] == 0)
111
            {
112
                attacked[i] = 1;
113
                target = i;
114
                event_user(1);
115
            }
116
        }
117
    }
118
    if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() > 0)
119
    {
120
        if (global.flag[13 use_old_attack] == 1)
121
        {
122
            if (button1_p() && havechar[0] == 1)
123
                
scr_boltcheck
scr_boltcheck

function
scr_boltcheck(arg0)
{ pressbuffer[global.char[arg0]] = 5; qualifybolt = -1; close = 99; topclose = 99; for (i = 0; i < bolttotal; i += 1) { if (boltchar[i] == arg0 && boltalive[i] == 1) { close = boltframe[i] - boltx; if (close < 15 && close > -5) { if (close < topclose) { topclose = close; qualifybolt = i; } } } } if (qualifybolt != -1) { p = abs(topclose); burstbolt = instance_create((x + 80 + (boltframe[qualifybolt] * boltspeed)) - (boltx * boltspeed), y + (38 * arg0), obj_burstbolt); if (p == 0) { points[arg0] += 150; with (burstbolt) image_blend = c_yellow; with (burstbolt) mag = 0.2; } if (p == 1) points[arg0] += 120; if (p == 2) points[arg0] += 110; if (p >= 3) { points[arg0] += 100 - (abs(topclose) * 2); burstbolt.image_blend = boltcolor[arg0]; } if (p >= 15) burstbolt.image_blend = charcolor[arg0]; boltalive[qualifybolt] = 0; } }
(0);
124
            if (button2_p() && havechar[1] == 1)
125
                
scr_boltcheck
scr_boltcheck

function
scr_boltcheck(arg0)
{ pressbuffer[global.char[arg0]] = 5; qualifybolt = -1; close = 99; topclose = 99; for (i = 0; i < bolttotal; i += 1) { if (boltchar[i] == arg0 && boltalive[i] == 1) { close = boltframe[i] - boltx; if (close < 15 && close > -5) { if (close < topclose) { topclose = close; qualifybolt = i; } } } } if (qualifybolt != -1) { p = abs(topclose); burstbolt = instance_create((x + 80 + (boltframe[qualifybolt] * boltspeed)) - (boltx * boltspeed), y + (38 * arg0), obj_burstbolt); if (p == 0) { points[arg0] += 150; with (burstbolt) image_blend = c_yellow; with (burstbolt) mag = 0.2; } if (p == 1) points[arg0] += 120; if (p == 2) points[arg0] += 110; if (p >= 3) { points[arg0] += 100 - (abs(topclose) * 2); burstbolt.image_blend = boltcolor[arg0]; } if (p >= 15) burstbolt.image_blend = charcolor[arg0]; boltalive[qualifybolt] = 0; } }
(1);
126
            if (button3_p() && havechar[2] == 1)
127
                
scr_boltcheck
scr_boltcheck

function
scr_boltcheck(arg0)
{ pressbuffer[global.char[arg0]] = 5; qualifybolt = -1; close = 99; topclose = 99; for (i = 0; i < bolttotal; i += 1) { if (boltchar[i] == arg0 && boltalive[i] == 1) { close = boltframe[i] - boltx; if (close < 15 && close > -5) { if (close < topclose) { topclose = close; qualifybolt = i; } } } } if (qualifybolt != -1) { p = abs(topclose); burstbolt = instance_create((x + 80 + (boltframe[qualifybolt] * boltspeed)) - (boltx * boltspeed), y + (38 * arg0), obj_burstbolt); if (p == 0) { points[arg0] += 150; with (burstbolt) image_blend = c_yellow; with (burstbolt) mag = 0.2; } if (p == 1) points[arg0] += 120; if (p == 2) points[arg0] += 110; if (p >= 3) { points[arg0] += 100 - (abs(topclose) * 2); burstbolt.image_blend = boltcolor[arg0]; } if (p >= 15) burstbolt.image_blend = charcolor[arg0]; boltalive[qualifybolt] = 0; } }
(2);
128
        }
129
        else if (button1_p())
130
        {
131
            
scr_boltcheck_onebutton
scr_boltcheck_onebutton

function
scr_boltcheck_onebutton()
{ dualbolt = -1; dualboltid = -1; pressbuffer[0] = 5; pressbuffer[1] = 5; pressbuffer[2] = 5; pressbuffer[3] = 5; qualifybolt = -1; close = 99; topclose = 999; for (i = 0; i < bolttotal; i += 1) { if (boltalive[i] == 1) { close = boltframe[i] - boltx; if (close < 15 && close > -5) { if (close == topclose) { dualbolt = 1; dualboltid = i; } if (close < topclose) { topclose = close; qualifybolt = i; } } } } if (qualifybolt != -1) { bc = boltchar[qualifybolt]; p = abs(topclose); pp = topclose; burstbolt = instance_create((x + 80 + (boltframe[qualifybolt] * boltspeed)) - (boltx * boltspeed), y + (38 * bc), obj_burstbolt); if (p == 0) { points[bc] += 150; with (burstbolt) image_blend = c_yellow; with (burstbolt) mag = 0.2; } if (pp == 1 && global.charweapon[1] == 33) { points[bc] += 150; with (burstbolt) image_blend = c_yellow; with (burstbolt) mag = 0.2; } else if (p == 1) { points[bc] += 120; } if (p == 2) points[bc] += 110; if (p >= 3) { points[bc] += 100 - (abs(topclose) * 2); burstbolt.image_blend = boltcolor[bc]; } if (p >= 15) burstbolt.image_blend = charcolor[bc]; boltalive[qualifybolt] = 0; if (dualbolt == 1) { bc = boltchar[dualboltid]; p = abs(topclose); burstbolt = instance_create((x + 80 + (boltframe[dualboltid] * boltspeed)) - (boltx * boltspeed), y + (38 * bc), obj_burstbolt); if (p == 0) { points[bc] += 150; with (burstbolt) image_blend = c_yellow; with (burstbolt) mag = 0.2; } if (p == 1) points[bc] += 120; if (p == 2) points[bc] += 110; if (p >= 3) { points[bc] += 100 - (abs(topclose) * 2); burstbolt.image_blend = boltcolor[bc]; } if (p >= 15) burstbolt.image_blend = charcolor[bc]; boltalive[dualboltid] = 0; } } }
();
132
        }
133
    }
134
    else
135
    {
136
        fakefade = 1;
137
        if (posttimer < (timermax - 35))
138
            posttimer = timermax - 34;
139
    }
140
    imagetimer += 1;
141
    boltx += 1;
142
    pressbuffer[0] -= 1;
143
    pressbuffer[1] -= 1;
144
    pressbuffer[2] -= 1;
145
    pressbuffer[3] -= 1;
146
    if (imagetimer > 1)
147
        imagetimer = 0;
148
    goahead = 0;
149
    if (attacked[0] == 1 || havechar[0] == 0)
150
    {
151
        if (attacked[1] == 1 || havechar[1] == 0)
152
        {
153
            if (attacked[2] == 1 || havechar[2] == 0)
154
                goahead = 1;
155
        }
156
    }
157
    if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
158
        goahead = 1;
159
    if (goahead == 1)
160
    {
161
        posttimer += 1;
162
        if (posttimer > (timermax - 35) && haveauto == 1 && autoed == 0 && 
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() > 0)
163
        {
164
            global.charinstance[sus].points = 160;
165
            if (global.automiss[global.chartarget[sus]] == 1)
166
                global.charinstance[sus].points = 0;
167
            with (global.charinstance[sus])
168
            {
169
                state = 1;
170
                attacktimer = 0;
171
                is_auto_susie = 1;
172
            }
173
            posttimer -= 25;
174
            autoed = 1;
175
        }
176
        if (posttimer > timermax)
177
        {
178
            fade = 1;
179
            with (obj_heroparent)
180
            {
181
                if (state == 1)
182
                    state = 0;
183
                attacked = 0;
184
                itemed = 0;
185
            }
186
            techwon = 0;
187
            if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
188
                techwon = 1;
189
            if (techwon == 1)
190
                
scr_wincombat
scr_wincombat

function
scr_wincombat()
{ if (global.flag[60 dojo_next_encounter] == 0 || global.flag[36 dojo_failure] == 1) { global.myfight = 7; global.mnfight = -1; with (obj_battlecontroller) victory = 1; for (i = 0; i < 3; i += 1) { if (global.monster[i] == 1 && i_ex(global.monsterinstance[i])) { with (global.monsterinstance[i])
scr_monsterdefeat();
} } } else { for (i = 0; i < 3; i += 1) { if (global.monster[i] == 1 && i_ex(global.monsterinstance[i])) { with (global.monsterinstance[i])
scr_monsterdefeat();
} } global.encounterno = global.flag[60 dojo_next_encounter];
scr_encountersetup(global.encounterno);
global.flag[60 dojo_next_encounter] = 0; for (__j = 0; __j < 3; __j++) { if (global.monstertype[__j] != 0(None)) { _newmonster =
scr_monster_add(global.monstertype[__j], global.monsterinstancetype[__j]);
global.monsterinstance[_newmonster].x = camerax() + 800; global.monsterinstance[_newmonster].y = global.monstermakey[__j]; with (global.monsterinstance[_newmonster])
scr_move_to_point_over_time(global.monstermakex[myself], global.monstermakey[myself], 10);
} } global.myfight = 5; myfightreturntimer = 15; global.mnfight = -1; } }
();
191
            if (techwon == 0)
192
            {
193
                if (global.mnfight != 1.5 && global.mnfight != 2)
194
                    global.mnfight = 1;
195
                global.myfight = -1;
196
            }
197
        }
198
    }
199
    if (fade == 1 || fakefade == 1)
200
    {
201
        fadeamt += 0.08;
202
        draw_set_color(c_black);
203
        draw_set_alpha(fadeamt);
204
        d_rectangle(x - 1, y, x + 640, y + 300, false);
205
        draw_set_alpha(1);
206
        if (fade == 1)
207
        {
208
            if (fadeamt > 1)
209
                instance_destroy();
210
        }
211
    }
212
}