Deltarune (Chapter 3) script viewer

← back to main script listing

gml_GlobalScript_scr_become_light

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

function
scr_become_light()
{ if (
scr_litemcheck(5) == 0)
scr_litemget(5);
if (
scr_keyitemcheck(2))
{ if (
scr_litemcheck(8) == 0)
scr_litemget(8);
} else {
scr_litemremove(8);
} if (
scr_keyitemcheck(13))
{ if (
scr_litemcheck(11) == 0)
scr_litemget(11);
} else {
scr_litemremove(11);
} global.lhp = ceil(global.hp[1] / global.maxhp[1]) * global.lmaxhp; if (global.lhp < 1) global.lhp = 1; if (global.lhp > global.lmaxhp) global.lhp = global.lmaxhp; global.lwstrength = 1; if (global.charweapon[1] == 1) global.lweapon = 2; if (global.charweapon[1] == 5) global.lweapon = 6; if (global.charweapon[1] == 8) global.lweapon = 7; if (global.charweapon[1] == 14) global.lweapon = 12; if (global.charweapon[1] == 16) global.lweapon = 13; var armorconverted = 0; if (
scr_armorcheck_equipped(1, 14) > 0)
{ armorconverted = 1; global.larmor = 14; } if (armorconverted == 1) global.ladef = 1; else global.ladef = 0; global.darkzone = 0; }
()
2
{
3
    if (
scr_litemcheck
scr_litemcheck

function
scr_litemcheck(arg0)
{ haveit = 0; itemcount = 0; for (i = 0; i < 8; i += 1) { if (global.litem[i] == arg0) haveit = 1; if (global.litem[i] == arg0) itemcount += 1; } return haveit; }
(5) == 0)
4
        
scr_litemget
scr_litemget

function
scr_litemget(arg0)
{ i = 0; loop = 1; noroom = 0; global.litem[8] = 999; while (loop == 1) { if (global.litem[i] == 0) { global.litem[i] = arg0; break; } if (i == 8) { noroom = 1; break; } i += 1; }
scr_litemname();
}
(5);
5
    if (
scr_keyitemcheck
scr_keyitemcheck

function
scr_keyitemcheck(arg0)
{ haveit = 0; itemcount = 0; for (i = 0; i < 12; i += 1) { if (global.keyitem[i] == arg0) haveit = 1; if (global.keyitem[i] == arg0) itemcount += 1; } return haveit; }
(2))
6
    {
7
        if (
scr_litemcheck
scr_litemcheck

function
scr_litemcheck(arg0)
{ haveit = 0; itemcount = 0; for (i = 0; i < 8; i += 1) { if (global.litem[i] == arg0) haveit = 1; if (global.litem[i] == arg0) itemcount += 1; } return haveit; }
(8) == 0)
8
            
scr_litemget
scr_litemget

function
scr_litemget(arg0)
{ i = 0; loop = 1; noroom = 0; global.litem[8] = 999; while (loop == 1) { if (global.litem[i] == 0) { global.litem[i] = arg0; break; } if (i == 8) { noroom = 1; break; } i += 1; }
scr_litemname();
}
(8);
9
    }
10
    else
11
    {
12
        
scr_litemremove
scr_litemremove

function
scr_litemremove(arg0)
{ for (i = 0; i < 8; i += 1) { if (global.litem[i] == arg0) script_execute(scr_litemshift, i, 0); } }
(8);
13
    }
14
    if (
scr_keyitemcheck
scr_keyitemcheck

function
scr_keyitemcheck(arg0)
{ haveit = 0; itemcount = 0; for (i = 0; i < 12; i += 1) { if (global.keyitem[i] == arg0) haveit = 1; if (global.keyitem[i] == arg0) itemcount += 1; } return haveit; }
(13))
15
    {
16
        if (
scr_litemcheck
scr_litemcheck

function
scr_litemcheck(arg0)
{ haveit = 0; itemcount = 0; for (i = 0; i < 8; i += 1) { if (global.litem[i] == arg0) haveit = 1; if (global.litem[i] == arg0) itemcount += 1; } return haveit; }
(11) == 0)
17
            
scr_litemget
scr_litemget

function
scr_litemget(arg0)
{ i = 0; loop = 1; noroom = 0; global.litem[8] = 999; while (loop == 1) { if (global.litem[i] == 0) { global.litem[i] = arg0; break; } if (i == 8) { noroom = 1; break; } i += 1; }
scr_litemname();
}
(11);
18
    }
19
    else
20
    {
21
        
scr_litemremove
scr_litemremove

function
scr_litemremove(arg0)
{ for (i = 0; i < 8; i += 1) { if (global.litem[i] == arg0) script_execute(scr_litemshift, i, 0); } }
(11);
22
    }
23
    global.lhp = ceil(global.hp[1] / global.maxhp[1]) * global.lmaxhp;
24
    if (global.lhp < 1)
25
        global.lhp = 1;
26
    if (global.lhp > global.lmaxhp)
27
        global.lhp = global.lmaxhp;
28
    global.lwstrength = 1;
29
    if (global.charweapon[1] == 1)
30
        global.lweapon = 2;
31
    if (global.charweapon[1] == 5)
32
        global.lweapon = 6;
33
    if (global.charweapon[1] == 8)
34
        global.lweapon = 7;
35
    if (global.charweapon[1] == 14)
36
        global.lweapon = 12;
37
    if (global.charweapon[1] == 16)
38
        global.lweapon = 13;
39
    var armorconverted = 0;
40
    if (
scr_armorcheck_equipped
scr_armorcheck_equipped

function
scr_armorcheck_equipped(arg0, arg1)
{ var __wearing = 0; if (global.chararmor1[arg0] == arg1) __wearing++; if (global.chararmor2[arg0] == arg1) __wearing++; return __wearing; }
(1, 14) > 0)
41
    {
42
        armorconverted = 1;
43
        global.larmor = 14;
44
    }
45
    if (armorconverted == 1)
46
        global.ladef = 1;
47
    else
48
        global.ladef = 0;
49
    global.darkzone = 0;
50
}