Deltarune script viewer

← back to main script listing

gml_GlobalScript_scr_heal_ch1

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

function scr_heal_ch1(arg0, arg1) { abovemaxhp = 0; belowzero = 0; hltarget = global.char[arg0]; _curhp = global.hp[hltarget]; if (global.hp[hltarget] <= 0) belowzero = 1; if (global.hp[hltarget] > global.maxhp[hltarget]) abovemaxhp = 1; if (abovemaxhp == 0) { global.hp[hltarget] += arg1; if (global.hp[hltarget] > global.maxhp[hltarget]) global.hp[hltarget] = global.maxhp[hltarget]; } if (belowzero == 1 && global.hp[hltarget] >= 0) { if (global.hp[hltarget] < ceil(global.maxhp[hltarget] / 6)) global.hp[hltarget] = ceil(global.maxhp[hltarget] / 6); scr_revive_ch1(arg0); } snd_stop_ch1(snd_power_ch1); snd_play_ch1(snd_power_ch1); return global.hp[hltarget] - _curhp; }
(arg0, arg1)
2
{
3
    abovemaxhp = 0;
4
    belowzero = 0;
5
    hltarget = global.char[arg0];
6
    _curhp = global.hp[hltarget];
7
    if (global.hp[hltarget] <= 0)
8
        belowzero = 1;
9
    if (global.hp[hltarget] > global.maxhp[hltarget])
10
        abovemaxhp = 1;
11
    if (abovemaxhp == 0)
12
    {
13
        global.hp[hltarget] += arg1;
14
        if (global.hp[hltarget] > global.maxhp[hltarget])
15
            global.hp[hltarget] = global.maxhp[hltarget];
16
    }
17
    if (belowzero == 1 && global.hp[hltarget] >= 0)
18
    {
19
        if (global.hp[hltarget] < ceil(global.maxhp[hltarget] / 6))
20
            global.hp[hltarget] = ceil(global.maxhp[hltarget] / 6);
21
        scr_revive_ch1
scr_revive_ch1

function scr_revive_ch1(arg0) { global.charmove[arg0] = 1; global.charcantarget[arg0] = 1; global.chardead[arg0] = 0; }
(arg0);
22
    }
23
    snd_stop_ch1(snd_power_ch1);
24
    snd_play_ch1(snd_power_ch1);
25
    return global.hp[hltarget] - _curhp;
26
}