Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_placeholderenemy_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
        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; } }
();
6
        if (!instance_exists(obj_darkener))
7
            instance_create(0, 0, obj_darkener);
8
        global.typer = 50;
9
        rr = choose(0, 1, 2, 3);
10
        if (rr == 0)
11
            global.msg[0] = "";
12
        if (rr == 1)
13
            global.msg[0] = "";
14
        if (rr == 2)
15
            global.msg[0] = "";
16
        if (rr == 3)
17
            global.msg[0] = "";
18
        global.msg[0] = "";
19
        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);
20
        talked = 1;
21
        talktimer = 0;
22
    }
23
    if (talked == 1 && global.mnfight == 1)
24
    {
25
        rtimer = 0;
26
        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; } } }
(15);
27
        if (global.mnfight == 2)
28
        {
29
            if (!instance_exists(obj_moveheart))
30
                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); }
();
31
            if (!instance_exists(obj_growtangle))
32
                instance_create(__view_get(e__VW.XView, 0) + 320, __view_get(e__VW.YView, 0) + 170, obj_growtangle);
33
        }
34
    }
35
    if (global.mnfight == 2 && attacked == 0)
36
    {
37
        rtimer += 1;
38
        if (rtimer == 12)
39
        {
40
            rr = choose(0, 1);
41
            if (rr == 0)
42
            {
43
                dc = instance_create(x, y, obj_dbulletcontroller);
44
                dc.type = 0;
45
                dc.damage = global.monsterat[myself] * 5;
46
                dc.target = mytarget;
47
            }
48
            else
49
            {
50
                dc = instance_create(x, y, obj_dbulletcontroller);
51
                dc.type = 1;
52
                dc.damage = global.monsterat[myself] * 5;
53
                dc.target = mytarget;
54
            }
55
            turns += 1;
56
            global.turntimer = 140;
57
            attacked = 1;
58
            global.typer = 6;
59
            global.fc = 0;
60
            rr = choose(0, 1, 2, 3);
61
            if (rr == 0)
62
                global.battlemsg[0] = "";
63
            if (rr == 1)
64
                global.battlemsg[0] = "";
65
            if (rr == 2)
66
                global.battlemsg[0] = "";
67
            if (rr == 3)
68
                global.battlemsg[0] = "";
69
        }
70
        else
71
        {
72
            global.turntimer = 120;
73
        }
74
    }
75
    if (global.mnfight == 2)
76
    {
77
        if (global.turntimer <= 1)
78
        {
79
            if (battlecancel == 1)
80
                global.mercymod[myself] = 999;
81
            if (battlecancel == 2)
82
            {
83
                with (obj_battlecontroller)
84
                    noreturn = 1;
85
                con = 1;
86
                battlecancel = 3;
87
            }
88
        }
89
    }
90
}
91
if (con == 1)
92
{
93
    con = 2;
94
    alarm[4] = 10;
95
}
96
if (con == 3)
97
{
98
    global.typer = 50;
99
    global.msg[0] = "";
100
    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);
101
    con = 4;
