Deltarune (Chapter 1) 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);
} 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; 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
    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))
11
    {
12
        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)
13
            
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);
14
    }
15
    else
16
    {
17
        
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);
18
    }
19
    global.lhp = ceil(global.hp[1] / global.maxhp[1]) * global.lmaxhp;
20
    if (global.lhp < 1)
21
        global.lhp = 1;
22
    if (global.lhp > global.lmaxhp)
23
        global.lhp = global.lmaxhp;
24
    global.lwstrength = 1;
25
    if (global.charweapon[1] == 1)
26
        global.lweapon = 2;
27
    if (global.charweapon[1] == 5)
28
        global.lweapon = 6;
29
    if (global.charweapon[1] == 8)
30
        global.lweapon = 7;
31
    global.darkzone = 0;
32
}