Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_ponman_enemy_Step_0

(view raw script w/o annotations or w/e)
1
if (global.monster[myself] == 1)
2
{
3
    if (global.mnfight == 1 && talked == 0)
4
    {
5
        if (global.mercymod[myself] < 100)
6
            scr_randomtarget
scr_randomtarget

function scr_randomtarget() { abletotarget = 1; if (global.charcantarget[0] == 0 && global.charcantarget[1] == 0 && global.charcantarget[2] == 0) abletotarget = 0; mytarget = choose(0, 1, 2); if (abletotarget == 1) { while (global.charcantarget[mytarget] == 0) mytarget = choose(0, 1, 2); } else { mytarget = 3; } global.targeted[mytarget] = 1; if (global.chapter >= 2 && mytarget != 3) { if (global.charcantarget[0]) global.targeted[0] = 1; if (global.charcantarget[1]) global.targeted[1] = 1; if (global.charcantarget[2]) global.targeted[2] = 1; mytarget = 4; } }
();
7
        if (!instance_exists(obj_darkener))
8
            instance_create(0, 0, obj_darkener);
9
        global.typer = 50;
10
        global.msg[0] = stringsetloc(
" ", "obj_ponman_enemy_slash_Step_0_gml_10_0"
);
11
        g = scr_enemyblcon
scr_enemyblcon

function scr_enemyblcon(arg0, arg1, arg2) { if (arg2 == 0) { mywriter = instance_create(arg0, arg1, obj_writer); return mywriter; } if (arg2 == 1) { myblcon = instance_create(arg0, arg1, obj_battleblcon); return myblcon; } if (arg2 == 2) { myblcon = instance_create(arg0, arg1, obj_battleblcon); myblcon.sprite_index = spr_battleblcon_v; return myblcon; } if (arg2 == 3) { myblcon = instance_create(arg0, arg1, obj_battleblcon); myblcon.sprite_index = spr_battleblcon_long; return myblcon; } if (arg2 == 4) { myblcon = instance_create(arg0, arg1, obj_battleblcon); myblcon.sprite_index = spr_battleblcon_clubs; myblcon.image_index = 0; myblcon.image_speed = 0; return myblcon; } if (arg2 == 5) { myblcon = instance_create(arg0, arg1, obj_battleblcon); myblcon.sprite_index = spr_battleblcon_clubs; myblcon.image_index = 1; myblcon.image_speed = 0; return myblcon; } if (arg2 == 6) { myblcon = instance_create(arg0, arg1, obj_battleblcon); myblcon.sprite_index = spr_battleblcon_clubs; myblcon.image_index = 2; myblcon.image_speed = 0; return myblcon; } if (arg2 == 7) { myblcon = instance_create(arg0, arg1, obj_battleblcon); myblcon.sprite_index = spr_battleblcon_long_r; myblcon.image_index = 2; myblcon.image_speed = 0; return myblcon; } if (arg2 == 8) { myblcon = instance_create(arg0, arg1, obj_battleblcon); myblcon.sprite_index = spr_battleblcon_long_tall; return myblcon; } if (arg2 == 10) { myblcon = instance_create(arg0, arg1, obj_battleblcon); myblcon.sprite_index = spr_battleblcon_long; myblcon.auto_length = 1; return myblcon; } }
(x - 160, y, 3);
12
        with (g.mywriter)
13
            instance_destroy();
14
        with (g)
15
            instance_destroy();
16
        talked = 1;
17
        talktimer = 0;
18
    }
19
    if (talked == 1 && global.mnfight == 1)
20
    {
21
        rtimer = 0;
22
        scr_blconskip
scr_blconskip

function scr_blconskip(arg0) { if (arg0 >= 0) { if (button1_p() && talktimer > arg0) talktimer = talkmax; talktimer += 1; if (talktimer >= talkmax) { with (obj_writer) instance_destroy(); global.mnfight = 2; } } else if (arg0 == -1) { if (instance_exists(obj_writer) == false) global.mnfight = 2; } else if (arg0 == -2) { talktimer += 1; if (talktimer > 15) talktimer = talkmax; if (talktimer >= talkmax) { with (obj_writer) instance_destroy(); global.mnfight = 2; } } }
(5);
23
        if (global.mnfight == 2)
24
        {
25
            if (!instance_exists(obj_moveheart))
26
                scr_moveheart
scr_moveheart

function scr_moveheart() { global.inv = 0; if (global.chapter == 2 && instance_exists(obj_gigaqueen_enemy)) return instance_create(o_boxingcontroller.x + 4, o_boxingcontroller.y - 120, obj_moveheart); else return instance_create(obj_herokris.x + 10, obj_herokris.y + 40, obj_moveheart); }
();
27
            if (!instance_exists(obj_growtangle))
28
                instance_create(__view_get(e__VW.XView, 0) + 320, __view_get(e__VW.YView, 0) + 170, obj_growtangle);
29
        }
30
    }
31
    if (global.mnfight == 2 && attacked == 0)
32
    {
33
        rtimer += 1;
34
        if (rtimer == 12)
35
        {
36
            global.turntimer = 150;
37
            pontotal = scr_monsterpop
scr_monsterpop

function scr_monsterpop() { return global.monster[0] + global.monster[1] + global.monster[2]; }
();
38
            for (i = 0; i < 3; i += 1)
39
            {
40
                if (global.monster[i] == 1 && global.mercymod[i] >= 100)
41
                    pontotal -= 1;
42
            }
43
            if (pontotal == 3)
44
                maxshot = 3;
45
            if (pontotal == 2)
46
                maxshot = 4;
47
            if (pontotal == 1)
48
                maxshot = 5;
49
            if (pontotal <= 0)
50
            {
51
                global.turntimer = 10;
52
                maxshot = 6;
53
            }
54
            shotcount = 0;
55
            totalshotcount = 0;
56
            activetimer = 1;
57
            shotbuffer = 8;
58
            if (global.mercymod[myself] < 100)
59
                eyecon = 20;
60
            turns += 1;
61
            attacked = 1;
62
            global.typer = 6;
63
            global.fc = 0;
64
            rr = choose(0, 1, 2, 3, 4);
65
            if (rr == 0)
66
                global.battlemsg[0] = stringsetloc(
* Ponman advances one step at a time.
"* Ponman advances one step at a time.", "obj_ponman_enemy_slash_Step_0_gml_64_0"
);
67
            if (rr == 1)
68
                global.battlemsg[0] = stringsetloc(
* Ponman listens politely,Delay 11 despite having no ears.
"* Ponman listens politely^1, despite having no ears.", "obj_ponman_enemy_slash_Step_0_gml_65_0"
);
69
            if (rr == 2)
70
                global.battlemsg[0] = stringsetloc(
* Ponman seems hypnotized by your idle animation.
"* Ponman seems hypnotized by your idle animation.", "obj_ponman_enemy_slash_Step_0_gml_66_0"
);
71
            if (rr == 3)
72
                global.battlemsg[0] = stringsetloc(
* Ponman gazes enigmatically.
"* Ponman gazes enigmatically.", "obj_ponman_enemy_slash_Step_0_gml_67_0"
);
73
            if (rr == 4)
74
                global.battlemsg[0] = stringsetloc(
* Smells like a pawn shop.
"* Smells like a pawn shop.", "obj_ponman_enemy_slash_Step_0_gml_68_0"
);
75
            if (global.monsterstatus[myself] == 1)
76
                global.battlemsg[0] = stringsetloc(
* Ponman can't keep its eye open.
"* Ponman can't keep its eye open.", "obj_ponman_enemy_slash_Step_0_gml_69_0"
);
77
            if (global.monsterhp[myself] <= (global.monstermaxhp[myself] / 3))
78
                global.battlemsg[0] = stringsetloc(
* Ponman looks dilated.
"* Ponman looks dilated.", "obj_ponman_enemy_slash_Step_0_gml_70_0"
);
79
            if (global.mercymod[myself] >= global.mercymax[myself])
80
                global.msg[0] = stringsetloc(
* Ponman is sleeping soundly.
"* Ponman is sleeping soundly.", "obj_ponman_enemy_slash_Step_0_gml_71_0"
);
81
            if (global.monstercomment[myself] == "(Sleepy)")
82
                global.msg[0] = stringsetloc(
* The enemies became SLEEPY from Ralsei's lullaby!
"* The enemies became SLEEPY from Ralsei's lullaby!", "obj_ponman_enemy_slash_Step_0_gml_72_0"
);
83
        }
84
        else
85
        {
86
            global.turntimer = 120;
87
        }
88
    }
89
    if (global.mnfight == 2)
90
    {
91
        if (global.turntimer <= 1)
92
        {
93
            if (battlecancel == 1)
94
                scr_mercyadd
scr_mercyadd

function scr_mercyadd(arg0, arg1) { global.mercymod[arg0] += arg1; if (global.mercymod[arg0] < 0) global.mercymod[arg0] = 0; if (global.mercymod[arg0] >= 100) global.mercymod[arg0] = 100; var _playsound = 1; if (arg1 <= 0) _playsound = 0; if (i_ex(obj_dmgwriter)) { with (obj_dmgwriter) { if (type == 5) _playsound = 0; } } if (_playsound) { var _pitch = 0.8; if (arg1 < 99) _pitch = 1; if (arg1 <= 50) _pitch = 1.2; if (arg1 <= 25) _pitch = 1.4; snd_play_x(snd_mercyadd, 0.8, _pitch); } __mercydmgwriter = instance_create(global.monsterx[arg0], (global.monstery[arg0] + 20) - (global.hittarget[arg0] * 20), obj_dmgwriter); __mercydmgwriter.damage = arg1; __mercydmgwriter.type = 5; global.hittarget[arg0]++; }
(myself, 100);
95
            if (battlecancel == 2)
96
            {
97
                with (obj_battlecontroller)
98
                    noreturn = 1;
99
                con = 1;
100
                battlecancel = 3;
101
            }
102
        }
103
    }
104
}
105
if (global.myfight == 3)
106
{
107
    xx = __view_get(e__VW.XView, 0);
108
    yy = __view_get(e__VW.YView, 0);
109
    if (acting == 1 && actcon == 0)
110
    {
111
        actcon = 1;
112
        global.msg[0] = stringsetloc(
* PONMAN - AT 8 DF 0
* Its nucleus doubles as an eyespot.Wait for inputClose Message
"* PONMAN - AT 8 DF 0&* Its nucleus doubles as an eyespot./%", "obj_ponman_enemy_slash_Step_0_gml_106_0"
);
113
        scr_battletext_default
scr_battletext_default

function scr_battletext_default() { global.fc = 0; global.typer = 4; scr_battletext(); return battlewriter; }
();
114
    }
115
    if (acting == 2 && actcon == 0)
116
    {
117
        global.msg[0] = stringsetloc(
* You whispered goodnight to Ponman.Delay 11
* It fell asleep...Wait for inputClose Message
"* You whispered goodnight to Ponman^1.&* It fell asleep.../%", "obj_ponman_enemy_slash_Step_0_gml_114_0"
);
118
        sleeping = 1;
119
        scr_mercyadd
scr_mercyadd

function scr_mercyadd(arg0, arg1) { global.mercymod[arg0] += arg1; if (global.mercymod[arg0] < 0) global.mercymod[arg0] = 0; if (global.mercymod[arg0] >= 100) global.mercymod[arg0] = 100; var _playsound = 1; if (arg1 <= 0) _playsound = 0; if (i_ex(obj_dmgwriter)) { with (obj_dmgwriter) { if (type == 5) _playsound = 0; } } if (_playsound) { var _pitch = 0.8; if (arg1 < 99) _pitch = 1; if (arg1 <= 50) _pitch = 1.2; if (arg1 <= 25) _pitch = 1.4; snd_play_x(snd_mercyadd, 0.8, _pitch); } __mercydmgwriter = instance_create(global.monsterx[arg0], (global.monstery[arg0] + 20) - (global.hittarget[arg0] * 20), obj_dmgwriter); __mercydmgwriter.damage = arg1; __mercydmgwriter.type = 5; global.hittarget[arg0]++; }
(myself, 100);
120
        scr_battletext_default
scr_battletext_default

function scr_battletext_default() { global.fc = 0; global.typer = 4; scr_battletext(); return battlewriter; }
();
121
        actcon = 1;
122
    }
123
    if (acting == 3 && actcon == 0)
124
    {
125
        snd_pause(global.batmusic[1]);
126
        if (lullabied == 0)
127
        {
128
            singy = snd_play(snd_ralseising1);
129
            with (object_index)
130
                lullabied = 1;
131
        }
132
        else
133
        {
134
            singy = snd_play(snd_ralseising2);
135
            with (object_index)
136
                lullabied = 0;
137
        }
138
        global.msg[0] = stringsetloc(
* Ralsei sang a soft and entrancing lullaby!Wait for inputClose Message
"* Ralsei sang a soft and entrancing lullaby!/%", "obj_ponman_enemy_slash_Step_0_gml_134_0"
);
139
        with (obj_heroralsei)
140
            visible = 0;
141
        ralsing = scr_dark_marker
scr_dark_marker

function scr_dark_marker(arg0, arg1, arg2) { thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; image_xscale = 2; image_yscale = 2; } return thismarker; }
(obj_heroralsei.x, obj_heroralsei.y, spr_ralseib_sing);
142
        with (ralsing)
143
            image_speed = 0.2;
144
        lullatimer = 0;
145
        scr_battletext_default
scr_battletext_default

function scr_battletext_default() { global.fc = 0; global.typer = 4; scr_battletext(); return battlewriter; }
();
146
        actcon = 10;
147
    }
