Deltarune (Chapter 4) script viewer

← back to main script listing

gml_GlobalScript_scr_become_dark

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

function
scr_become_dark()
{ global.darkzone = 1; scr_equip_dw_weapon_by_lw_id(global.lweapon); for (var i = 0; i < 8; i++) { var weapon = get_weapon_by_lw_id(global.litem[i]); if (weapon != -4) { if (!
scr_weaponcheck_inventory(weapon.dw_id) && !
scr_weaponcheck_equipped_any(weapon.dw_id))
scr_weaponget(weapon.dw_id);
} } global.hp[1] = ceil((global.lhp / global.lmaxhp) * global.maxhp[1]); if (global.hp[1] < 1) global.hp[1] = 1; if (global.hp[1] > global.maxhp[1]) global.hp[1] = global.maxhp[1]; }
()
2
{
3
    global.darkzone = 1;
4
    scr_equip_dw_weapon_by_lw_id(global.lweapon);
5
    for (var i = 0; i < 8; i++)
6
    {
7
        var weapon = get_weapon_by_lw_id(global.litem[i]);
8
        if (weapon != -4)
9
        {
10
            if (!
scr_weaponcheck_inventory
scr_weaponcheck_inventory

function
scr_weaponcheck_inventory(arg0)
{ haveit = 0; itemcount = 0; for (i = 0; i < 48; i += 1) { if (global.weapon[i] == arg0) haveit = 1; if (global.weapon[i] == arg0) itemcount += 1; } return haveit; }
(weapon.dw_id) && !
scr_weaponcheck_equipped_any
scr_weaponcheck_equipped_any

function
scr_weaponcheck_equipped_any(arg0)
{ var __totalwearing = 0; for (var __weari = 0; __weari < array_length_1d(global.charweapon); __weari++) __totalwearing +=
scr_weaponcheck_equipped(__weari, arg0);
return __totalwearing; }
(weapon.dw_id))
11
                
scr_weaponget
scr_weaponget

function
scr_weaponget(arg0)
{ noroom = 0; var legacy = 0; var __i = 0; if (legacy == 0) { var __itemcount = 0; __weapon[0] = arg0; for (__i = 0; __i < 48; __i++) { if (global.weapon[__i] != 0) { __weapon[__itemcount + 1] = global.weapon[__i]; __itemcount++; } } if (__itemcount >= 48) { noroom = 1; } else { for (__i = 0; __i < 48; __i++) { if (__i <= __itemcount) global.weapon[__i] = __weapon[__i]; else global.weapon[__i] = 0; } } } else if (legacy) { loop = 1; global.weapon[48] = 999; while (loop == 1) { if (global.weapon[__i] == 0) { global.weapon[__i] = arg0; break; } if (__i == 48) { noroom = 1; break; } __i += 1; } } script_execute(scr_weaponinfo_all); }
(weapon.dw_id);
12
        }
13
    }
14
    global.hp[1] = ceil((global.lhp / global.lmaxhp) * global.maxhp[1]);
15
    if (global.hp[1] < 1)
16
        global.hp[1] = 1;
17
    if (global.hp[1] > global.maxhp[1])
18
        global.hp[1] = global.maxhp[1];
19
}