Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_toy_gun_circle_Step_0

(view raw script w/o annotations or w/e)
1
function shotFail()
2
{
3
    outline = 0;
4
    shrink = false;
5
    image_alpha = 0;
6
    alarm[0] = 1;
gml_Object_obj_toy_gun_circle_Alarm_0.gml

dd_type = "Gun Single"; event_user(0);
7
    no_loop = true;
8
}
9
10
var fight_number = global.fight_number;
11
var enemy_sparing, enemy_vulnerable, current_hp_enemy, attacking_damage_stat_critical, enemy_target_x, enemy_target_y;
12
if (fight_number == 1)
13
{
14
    enemy_sparing = global.enemy_sparing;
15
    enemy_vulnerable = global.enemy_vulnerable;
16
    current_hp_enemy = global.current_hp_enemy;
17
    attacking_damage_stat_critical = global.attacking_damage_stat_critical;
18
    enemy_target_x = global.enemy_target_x;
19
    enemy_target_y = global.enemy_target_y;
20
}
21
else if (fight_number == 2)
22
{
23
    enemy_sparing = global.enemy_sparing_2;
24
    enemy_vulnerable = global.enemy_vulnerable_2;
25
    current_hp_enemy = global.current_hp_enemy_2;
26
    attacking_damage_stat_critical = global.attacking_damage_stat_critical_2;
27
    enemy_target_x = global.enemy_target_x_2;
28
    enemy_target_y = global.enemy_target_y_2;
29
}
30
else if (fight_number == 3)
31
{
32
    enemy_sparing = global.enemy_sparing_3;
33
    enemy_vulnerable = global.enemy_vulnerable_3;
34
    current_hp_enemy = global.current_hp_enemy_3;
35
    attacking_damage_stat_critical = global.attacking_damage_stat_critical_3;
36
    enemy_target_x = global.enemy_target_x_3;
37
    enemy_target_y = global.enemy_target_y_3;
38
}
39
script_execute(scr_controls_battle_reticle);
40
if (outline <= 0 && no_loop == false)
41
    shotFail();
42
if (key_select)
43
{
44
    if (outline > small_circle)
45
    {
46
        audio_play_sound(snd_fail, 1, 0);
47
        shotFail();
48
    }
49
    else if ((enemy_sparing == true && enemy_vulnerable == true) || (enemy_vulnerable == true && current_hp_enemy <= attacking_damage_stat_critical) || outline <= (small_circle * 0.25))
50
    {
51
        shot_type = "strong";
52
        hit_object = 2913;
53
        if (global.battle_enemy_name == "micro froggit" && outline > (small_circle * 0.25))
54
        {
55
            shot_type = "weak";
56
            hit_object = 2911;
57
        }
58
    }
59
    else if (outline <= (small_circle * 0.6) && outline > (small_circle * 0.25))
60
    {
61
        shot_type = "medium";
62
        hit_object = 2912;
63
    }
64
    else if (outline < small_circle && outline > (small_circle * 0.6))
65
    {
66
        shot_type = "weak";
67
        hit_object = 2911;
68
    }
69
    if (shrink == true)
70
    {
71
        instance_create(enemy_target_x, enemy_target_y, hit_object);
72
        shrink = false;
73
        button_pressed = true;
74
    }
75
}
76
if (outline > 0 && shrink == true)
77
    outline -= shrink_speed;
78
if (button_pressed == true && shrink == false)
79
{
80
    color_alt_total += color_alt_speed;
81
    if (color_alt_total >= color_alt_max)
82
    {
83
        color_alt_total = 0;
84
        color_number += 1;
85
        if (color_number > 1)
86
            color_number = 0;
87
    }
88
    cursor_color = color[color_number];
89
    color_number_2 = color_number + 1;
90
    if (color_number_2 > 1)
91
        color_number_2 = 0;
92
    outline_color = color[color_number_2];
93
}