Deltarune script viewer

← back to main script listing

gml_GlobalScript_scr_bullet_heal

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

function scr_bullet_heal(arg0) { with (obj_dmgwriter) { if (delaytimer >= 1) killactive = 1; } if (target == 4) { scr_randomtarget_old(); target = mytarget; } if (target < 3) { if (global.hp[global.char[target]] <= 0) { scr_randomtarget_old(); target = mytarget; with (global.charinstance[target]) { image_blend = c_white; darkify = 0; } } } scr_heal(target, arg0); with (global.charinstance[target]) { ha = instance_create(x, y, obj_healanim); ha.target = id; dmgwr = scr_dmgwriter_selfchar(); with (dmgwr) { delay = 8; type = 3; damage = arg0; } if (global.hp[global.char[myself]] >= global.maxhp[global.char[myself]]) { with (dmgwr) specialmessage = 3; } tu += 1; } snd_stop(snd_power); snd_play(snd_power); }
(arg0)
2
{
3
    with (obj_dmgwriter)
4
    {
5
        if (delaytimer >= 1)
6
            killactive = 1;
7
    }
8
    if (target == 4)
9
    {
10
        scr_randomtarget_old
scr_randomtarget_old

function scr_randomtarget_old() { abletotarget = 1; if (global.charcantarget[0] == 0 && global.charcantarget[1] == 0 && global.charcantarget[2] == 0) abletotarget = 0; mytarget = choose(0, 1, 2); if (abletotarget == 1) { while (global.charcantarget[mytarget] == 0) mytarget = choose(0, 1, 2); } else { mytarget = 3; } global.targeted[mytarget] = 1; }
();
11
        target = mytarget;
12
    }
13
    if (target < 3)
14
    {
15
        if (global.hp[global.char[target]] <= 0)
16
        {
17
            scr_randomtarget_old
scr_randomtarget_old

function scr_randomtarget_old() { abletotarget = 1; if (global.charcantarget[0] == 0 && global.charcantarget[1] == 0 && global.charcantarget[2] == 0) abletotarget = 0; mytarget = choose(0, 1, 2); if (abletotarget == 1) { while (global.charcantarget[mytarget] == 0) mytarget = choose(0, 1, 2); } else { mytarget = 3; } global.targeted[mytarget] = 1; }
();
18
            target = mytarget;
19
            with (global.charinstance[target])
20
            {
21
                image_blend = c_white;
22
                darkify = 0;
23
            }
24
        }
25
    }
26
    scr_heal
scr_heal

function scr_heal(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(arg0); } snd_stop(snd_power); snd_play(snd_power); return global.hp[hltarget] - _curhp; }
(target, arg0);
27
    with (global.charinstance[target])
28
    {
29
        ha = instance_create(x, y, obj_healanim);
30
        ha.target = id;
31
        dmgwr = scr_dmgwriter_selfchar
scr_dmgwriter_selfchar

function scr_dmgwriter_selfchar() { return instance_create(x, (y + myheight) - 24 - (tu * 20), obj_dmgwriter); }
();
32
        with (dmgwr)
33
        {
34
            delay = 8;
35
            type = 3;
36
            damage = arg0;
37
        }
38
        if (global.hp[global.char[myself]] >= global.maxhp[global.char[myself]])
39
        {
40
            with (dmgwr)
41
                specialmessage = 3;
42
        }
43
        tu += 1;
44
    }
45
    snd_stop(snd_power);
46
    snd_play(snd_power);
47
}