Undertale script viewer

← back to main script listing

gml_Object_obj_shootguy_Step_0

(view raw script w/o annotations or w/e)
1
buffer -= 1;
2
restart -= 1;
3
if (active == 1 && win == 0)
4
{
5
    if (buffer <= 0)
6
    {
7
        blt = 0;
8
        if (instance_exists(obj_shotguy))
9
            blt = 1;
10
        if (control_check_pressed(0) && ammo > 0 && buffer <= 0)
11
        {
12
            ammo -= 1;
13
            buffer = 4;
14
            instance_create(x, y, obj_shotguy);
15
        }
16
        if (keyboard_check_pressed(vk_right) && blt == 0 && buffer <= 0)
17
        {
18
            buffer = 4;
19
            event_user(0);
20
        }
21
        if (keyboard_check_pressed(vk_left) && blt == 0 && buffer <= 0)
22
        {
23
            buffer = 4;
24
            event_user(1);
25
        }
26
        if (keyboard_check_pressed(vk_up) && blt == 0 && buffer <= 0)
27
        {
28
            buffer = 4;
29
            event_user(2);
30
        }
31
        if (keyboard_check_pressed(vk_down) && blt == 0 && buffer <= 0)
32
        {
33
            buffer = 4;
34
            event_user(3);
35
        }
36
        if (control_check_pressed(1) && buffer <= 0 && instance_exists(obj_shotguy) == 0)
37
        {
38
            active = 0;
39
            alarm[2] = 2;
gml_Object_obj_shootguy_Alarm_2.gml

with (obj_blackbox_o) { instance_create(x + 10, y + 10, obj_blackbox_o_shatter); instance_destroy(); }
40
            alarm[1] = 12;
gml_Object_obj_shootguy_Alarm_1.gml

if (room == room_fire_shootguy_1) { idealammo = 2; if (active == 1) alarm[5] = 1; gridl = 120; gridr = 180; gridu = 60; gridd = 120; instance_create(140, 60, obj_blackbox_o); instance_create(140, 100, obj_blackbox_o); } if (room == room_fire_shootguy_2) { idealammo = 2; if (active == 1) alarm[5] = 1; gridl = 120; gridr = 200; gridu = 40; gridd = 120; instance_create(120, 60, obj_blackbox_o); instance_create(140, 60, obj_blackbox_o); instance_create(140, 100, obj_blackbox_o); instance_create(160, 60, obj_blackbox_o); instance_create(160, 80, obj_blackbox_o); instance_create(160, 100, obj_blackbox_o); } if (room == room_fire_shootguy_3) { idealammo = 1; if (active == 1) alarm[5] = 1; gridl = 120; gridr = 220; gridu = 40; gridd = 120; instance_create(180, 40, obj_blackbox_o); instance_create(180, 60, obj_blackbox_o); instance_create(180, 80, obj_blackbox_o); instance_create(180, 100, obj_blackbox_o); } if (room == room_fire_shootguy_4) { idealammo = 1; if (active == 1) alarm[5] = 1; gridl = 120; gridr = 220; gridu = 20; gridd = 120; instance_create(180, 20, obj_blackbox_o); instance_create(140, 40, obj_blackbox_o); instance_create(160, 60, obj_blackbox_o); instance_create(200, 60, obj_blackbox_o); instance_create(140, 80, obj_blackbox_o); instance_create(180, 80, obj_blackbox_o); } if (room == room_fire_shootguy_5) { idealammo = 2; if (active == 1) alarm[5] = 1; gridl = 120; gridr = 220; gridu = 20; gridd = 120; instance_create(160, 40, obj_blackbox_o); instance_create(160, 80, obj_blackbox_o); instance_create(140, 60, obj_blackbox_o); instance_create(160, 60, obj_blackbox_o); instance_create(180, 60, obj_blackbox_o); instance_create(200, 60, obj_blackbox_o); } if (win > 0) { with (obj_blackbox_o) instance_destroy(); with (obj_targetguy) instance_destroy(); }
41
            buffer = 15;
42
            alarm[3] = 1;
gml_Object_obj_shootguy_Alarm_3.gml

global.interact = 0; myinteract = 0; global.facing = 2;
43
        }
44
        if (ammo == 0 && instance_exists(obj_shotguy) == 0 && buffer <= 0 && active == 1)
45
        {
46
            if (instance_exists(obj_targetguy))
47
            {
48
                if (obj_targetguy.defeat == 0)
49
                {
50
                    restart = 20;
51
                    rstype = random(100);
52
                    buffer = 20;
53
                    alarm[2] = 2;
gml_Object_obj_shootguy_Alarm_2.gml

with (obj_blackbox_o) { instance_create(x + 10, y + 10, obj_blackbox_o_shatter); instance_destroy(); }
54
                    alarm[1] = 12;
gml_Object_obj_shootguy_Alarm_1.gml

if (room == room_fire_shootguy_1) { idealammo = 2; if (active == 1) alarm[5] = 1; gridl = 120; gridr = 180; gridu = 60; gridd = 120; instance_create(140, 60, obj_blackbox_o); instance_create(140, 100, obj_blackbox_o); } if (room == room_fire_shootguy_2) { idealammo = 2; if (active == 1) alarm[5] = 1; gridl = 120; gridr = 200; gridu = 40; gridd = 120; instance_create(120, 60, obj_blackbox_o); instance_create(140, 60, obj_blackbox_o); instance_create(140, 100, obj_blackbox_o); instance_create(160, 60, obj_blackbox_o); instance_create(160, 80, obj_blackbox_o); instance_create(160, 100, obj_blackbox_o); } if (room == room_fire_shootguy_3) { idealammo = 1; if (active == 1) alarm[5] = 1; gridl = 120; gridr = 220; gridu = 40; gridd = 120; instance_create(180, 40, obj_blackbox_o); instance_create(180, 60, obj_blackbox_o); instance_create(180, 80, obj_blackbox_o); instance_create(180, 100, obj_blackbox_o); } if (room == room_fire_shootguy_4) { idealammo = 1; if (active == 1) alarm[5] = 1; gridl = 120; gridr = 220; gridu = 20; gridd = 120; instance_create(180, 20, obj_blackbox_o); instance_create(140, 40, obj_blackbox_o); instance_create(160, 60, obj_blackbox_o); instance_create(200, 60, obj_blackbox_o); instance_create(140, 80, obj_blackbox_o); instance_create(180, 80, obj_blackbox_o); } if (room == room_fire_shootguy_5) { idealammo = 2; if (active == 1) alarm[5] = 1; gridl = 120; gridr = 220; gridu = 20; gridd = 120; instance_create(160, 40, obj_blackbox_o); instance_create(160, 80, obj_blackbox_o); instance_create(140, 60, obj_blackbox_o); instance_create(160, 60, obj_blackbox_o); instance_create(180, 60, obj_blackbox_o); instance_create(200, 60, obj_blackbox_o); } if (win > 0) { with (obj_blackbox_o) instance_destroy(); with (obj_targetguy) instance_destroy(); }
55
                }
56
            }
57
        }
58
    }
59
}
60
if (myinteract == 1 && win == 0)
61
{
62
    ammo = 0;
63
    buffer = 10;
64
    alarm[5] = 1;
gml_Object_obj_shootguy_Alarm_5.gml

if (ammo < idealammo) { if (ammo < (idealammo - 1)) buffer += 6; ammo += 1; snd_play(snd_noise); alarm[5] = 6; }
65
    global.interact = 1;
66
    myinteract = 2;
67
    global.facing = 2;
68
    active = 1;
69
}
70
snd = 0;
71
if (win == 1 && active == 1)
72
{
73
    wintimer += 1;
74
    if (wintimer == 50)
75
        snd_play(snd_dumbvictory);
76
    if (wintimer > 100)
77
    {
78
        if (room == room_fire_shootguy_1)
79
            global.flag[375 completed_shoot_puzzle2] = 1;
80
        if (room == room_fire_shootguy_2)
81
            global.flag[374 completed_shoot_puzzle1] = 1;
82
        if (room == room_fire_shootguy_3)
83
            global.flag[399 completed_shoot_puzzle3] = 1;
84
        if (room == room_fire_shootguy_4)
85
            global.flag[400 completed_shoot_puzzle4] = 1;
86
        if (room == room_fire_shootguy_5)
87
            global.flag[418 core_shooter_complete] = 1;
88
        global.interact = 0;
89
        wintimer = 0;
90
        win = 2;
91
        myinteract = 0;
92
        global.facing = 0;
93
        active = 0;
94
        scr_tempsave
scr_tempsave

filechoicebk2 = global.filechoice; global.filechoice = 9; script_execute(scr_saveprocess); global.filechoice = filechoicebk2;
();
95
    }
96
}