102
}
103
if (con == 4 && !instance_exists(obj_writer))
104
{
105
    hspeed = 15;
106
    con = 5;
107
    alarm[4] = 15;
108
    with (obj_battlecontroller)
109
alarm[2]
110
}
111
if (con == 6)
112
{
113
    with (obj_battlecontroller)
114
        noreturn = 0;
115
    scr_monsterdefeat
scr_monsterdefeat

function scr_monsterdefeat() { if (global.monster[myself] == 1) { global.monstergold[3] += global.monstergold[myself]; global.monsterexp[3] += global.monsterexp[myself]; global.monster[myself] = 0; if (global.flag[51 + myself] == 0) { global.flag[51 + myself] = 2; if (global.monsterhp[myself] <= 0) global.flag[51 + myself] = 1; } if (global.flag[51 + myself] == 1) { global.flag[40 violences] += 1; if (fatal == 1) global.flag[44 kills]++; } if (global.flag[51 + myself] == 2) global.flag[41 spares] += 1; if (global.flag[51 + myself] == 3) global.flag[42 pacifies] += 1; if (global.flag[51 + myself] == 5) global.flag[43 autosusie_violences] += 1; if (global.flag[51 + myself] == 6) { global.flag[45 freezes] += 1; global.monstergold[3] += 24; } if (scr_monsterpop() == 0) { _amt_add = 0; _frozened = 0; _violenced = 0; _spared = 0; _pacified = 0; for (d_i = 0; d_i < 3; d_i += 1) { if (global.flag[51 + d_i] != 0) _amt_add += 1; if (global.flag[51 + d_i] == 1) _violenced += 1; if (global.flag[51 + d_i] == 2) _spared += 1; if (global.flag[51 + d_i] == 3) _pacified += 1; if (global.flag[51 + d_i] == 6) _frozened += 1; } if (_frozened > 0) global.flag[50 last_encounter_end] = 6; if (_pacified > 0) global.flag[50 last_encounter_end] = 3; if (_spared > 0) global.flag[50 last_encounter_end] = 2; if (_violenced > 0) global.flag[50 last_encounter_end] = 1; if (_frozened > 0) { if (_pacified > 0 || _violenced > 0 || _spared > 0) global.flag[50 last_encounter_end] = 1; } if (global.flag[50 last_encounter_end] == 6) global.flag[926 iceshocked_encounters]++; if (global.flag[54 encounter_pointer] != 0) { global.flag[global.flag[54 encounter_pointer]] = global.flag[50 last_encounter_end]; global.flag[54 encounter_pointer] = 0; } } event_user(11); } }
();
116
    instance_destroy();
117
    con = 7;
118
}
119
if (global.myfight == 3)
120
{
121
    xx = __view_get(e__VW.XView, 0);
122
    yy = __view_get(e__VW.YView, 0);
123
    if (acting == 1 && actcon == 0)
124
    {
125
        actcon = 1;
126
        global.msg[0] = "";
127
        scr_battletext_default
scr_battletext_default

function scr_battletext_default() { global.fc = 0; global.typer = 4; scr_battletext(); return battlewriter; }
();
128
    }
129
    if (acting == 2 && actcon == 0)
130
    {
131
        actcon = 1;
132
        if (global.automiss[myself] == 0)
133
        {
134
            global.msg[0] = "";
135
            global.monstercomment[myself] = "";
136
            global.automiss[myself] = 1;
137
        }
138
        scr_battletext_default
scr_battletext_default

function scr_battletext_default() { global.fc = 0; global.typer = 4; scr_battletext(); return battlewriter; }
();
139
    }
140
    if (acting == 3 && actcon == 0)
141
    {
142
        global.msg[0] = "";
143
        global.mercymod[myself] += 200;
144
        scr_battletext_default
scr_battletext_default

function scr_battletext_default() { global.fc = 0; global.typer = 4; scr_battletext(); return battlewriter; }
();
145
        actcon = 1;
146
    }
147
    if (acting == 4 && actcon == 0)
148
    {
149
        global.msg[0] = "";
150
        battlecancel = 1;
151
        scr_battletext_default
scr_battletext_default

function scr_battletext_default() { global.fc = 0; global.typer = 4; scr_battletext(); return battlewriter; }
();
152
        actcon = 1;
153
    }
154
    if (acting == 5 && actcon == 0)
155
    {
156
        global.msg[0] = "";
157
        battlecancel = 2;
158
        scr_battletext_default
scr_battletext_default

function scr_battletext_default() { global.fc = 0; global.typer = 4; scr_battletext(); return battlewriter; }
();
159
        actcon = 1;
160
    }
161
    if (acting == 6 && actcon == 0)
162
    {
163
        global.msg[0] = "";
164
        global.monstercomment[myself] = "";
165
        global.monsterstatus[myself] = 1;
166
        scr_battletext_default
scr_battletext_default

function scr_battletext_default() { global.fc = 0; global.typer = 4; scr_battletext(); return battlewriter; }
();
167
        actcon = 1;
168
    }
169
    if (actcon == 1 && !instance_exists(obj_writer))
170
    {
171
        actcon = 0;
172
        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); } } } }
();
173
    }
174
}
175
if (global.myfight == 7)
176
    hspeed = 15;
177
178
enum e__VW
179
{
180
    XView,
181
    YView,
182
    WView,
183
    HView,
184
    Angle,
185
    HBorder,
186
    VBorder,
187
    HSpeed,
188
    VSpeed,
189
    Object,
190
    Visible,
191
    XPort,
192
    YPort,
193
    WPort,
194
    HPort,
195
    Camera,
196
    SurfaceID
197
}