Deltarune (Chapter 3) script viewer

← back to main script listing

gml_GlobalScript_scr_monsterdefeat

(view raw script w/o annotations or w/e)
1
function 
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 (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]; debug_message("=====Encounter Results====="); debug_message("encounter flag: global.flag[" + string(global.flag[54 encounter_pointer]) + "]=" + string(global.flag[50 last_encounter_end])); debug_message("======="); global.flag[54 encounter_pointer] = 0; } } event_user(11); } }
()
2
{
3
    if (global.monster[myself] == 1)
4
    {
5
        global.monstergold[3] += global.monstergold[myself];
6
        global.monsterexp[3] += global.monsterexp[myself];
7
        global.monster[myself] = 0;
8
        if (global.flag[51 + myself] == 0)
9
        {
10
            global.flag[51 + myself] = 2;
11
            if (global.monsterhp[myself] <= 0)
12
                global.flag[51 + myself] = 1;
13
        }
14
        if (global.flag[51 + myself] == 1)
15
        {
16
            global.flag[40 violences] += 1;
17
            if (fatal == 1)
18
                global.flag[44 kills]++;
19
        }
20
        if (global.flag[51 + myself] == 2)
21
            global.flag[41 spares] += 1;
22
        if (global.flag[51 + myself] == 3)
23
            global.flag[42 pacifies] += 1;
24
        if (global.flag[51 + myself] == 5)
25
            global.flag[43 autosusie_violences] += 1;
26
        if (global.flag[51 + myself] == 6)
27
        {
28
            global.flag[45 freezes] += 1;
29
            global.monstergold[3] += 24;
30
        }
31
        if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
32
        {
33
            _amt_add = 0;
34
            _frozened = 0;
35
            _violenced = 0;
36
            _spared = 0;
37
            _pacified = 0;
38
            for (d_i = 0; d_i < 3; d_i += 1)
39
            {
40
                if (global.flag[51 + d_i] != 0)
41
                    _amt_add += 1;
42
                if (global.flag[51 + d_i] == 1)
43
                    _violenced += 1;
44
                if (global.flag[51 + d_i] == 2)
45
                    _spared += 1;
46
                if (global.flag[51 + d_i] == 3)
47
                    _pacified += 1;
48
                if (global.flag[51 + d_i] == 6)
49
                    _frozened += 1;
50
            }
51
            if (_frozened > 0)
52
                global.flag[50 last_encounter_end] = 6;
53
            if (_pacified > 0)
54
                global.flag[50 last_encounter_end] = 3;
55
            if (_spared > 0)
56
                global.flag[50 last_encounter_end] = 2;
57
            if (_violenced > 0)
58
                global.flag[50 last_encounter_end] = 1;
59
            if (global.flag[50 last_encounter_end] == 6)
60
                global.flag[926 iceshocked_encounters]++;
61
            if (global.flag[54 encounter_pointer] != 0)
62
            {
63
                global.flag[global.flag[54 encounter_pointer]] = global.flag[50 last_encounter_end];
64
                debug_message("=====Encounter Results=====");
65
                debug_message("encounter flag: global.flag[" + string(global.flag[54 encounter_pointer]) + "]=" + string(global.flag[50 last_encounter_end]));
66
                debug_message("=======");
67
                global.flag[54 encounter_pointer] = 0;
68
            }
69
        }
70
        event_user(11);
71
    }
72
}