Deltarune (Chapter 2) script viewer

← back to main script listing

gml_GlobalScript_scr_damage_cache

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

function scr_damage_cache() { global.damage_cache = []; for (var i = 0; i < 3; i++) global.damage_cache[array_length(global.damage_cache)] = global.hp[global.char[i]]; } function scr_damage_check() { if (!variable_global_exists("damage_cache")) global.damage_cache = []; var took_damage = false; for (var i = 0; i < array_length(global.damage_cache); i++) { var hp_cache = global.damage_cache[i]; if (global.hp[global.char[i]] < hp_cache) { took_damage = true; break; } } if (took_damage) { with (obj_event_manager) trigger_event(UnknownEnum.Value_1); } } enum UnknownEnum { Value_1 = 1 }
()
2
{
3
    global.damage_cache = [];
4
    for (var i = 0; i < 3; i++)
5
        global.damage_cache[array_length(global.damage_cache)] = global.hp[global.char[i]];
6
}
7
8
function scr_damage_check()
9
{
10
    if (!variable_global_exists("damage_cache"))
11
        global.damage_cache = [];
12
    var took_damage = false;
13
    for (var i = 0; i < array_length(global.damage_cache); i++)
14
    {
15
        var hp_cache = global.damage_cache[i];
16
        if (global.hp[global.char[i]] < hp_cache)
17
        {
18
            took_damage = true;
19
            break;
20
        }
21
    }
22
    if (took_damage)
23
    {
24
        with (obj_event_manager)
25
            trigger_event(UnknownEnum.Value_1);
26
    }
27
}
28
29
enum UnknownEnum
30
{
31
    Value_1 = 1
32
}