Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_toy_gun_circle_multi_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
if (execute_create == true)
4
{
5
    var fight_number = global.fight_number
6
    if (fight_number == 1)
7
    {
8
        var enemy_sparing = global.enemy_sparing
9
        var enemy_vulnerable = global.enemy_vulnerable
10
        var current_hp_enemy = global.current_hp_enemy
11
        var attacking_damage_stat_critical = global.attacking_damage_stat_critical
12
        var enemy_target_x = global.enemy_target_x
13
        var enemy_target_y = global.enemy_target_y
14
    }
15
    else if (fight_number == 2)
16
    {
17
        enemy_sparing = global.enemy_sparing_2
18
        enemy_vulnerable = global.enemy_vulnerable_2
19
        current_hp_enemy = global.current_hp_enemy_2
20
        attacking_damage_stat_critical = global.attacking_damage_stat_critical_2
21
        enemy_target_x = global.enemy_target_x_2
22
        enemy_target_y = global.enemy_target_y_2
23
    }
24
    else if (fight_number == 3)
25
    {
26
        enemy_sparing = global.enemy_sparing_3
27
        enemy_vulnerable = global.enemy_vulnerable_3
28
        current_hp_enemy = global.current_hp_enemy_3
29
        attacking_damage_stat_critical = global.attacking_damage_stat_critical_3
30
        enemy_target_x = global.enemy_target_x_3
31
        enemy_target_y = global.enemy_target_y_3
32
    }
33
    script_execute(gml_Script_scr_controls_battle_reticle_multi)
34
    for (i = 0; i <= final_circle; i++)
35
    {
36
        if (outline[i] <= 0 && shrink[i] == true)
37
        {
38
            outline[i] = 0
39
            shrink[i] = false
40
            imagea[i] = 0
41
            audio_play_sound(snd_fail, 1, 0)
42
            shrink_speed = 0
43
            circle_current = final_circle + 1
44
            var missed_shot = true
45
            alarm[0] = 10
alarm[0]

dd_type = "Gun Multi" event_user(0)
46
            no_loop = true
47
        }
48
    }
49
    if (key_select && circle_current <= final_circle)
50
    {
51
        missed_shot = false
52
        var enemy_target_x_offset = 0
53
        var enemy_target_y_offset = 0
54
        switch global.player_weapon_modifier
55
        {
56
            case "Flint":
57
            case "Ice Pellets":
58
                enemy_target_x_offset = irandom_range(-40, 40)
59
                enemy_target_y_offset = irandom_range(-40, 40)
60
                break
61
            default:
62
                enemy_target_x_offset = 0
63
                enemy_target_y_offset = 0
64
                break
65
        }
66
67
        if (outline[circle_current] >= small_circle)
68
        {
69
            outline[circle_current] = 0
70
            shrink[circle_current] = false
71
            imagea[circle_current] = 0
72
            shrink_speed = 0
73
            circle_current = final_circle + 1
74
            missed_shot = true
75
            audio_play_sound(snd_fail, 1, 0)
76
            alarm[0] = 10
alarm[0]

dd_type = "Gun Multi" event_user(0)
77
            no_loop = true
78
        }
79
        else if ((enemy_sparing == true && enemy_vulnerable == true) || (enemy_vulnerable == true && current_hp_enemy <= attacking_damage_stat_critical) || outline[circle_current] <= (small_circle * 0.25))
80
        {
81
            hit[circle_current] = 2
82
            color_hit_number[circle_current] = 1
83
            shot_total += 3
84
            if (circle_current == final_circle)
85
                hit_object = obj_shot_strong
86
            else
87
                hit_object = obj_shot_strong_fake
88
        }
89
        else if (outline[circle_current] <= (small_circle * 0.6) && outline[circle_current] > (small_circle * 0.25))
90
        {
91
            hit[circle_current] = 1
92
            color_hit_number[circle_current] = 0
93
            shot_total += 2
94
            if (circle_current == final_circle)
95
                hit_object = obj_shot_medium
96
            else
97
                hit_object = obj_shot_medium_fake
98
        }
99
        else if (outline[circle_current] < small_circle && outline[circle_current] > (small_circle * 0.6))
100
        {
101
            hit[circle_current] = 1
102
            color_hit_number[circle_current] = 0
103
            shot_total += 1
104
            if (circle_current == final_circle)
105
                hit_object = obj_shot_weak
106
            else
107
                hit_object = obj_shot_weak_fake
108
        }
109
        if (missed_shot == false)
110
        {
111
            instance_create((enemy_target_x + enemy_target_x_offset), (enemy_target_y + enemy_target_y_offset), hit_object)
112
            shrink[circle_current] = false
113
            button_pressed = true
114
        }
115
        circle_current += 1
116
    }
117
    for (i = 0; i <= final_circle; i++)
118
    {
119
        if (outline[i] > 0 && shrink[i] == true)
120
        {
121
            outline[i] -= shrink_speed
122
            if (outline[i] < 0)
123
                outline[i] = 0
124
        }
125
        if (shrink[i] == false && imagea[i] > 0)
126
        {
127
            if (hit[i] == 2)
128
            {
129
                color_alt_total[i] += color_alt_speed
130
                if (color_alt_total[i] >= color_alt_max)
131
                {
132
                    color_alt_total[i] = 0
133
                    color_hit_number[i] += 1
134
                    if (color_hit_number[i] > 2)
135
                        color_hit_number[i] = 0
136
                }
137
            }
138
            if (hit[i] != 0)
139
            {
140
                cursor_color[i] = color_hit[color_hit_number[i]]
141
                outline_color[i] = color_hit[color_hit_number[i]]
142
            }
143
            thickness[i] += thick_increase
144
            imagea[i] -= imagea_dec
145
            if (imagea[i] < 0)
146
                imagea[i] = 0
147
        }
148
    }
149
    if (no_loop == false)
150
    {
151
        if (outline[final_circle] == 0 && hit[final_circle] == false)
152
        {
153
            if (!instance_exists(obj_strike_fake))
154
            {
155
                if (button_pressed == true)
156
                    alarm[0] = 3
alarm[0]

dd_type = "Gun Multi" event_user(0)
157
                else
158
                    alarm[0] = 1
alarm[0]

dd_type = "Gun Multi" event_user(0)
159
                no_loop = true
160
            }
161
        }
162
    }
163
}