Deltarune (Chapter 4) 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) { debug_message("=====Encounter Results====="); 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); debug_message("======="); } }
()
2
{
3
    if (global.monster[myself] == 1)
4
    {
5
        debug_message("=====Encounter Results=====");
6
        global.monstergold[3] += global.monstergold[myself];
7
        global.monsterexp[3] += global.monsterexp[myself];
8
        global.monster[myself] = 0;
9
        if (global.flag[51 + myself] == 0)
10
        {
11
            global.flag[51 + myself] = 2;
12
            if (global.monsterhp[myself] <= 0)
13
                global.flag[51 + myself] = 1;
14
        }
15
        if (global.flag[51 + myself] == 1)
16
        {
17
            global.flag[40 violences] += 1;
18
            if (fatal == 1)
19
                global.flag[44 kills]++;
20
        }
21
        if (global.flag[51 + myself] == 2)
22
            global.flag[41 spares] += 1;
23
        if (global.flag[51 + myself] == 3)
24
            global.flag[42 pacifies] += 1;
25
        if (global.flag[51 + myself] == 5)
26
            global.flag[43 autosusie_violences] += 1;
27
        if (global.flag[51 + myself] == 6)
28
        {
29
            global.flag[45 freezes] += 1;
30
            global.monstergold[3] += 24;
31
        }
32
        if (
scr_monsterpop
scr_monsterpop

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