148
    if (acting == 4 && actcon == 0)
149
    {
150
        actcon = 1;
151
        global.msg[0] = stringsetloc(
* You and Ralsei warned Ponman about Susie.Delay 11
* The enemy went on guard...Wait for inputClose Message
"* You and Ralsei warned Ponman about Susie^1.&* The enemy went on guard.../%", "obj_ponman_enemy_slash_Step_0_gml_150_0"
);
152
        if (scr_monsterpop
scr_monsterpop

function scr_monsterpop() { return global.monster[0] + global.monster[1] + global.monster[2]; }
() > 1)
153
            global.msg[0] = stringsetloc(
* You and Ralsei warned the enemies about Susie.Delay 11
* Everyone went on guard.Wait for inputClose Message
"* You and Ralsei warned the enemies about Susie^1.&* Everyone went on guard./%", "obj_ponman_enemy_slash_Step_0_gml_152_0"
);
154
        for (i = 0; i < 3; i += 1)
155
        {
156
            global.monstercomment[i] = "(Warned)";
157
            global.automiss[i] = 1;
158
        }
159
        scr_battletext_default
scr_battletext_default

function scr_battletext_default() { global.fc = 0; global.typer = 4; scr_battletext(); return battlewriter; }
();
160
    }
161
    if (actcon == 1 && !instance_exists(obj_writer))
