Deltarune (Chapter 4) script viewer

← back to main script listing

gml_GlobalScript_scr_levelup

(view raw script w/o annotations or w/e)
1
function 
scr_levelup
scr_levelup

function
scr_levelup()
{ var krismaxhp = 240; var susiemaxhp = 290; var ralseimaxhp = 210; var encountercountflag = 1580; var attackpluscountflag = 1618; var gainedstats = 0; global.flag[encountercountflag]++; if (global.maxhp[1] < krismaxhp || global.maxhp[2] < susiemaxhp || global.maxhp[3] < ralseimaxhp) { gainedstats = 1; if (global.maxhp[1] < krismaxhp) { global.maxhp[1] += 2; global.hp[1] += 2; } if (global.maxhp[2] < susiemaxhp) { global.maxhp[2] += 2; global.hp[2] += 2; } if (global.maxhp[3] < ralseimaxhp) { global.maxhp[3] += 2; global.hp[3] += 2; } if ((global.flag[encountercountflag] % 2) == 0) global.maxhp[2] += 1; } if ((global.flag[encountercountflag] % 10) == 0 && global.flag[attackpluscountflag] < 2) { gainedstats = 1; global.at[1] += 1; global.at[2] += 1; global.mag[2] += 1; global.at[3] += 1; global.mag[3] += 1; global.flag[attackpluscountflag]++; } if (
scr_havechar(4))
{ global.flag[919 times_noelle_leveled]++; global.maxhp[4] += 4; global.hp[4] += 4; if ((global.flag[1580] % 4) == 0) { global.at[4] += 1; global.mag[4] += 1; } } global.maxhp[1] = clamp(global.maxhp[1], 10, krismaxhp); global.maxhp[2] = clamp(global.maxhp[2], 10, susiemaxhp); global.maxhp[3] = clamp(global.maxhp[3], 10, ralseimaxhp); global.maxhp[4] = clamp(global.maxhp[4], 10, 999); for (var _i = 1; _i < 5; _i++) global.hp[_i] = min(global.hp[_i], global.maxhp[_i]); return gainedstats; }
()
2
{
3
    var krismaxhp = 240;
4
    var susiemaxhp = 290;
5
    var ralseimaxhp = 210;
6
    var encountercountflag = 1580;
7
    var attackpluscountflag = 1618;
8
    var gainedstats = 0;
9
    global.flag[encountercountflag]++;
10
    if (global.maxhp[1] < krismaxhp || global.maxhp[2] < susiemaxhp || global.maxhp[3] < ralseimaxhp)
11
    {
12
        gainedstats = 1;
13
        if (global.maxhp[1] < krismaxhp)
14
        {
15
            global.maxhp[1] += 2;
16
            global.hp[1] += 2;
17
        }
18
        if (global.maxhp[2] < susiemaxhp)
19
        {
20
            global.maxhp[2] += 2;
21
            global.hp[2] += 2;
22
        }
23
        if (global.maxhp[3] < ralseimaxhp)
24
        {
25
            global.maxhp[3] += 2;
26
            global.hp[3] += 2;
27
        }
28
        if ((global.flag[encountercountflag] % 2) == 0)
29
            global.maxhp[2] += 1;
30
    }
31
    if ((global.flag[encountercountflag] % 10) == 0 && global.flag[attackpluscountflag] < 2)
32
    {
33
        gainedstats = 1;
34
        global.at[1] += 1;
35
        global.at[2] += 1;
36
        global.mag[2] += 1;
37
        global.at[3] += 1;
38
        global.mag[3] += 1;
39
        global.flag[attackpluscountflag]++;
40
    }
41
    if (
scr_havechar
scr_havechar

function
scr_havechar(arg0)
{ var checker = arg0; if (checker == "susie" || checker == "su" || checker == "s") checker = 2; if (checker == "ralsei" || checker == "ra" || checker == "r") checker = 3; if (checker == "noelle" || checker == "no" || checker == "n") checker = 4; _rreturn = 0; if (global.char[0] == checker) _rreturn = 1; if (global.char[1] == checker) _rreturn = 1; if (global.char[2] == checker) _rreturn = 1; return _rreturn; }
(4))
42
    {
43
        global.flag[919 times_noelle_leveled]++;
44
        global.maxhp[4] += 4;
45
        global.hp[4] += 4;
46
        if ((global.flag[1580] % 4) == 0)
47
        {
48
            global.at[4] += 1;
49
            global.mag[4] += 1;
50
        }
51
    }
52
    global.maxhp[1] = clamp(global.maxhp[1], 10, krismaxhp);
53
    global.maxhp[2] = clamp(global.maxhp[2], 10, susiemaxhp);
54
    global.maxhp[3] = clamp(global.maxhp[3], 10, ralseimaxhp);
55
    global.maxhp[4] = clamp(global.maxhp[4], 10, 999);
56
    for (var _i = 1; _i < 5; _i++)
57
        global.hp[_i] = min(global.hp[_i], global.maxhp[_i]);
58
    return gainedstats;
59
}