Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_incense_cloud_Other_15

(view raw script w/o annotations or w/e)
1
if (global.inv < 0)
2
{
3
    
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 }
();
4
    if (!audio_is_playing(snd_hurt1) && !instance_exists(obj_shake))
5
    {
6
        instance_create(0, 0, obj_shake);
7
        snd_play(snd_hurt1);
8
    }
9
    var krisalive = true;
10
    var susiealive = true;
11
    var ralseialive = true;
12
    if (global.hp[1] < 1)
13
        krisalive = false;
14
    if (global.hp[2] < 1)
15
        susiealive = false;
16
    if (global.hp[3] < 1)
17
        ralseialive = false;
18
    var _r = 5;
19
    if (i_ex(obj_balthizard_enemy) && obj_balthizard_enemy.attackdown)
20
        _r = 2;
21
    repeat (_r)
22
    {
23
        var a = choose(0, 1, 2);
24
        if (a == 0)
25
        {
26
            if (global.hp[1] > 0)
27
                global.hp[1]--;
28
            else if (global.hp[2] > 0)
29
                global.hp[2]--;
30
            else if (global.hp[3] > 0)
31
                global.hp[1]--;
32
        }
33
        if (a == 1)
34
        {
35
            if (global.hp[2] > 0)
36
                global.hp[2]--;
37
            else if (global.hp[3] > 0)
38
                global.hp[3]--;
39
            else if (global.hp[1] > 0)
40
                global.hp[1]--;
41
        }
42
        if (a == 2)
43
        {
44
            if (global.hp[3] > 0)
45
                global.hp[3]--;
46
            else if (global.hp[1] > 0)
47
                global.hp[1]--;
48
            else if (global.hp[2] > 0)
49
                global.hp[2]--;
50
        }
51
    }
52
    if (global.hp[1] < 1 && krisalive)
53
    {
54
        __targx = global.charinstance[0].x;
55
        __targy = (global.charinstance[0].y + global.charinstance[0].myheight) - 24;
56
        dmgwriter = instance_create(__targx, __targy, obj_dmgwriter);
57
        dmgwriter.damage = abs(global.hp[1] - (global.maxhp[1] / 2));
58
        global.hp[1] = round(-global.maxhp[1] / 2);
59
        dmgwriter.type = 4;
60
        
scr_dead
scr_dead

function
scr_dead(arg0)
{ global.charmove[arg0] = 0; global.charcantarget[arg0] = 0; global.chardead[arg0] = 1; global.charaction[arg0] = 0; global.charspecial[arg0] = 0; }
(0);
61
    }
62
    if (global.hp[2] < 1 && susiealive)
63
    {
64
        __targx = global.charinstance[1].x;
65
        __targy = (global.charinstance[1].y + global.charinstance[1].myheight) - 24;
66
        dmgwriter = instance_create(__targx, __targy, obj_dmgwriter);
67
        dmgwriter.damage = abs(global.hp[2] - (global.maxhp[2] / 2));
68
        global.hp[2] = round(-global.maxhp[2] / 2);
69
        dmgwriter.type = 4;
70
        
scr_dead
scr_dead

function
scr_dead(arg0)
{ global.charmove[arg0] = 0; global.charcantarget[arg0] = 0; global.chardead[arg0] = 1; global.charaction[arg0] = 0; global.charspecial[arg0] = 0; }
(1);
71
    }
72
    if (global.hp[3] < 1 && ralseialive)
73
    {
74
        __targx = global.charinstance[2].x;
75
        __targy = (global.charinstance[2].y + global.charinstance[2].myheight) - 24;
76
        dmgwriter = instance_create(__targx, __targy, obj_dmgwriter);
77
        dmgwriter.damage = abs(global.hp[3] - (global.maxhp[3] / 2));
78
        global.hp[3] = round(-global.maxhp[3] / 2);
79
        dmgwriter.type = 4;
80
        
scr_dead
scr_dead

function
scr_dead(arg0)
{ global.charmove[arg0] = 0; global.charcantarget[arg0] = 0; global.chardead[arg0] = 1; global.charaction[arg0] = 0; global.charspecial[arg0] = 0; }
(2);
81
    }
82
    scr_damage_check();
83
    var gameover = 1;
84
    if (global.char[0] != 0 && global.hp[global.char[0]] > 0)
85
        gameover = 0;
86
    if (global.char[1] != 0 && global.hp[global.char[1]] > 0)
87
        gameover = 0;
88
    if (global.char[2] != 0 && global.hp[global.char[2]] > 0)
89
        gameover = 0;
90
    if (gameover == 1)
91
        
scr_gameover
scr_gameover

function
scr_gameover()
{ if (global.flag[35 gameover_mode] == 0) { audio_stop_all(); snd_play(snd_hurt1); if (global.chapter == 4) { if (i_ex(obj_jackenstein_enemy)) global.tempflag[89]++; } global.screenshot = sprite_create_from_surface(application_surface, 0, 0, __view_get(e__VW.WView, 0), __view_get(e__VW.HView, 0), 0, 0, 0, 0); snd_free_all(); room_goto(room_gameover ); } if (global.flag[35 gameover_mode] == 1) { global.turntimer = -1; global.flag[36 dojo_failure] = 1; global.flag[39 dojo_abort?] = 1; } if (global.flag[35 gameover_mode] == 2) { audio_stop_all(); snd_play(snd_hurt1); snd_free_all(); global.entrance = 0; global.tempflag[9] = 1; global.fighting = 0; global.interact = 0; global.hp[0] = 1; global.hp[1] = 1; global.hp[2] = 1; global.hp[3] = 1; __room = room; if (global.chapter == 2) { with (instance_create(0, 0, obj_persistentfadein)) image_alpha = 1.2; } room_goto(__room); } } enum e__VW { XView, YView, WView, HView, Angle, HBorder, VBorder, HSpeed, VSpeed, Object, Visible, XPort, YPort, WPort, HPort, Camera, SurfaceID }
();
92
}