162
    {
163
        actcon = 0;
164
        scr_attackphase
scr_attackphase

function scr_attackphase() { with (obj_battlecontroller) { techwon = 0; if (scr_monsterpop() == 0) techwon = 1; if (global.chapter == 2 && i_ex(obj_berdlyb_enemy) && obj_berdlyb_enemy.endcon == 1) techwon = 1; else if (techwon == 1) scr_wincombat(); if (techwon == 0) { for (__hiti = 0; __hiti < 3; __hiti++) global.hittarget[__hiti] = 0; fightphase = 1; global.charturn = 3; if (global.charaction[0] == 4 || global.charaction[0] == 2) fightphase = 0; if (global.charaction[1] == 4 || global.charaction[1] == 2) fightphase = 0; if (global.charaction[2] == 4 || global.charaction[2] == 2) fightphase = 0; if (global.myfight == 4) fightphase = 1; if (fightphase == 1) { global.myfight = 1; instance_create(xx + 2, yy + 365, obj_attackpress); } else { global.myfight = 4; instance_create(0, 0, obj_spellphase); } } } }
();
165
    }
166
    if (actcon == 10)
167
    {
168
        lullatimer += 1;
169
        if (lullatimer >= 30)
170
            actcon = 11;
171
    }
172
    if (actcon == 11 && instance_exists(obj_writer) == false)
