Deltarune (Chapter 5) 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("==
scr_monsterdefeat() called ==");
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)
{ var _amt_add = 0; var _frozened = 0; var _violenced = 0; var _spared = 0; var _pacified = 0; for (var d_i = 0; d_i < 3; d_i++) { 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 flag: global.flag[" + string(global.flag[54 encounter_pointer]) + "]=" + string(global.flag[50 last_encounter_end])); global.flag[54 encounter_pointer] = 0; } } event_user(11); debug_message("======="); } }
()
2
{
3
    if (global.monster[myself] == 1)
4
    {
5
        debug_message("== 
scr_monsterdefeat
scr_monsterdefeat

function
scr_monsterdefeat()
{ if (global.monster[myself] == 1) { debug_message("==
scr_monsterdefeat() called ==");
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)
{ var _amt_add = 0; var _frozened = 0; var _violenced = 0; var _spared = 0; var _pacified = 0; for (var d_i = 0; d_i < 3; d_i++) { 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 flag: global.flag[" + string(global.flag[54 encounter_pointer]) + "]=" + string(global.flag[50 last_encounter_end])); global.flag[54 encounter_pointer] = 0; } } event_user(11); debug_message("======="); } }
() called ==");
6
        debug_message("===== Encounter Results =====");
7
        global.monstergold[3] += global.monstergold[myself];
8
        global.monsterexp[3] += global.monsterexp[myself];
9
        global.monster[myself] = 0;
10
        if (global.flag[51 + myself] == 0)
11
        {
12
            global.flag[51 + myself] = 2;
13
            if (global.monsterhp[myself] <= 0)
14
                global.flag[51 + myself] = 1;
15
        }
16
        if (global.flag[51 + myself] == 1)
17
        {
18
            global.flag[40 violences] += 1;
19
            if (fatal == 1)
20
                global.flag[44 kills]++;
21
        }
22
        if (global.flag[51 + myself] == 2)
23
            global.flag[41 spares] += 1;
24
        if (global.flag[51 + myself] == 3)
25
            global.flag[42 pacifies] += 1;
26
        if (global.flag[51 + myself] == 5)
27
            global.flag[43 autosusie_violences] += 1;
28
        if (global.flag[51 + myself] == 6)
29
        {
30
            global.flag[45 freezes] += 1;
31
            global.monstergold[3] += 24;
32
        }
33
        if (
scr_monsterpop
scr_monsterpop

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