Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_heroparent_Alarm_1

(view raw script w/o annotations or w/e)
1
global.faceaction[myself] = 0;
2
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);
3
if (cancelattack == 0)
4
{
5
    dm = instance_create(global.monsterx[global.chartarget[myself]], (global.monstery[global.chartarget[myself]] - (global.hittarget[global.chartarget[myself]] * 20)) + 20, obj_dmgwriter);
6
    dm.type = char - 1;
7
    if (char == 4)
8
        dm.type = 6;
9
    dm.delay = 8;
10
    if (global.chapter == 2 && instance_exists(obj_spamton_neo_enemy) && obj_spamton_neo_enemy.weirdpathendcon > 0)
11
    {
12
        damage = round((global.battleat[myself] * points) / 150);
13
        if (damage < 5)
14
            damage = 5;
15
        if (damage > 10)
16
            damage = 10;
17
    }
18
    else
19
    {
20
        damage = round(((global.battleat[myself] * points) / 20) - (global.monsterdf[global.chartarget[myself]] * 3));
21
    }
22
    if (global.monstertype[global.chartarget[myself]] == 19Susie (w/ Lancer))
23
        damage = ceil(damage * 0.3);
24
    if (damage < 0)
25
        damage = 0;
26
    if (damage == 0)
27
    {
28
        dm.delay = 2;
29
        with (global.monsterinstance[global.chartarget[myself]])
30
        {
31
            if (hurttimer <= 15 && candodge == 1)
32
            {
33
                dodgetimer = 0;
34
                state = 4;
35
            }
36
        }
37
    }
38
    dm.damage = damage;
39
    global.hittarget[global.chartarget[myself]] += 1;
40
    var queenshield;
41
    if (global.chapter == 2)
42
        queenshield = 0;
43
    if (global.chapter == 2 && instance_exists(obj_queen_enemy))
44
    {
45
        if (instance_exists(obj_queenshield_enemy))
46
        {
47
            obj_queen_enemy.shieldhp -= damage;
48
            queenshield = 1;
49
        }
50
        else
51
        {
52
            global.monsterhp[global.chartarget[myself]] -= damage;
53
            if (damage != 0)
54
            {
55
                with (obj_queen_enemy)
56
                    shieldbrokecon = 1;
57
            }
58
        }
59
    }
60
    else
61
    {
62
        global.monsterhp[global.chartarget[myself]] -= damage;
63
    }
64
    if (is_auto_susie == 1 && global.monsterhp[global.chartarget[myself]] <= 0)
65
    {
66
        with (global.chartarget[myself])
67
            global.flag[51 + myself] = 5;
68
    }
69
    if (damage > 0)
70
    {
71
        if (global.monstertype[0] != 20JEVIL)
72
            scr_tensionheal
scr_tensionheal

function scr_tensionheal(arg0) { global.tension += arg0; if (global.tension > global.maxtension) global.tension = global.maxtension; }
(round(points / 10));
73
        if (global.monstertype[0] == 20JEVIL)
74
            scr_tensionheal
scr_tensionheal

function scr_tensionheal(arg0) { global.tension += arg0; if (global.tension > global.maxtension) global.tension = global.maxtension; }
(round(points / 15));
75
        attack = instance_create(global.monsterx[global.chartarget[myself]] + random(6), global.monstery[global.chartarget[myself]] + random(6), obj_basicattack);
76
        if (object_index == obj_herosusie)
77
        {
78
            attack.sprite_index = spr_attack_mash2;
79
            attack.image_speed = 0.5;
80
            attack.maxindex = 4;
81
            snd_play(snd_impact);
82
            instance_create(0, 0, obj_shake);
83
        }
84
        if (object_index == obj_heroralsei)
85
        {
86
            attack.sprite_index = spr_attack_slap1;
87
            attack.maxindex = 4;
88
            attack.image_speed = 0.5;
89
        }
90
        if (object_index == obj_heronoelle)
91
        {
92
            attack.sprite_index = spr_attack_slap2;
93
            attack.maxindex = 4;
94
            attack.image_speed = 0.5;
95
        }
96
        if (points == 150)
97
        {
98
            attack.image_xscale = 2.5;
99
            attack.image_yscale = 2.5;
100
        }
101
        if (global.chapter == 2 && queenshield == 1)
102
        {
103
            with (obj_basicattack)
104
                x = obj_queenshield_enemy.x + 34;
105
            if (damage != 0)
106
            {
107
                with (obj_queenshield_enemy)
108
                    event_user(0);
109
            }
110
        }
111
        else
112
        {
113
            if (global.chapter == 2 && instance_exists(obj_queen_enemy))
114
            {
115
                with (obj_basicattack)
116
                    x = obj_queen_enemy.x + 62;
117
            }
118
            if (global.chapter == 2 && instance_exists(obj_spamton_neo_enemy))
119
            {
120
                with (obj_spamton_neo_enemy)
121
                {
122
                    partmode = 40;
123
                    shockthreshold = 15;
124
                    shocktimer = 9999;
125
                    hurttimer2 = 10;
126
                }
127
            }
128
            with (global.monsterinstance[global.chartarget[myself]])
129
            {
130
                shakex = 9;
131
                state = 3;
132
                hurttimer = 30;
133
            }
134
        }
135
        if (i_ex(global.monsterinstance[global.chartarget[myself]]))
136
            global.monsterinstance[global.chartarget[myself]].hurtamt = damage;
137
    }
138
    if (global.chapter == 2 && queenshield == 1)
139
    {
140
        dm.x = obj_queenshield_enemy.x;
141
        dm.depth = dm.depth - 100;
142
    }
143
    if (global.chapter == 2 && instance_exists(obj_sweet_enemy) && global.monsterhp[global.chartarget[myself]] <= 0)
144
        global.monsterhp[global.chartarget[myself]] = 1;
145
    var a = 0;
146
    if (global.chapter == 2 && instance_exists(obj_queen_enemy))
147
        a = 1;
148
    if (global.chapter == 2 && instance_exists(obj_spamton_neo_enemy))
149
        a = 2;
150
    if (global.chapter == 2 && instance_exists(obj_berdlyb_enemy))
151
        a = 3;
152
    if (global.monsterhp[global.chartarget[myself]] <= 0 && a == 0)
153
    {
154
        with (global.monsterinstance[global.chartarget[myself]])
155
            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); } }
();
156
    }
157
    if (global.chapter == 2 && global.monsterhp[global.chartarget[myself]] <= 0 && a == 3)
158
    {
159
        with (global.monsterinstance[global.chartarget[myself]])
160
            endcon = 1;
161
    }
162
}