173
    {
174
        with (ralsing)
175
            instance_destroy();
176
        with (obj_heroralsei)
177
            visible = 1;
178
        snd_stop(singy);
179
        snd_resume(global.batmusic[1]);
180
        global.msg[0] = stringsetloc(
* PONMAN fell asleep!Delay 11
* The enemies became TIRED!Wait for inputClose Message
"* PONMAN fell asleep^1!&* The enemies became TIRED!/%", "obj_ponman_enemy_slash_Step_0_gml_186_0"
);
181
        if (scr_monsterpop
scr_monsterpop

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

function scr_havechar(arg0) { var checker = arg0; if (checker == "susie" || checker == "su" || checker == "s") checker = 2; if (checker == "ralsei" || checker == "ra" || checker == "r") checker = 3; if (checker == "noelle" || checker == "no" || checker == "n") checker = 4; _rreturn = 0; if (global.char[0] == checker) _rreturn = 1; if (global.char[1] == checker) _rreturn = 1; if (global.char[2] == checker) _rreturn = 1; return _rreturn; }
(2))
182
        {
183
            for (dx = 0; dx < 3; dx += 1)
184
            {
185
                if (global.char[dx] == 2)
186
                {
187
                    if (global.charcond[dx] != 5)
188
                    {
189
                        global.charcond[dx] = 5;
190
                        global.faceaction[dx] = 9;
191
                        global.charmove[dx] = 0;
192
                        global.msg[0] = stringsetloc(
* PONMAN fell asleep!Delay 11
* SUSIE fell asleep!Delay 11
* The enemies became TIRED!Wait for inputClose Message
"* PONMAN fell asleep^1!&* SUSIE fell asleep^1!&* The enemies became TIRED!/%", "obj_ponman_enemy_slash_Step_0_gml_198_0"
);
193
                    }
194
                }
195
            }
196
        }
197
        sleeping = 1;
198
        scr_mercyadd
scr_mercyadd

function scr_mercyadd(arg0, arg1) { global.mercymod[arg0] += arg1; if (global.mercymod[arg0] < 0) global.mercymod[arg0] = 0; if (global.mercymod[arg0] >= 100) global.mercymod[arg0] = 100; var _playsound = 1; if (arg1 <= 0) _playsound = 0; if (i_ex(obj_dmgwriter)) { with (obj_dmgwriter) { if (type == 5) _playsound = 0; } } if (_playsound) { var _pitch = 0.8; if (arg1 < 99) _pitch = 1; if (arg1 <= 50) _pitch = 1.2; if (arg1 <= 25) _pitch = 1.4; snd_play_x(snd_mercyadd, 0.8, _pitch); } __mercydmgwriter = instance_create(global.monsterx[arg0], (global.monstery[arg0] + 20) - (global.hittarget[arg0] * 20), obj_dmgwriter); __mercydmgwriter.damage = arg1; __mercydmgwriter.type = 5; global.hittarget[arg0]++; }
(myself, 100);
199
        with (obj_monsterparent)
200
        {
201
            global.monstercomment[myself] = "(Sleepy)";
202
            global.monsterstatus[myself] = 1;
203
        }
204
        scr_battletext_default
scr_battletext_default

function scr_battletext_default() { global.fc = 0; global.typer = 4; scr_battletext(); return battlewriter; }
();
205
        actcon = 1;
206
    }
