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

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