207
}
208
if (global.myfight == 7)
209
    hspeed = 15;
210
if (sleeping == 1)
211
    eyecon = 999;
212
if (eyecon == 0)
213
{
214
    eye_angle = 180 + (sin(siner / 8) * 30);
215
    if (eye_radius < 8)
216
        eye_radius += 2;
217
    else
218
        eye_radius = 8;
219
    if (addup == 0)
220
        image_index = 1;
221
    else
222
        image_index = 3;
223
    if (eye_angle > 200)
224
    {
225
        image_index = 0;
226
        addup = 1;
227
    }
228
    if (eye_angle < 160)
229
    {
230
        image_index = 2;
231
        addup = 0;
232
    }
233
}
234
if (eyecon == 10)
235
{
236
    activetimer = 0;
237
    with (obj_regularbullet)
238
    {
239
        active = 0;
240
        image_alpha -= 0.1;
241
    }
242
    image_index = 0;
243
    eye_radius *= 0.7;
244
    if (abs(eye_radius) < 0.5)
245
    {
246
        eye_radius = 0;
247
        eye_angle = 0;
248
    }
249
    if (global.turntimer <= 1)
250
        eyecon = 0;
251
}
252
if (eyecon == 20)
253
{
254
    if (spinspeed < 10)
255
        spinspeed += 1;
256
    if (pontotal > 1)
257
        siner += (spinspeed / 8);
258
    else
259
        siner += (spinspeed / 20);
260
    eye_angle = 180 + (sin(siner / 8) * 70);
261
    if (eye_radius < 8)
262
        eye_radius += 1;
263
    grandbuffer -= 1;
264
    if (instance_exists(obj_heart))
265
        x_angle = point_direction(eyex + 28 + x, eyey + 32 + y, obj_heart.x + 8, obj_heart.y + 8);
266
    else
267
        x_angle = 0;
268
    if (abs(x_angle - eye_angle) < 25 && eye_angle >= 120 && eye_angle <= 240)
269
    {
270
        if (shotbuffer < 0 && shotcount < 3 && totalshotcount < maxshot)
271
        {
272
            shotcount += 1;
273
            if (pontotal == 2)
274
                shotcount += 1;
275
            if (pontotal == 3)
276
                shotcount += 1;
277
            if (shotcount >= 3)
278
            {
279
                totalshotcount += 1;
280
                shotcount = 0;
281
                if (pontotal == 1)
282
                    shotbuffer = 10;
283
                if (pontotal == 2)
284
                    shotbuffer = 13;
285
                if (pontotal == 3)
286
                    shotbuffer = 22;
287
            }
288
            if (totalshotcount >= maxshot)
289
                maxtimer = 1;
290
            snd_play(snd_hurt1);
291
            bul = instance_create(eyex + 28 + x, eyey + 32 + y, obj_regularbullet);
292
            bul.speed = 2;
293
            bul.timepoints = 2.5;
294
            bul.target = mytarget;
295
            bul.damage = global.monsterat[myself] * 5;
296
            bul.friction = -0.11;
297
            if (pontotal == 1)
298
                bul.friction = -0.12;
299
            bul.direction = eye_angle;
300
            with (bul)
301
            {
302
                sprite_index = spr_diamondbullet;
303
                image_angle = direction;
304
            }
305
        }
306
    }
307
    if (maxtimer > 0)
308
        maxtimer += 1;
309
    if (global.turntimer < 10)
310
        eyecon = 10;
311
}
312
siner += 1;
313
shotbuffer -= 1;
314
if (becomesleep == 1)
315
{
316
    eyecon = 999;
317
    sleeping = 1;
318
    becomesleep = 0;
319
    sleep_index = 5;
320
}
321
if (eye_angle < 0)
322
    eye_angle += 360;
323
if (eye_angle > 360)
324
    eye_angle -= 360;
325
eyex = lengthdir_x(eye_radius, eye_angle);
326
eyey = lengthdir_y(eye_radius, eye_angle);
327
328
enum e__VW
329
{
330
    XView,
331
    YView,
332
    WView,
333
    HView,
334
    Angle,
335
    HBorder,
336
    VBorder,
337
    HSpeed,
338
    VSpeed,
339
    Object,
340
    Visible,
341
    XPort,
342
    YPort,
343
    WPort,
344
    HPort,
345
    Camera,
346
    SurfaceID
347
}