Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_asgore_checker_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
if (stage == 1)
4
{
5
    if (soul_shake == true)
6
    {
7
        obj_heart_battle_fighting_red.x = obj_heart_battle_fighting_red.xstart
8
        obj_heart_battle_fighting_red.y = obj_heart_battle_fighting_red.ystart
9
        obj_heart_battle_fighting_red.x += random_range(-2, 2)
10
        obj_heart_battle_fighting_red.y += random_range(-2, 2)
11
    }
12
    if (soul_can_hurt == true)
13
    {
14
        if (global.hit_self == true)
15
        {
16
            var weaken_sound = audio_play_sound(snd_soul_gameover_hit, 1, 0)
17
            audio_sound_pitch(weaken_sound, 0.75)
18
            soul_shake = true
19
            obj_heart_battle_fighting_parent.moveable = false
20
            obj_heart_battle_fighting_parent.xstart = obj_heart_battle_fighting_parent.x
21
            obj_heart_battle_fighting_parent.ystart = obj_heart_battle_fighting_parent.y
22
            instance_create_depth(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, (obj_heart_battle_fighting_parent.depth + 1), obj_ceroba_transform_soul_particles)
23
            audio_play_sound(snd_attackhitcrit, 1, 0)
24
            obj_heart_battle_fighting_parent.walk_speed -= 1
25
            audio_sound_gain(global.battle_music, (audio_sound_get_gain(global.battle_music) * 0.8), 300)
26
            if (obj_heart_battle_fighting_parent.walk_speed <= 0)
27
            {
28
                scr_audio_fade_out
scr_audio_fade_out

function scr_audio_fade_out(argument0, argument1) //gml_Script_scr_audio_fade_out { var snd = argument0 var fade_len = argument1 if (!audio_is_playing(snd)) return false; audio_sound_gain(snd, 0, fade_len) if instance_exists(obj_audio_fade_helper) { with (obj_audio_fade_helper) { if (audio_to_fade == snd) return false; } } with (instance_create(0, 0, obj_audio_fade_helper)) audio_to_fade = snd }
(global.battle_music, 1000)
29
                if (!alarm[3])
30
                    alarm[3] = 30
alarm[3]

if live_call() return global.live_result; soul_shake = false
31
                fade_out = true
32
                alarm[0] = -1
alarm[0]

if live_call() return global.live_result; var random_number = irandom_range(0, (ds_list_size(spawner_list) - 1)) var attack_instance = ds_list_find_value(spawner_list, random_number) ds_list_delete(spawner_list, random_number) instance_create(0, 0, attack_instance) if ds_list_empty(spawner_list) ds_list_copy(spawner_list, spawner_list_original)
33
                with (obj_battle_enemy_attack_parent)
34
                    instance_destroy()
35
                instance_destroy(obj_battle_enemy_attack_spawner_asgore_circle)
36
                instance_destroy(obj_battle_enemy_attack_spawner_asgore_circle_full)
37
                instance_destroy(obj_battle_enemy_attack_spawner_asgore_hands)
38
                instance_destroy(obj_battle_enemy_attack_spawner_asgore_sinusoid)
39
                instance_destroy(obj_battle_enemy_attack_spawner_asgore_warning)
40
                instance_destroy(obj_battle_enemy_attack_asgore_warning)
41
                instance_destroy(obj_battle_enemy_attack_spawner_asgore_fire_circle)
42
                with (obj_battle_enemy_attack_asgore_hand_horizontal)
43
                    instance_destroy()
44
                with (obj_battle_enemy_attack_asgore_hand_vertical)
45
                    instance_destroy()
46
            }
47
            else
48
                alarm[2] = 10
alarm[2]

if live_call() return global.live_result; soul_shake = false obj_heart_battle_fighting_parent.moveable = true
49
            global.hit_self = false
50
        }
51
    }
52
    else
53
        global.hit_self = false
54
    if (fade_out == true)
55
    {
56
        alarm[0] = -1
alarm[0]

if live_call() return global.live_result; var random_number = irandom_range(0, (ds_list_size(spawner_list) - 1)) var attack_instance = ds_list_find_value(spawner_list, random_number) ds_list_delete(spawner_list, random_number) instance_create(0, 0, attack_instance) if ds_list_empty(spawner_list) ds_list_copy(spawner_list, spawner_list_original)
57
        if (draw_alpha < 1)
58
            draw_alpha += 0.05
59
        else if (!alarm[4])
60
            alarm[4] = 45
alarm[4]

if live_call() return global.live_result; stage = 4 obj_heart_battle_fighting_parent.xstart = obj_heart_battle_fighting_parent.x obj_heart_battle_fighting_parent.ystart = obj_heart_battle_fighting_parent.y
61
        obj_heart_battle_fighting_parent.x = lerp(obj_heart_battle_fighting_parent.x, 320, 0.15)
62
        obj_heart_battle_fighting_parent.y = lerp(obj_heart_battle_fighting_parent.y, 240, 0.15)
63
    }
64
}
65
else
66
{
67
    var heart = obj_heart_battle_fighting_parent
68
    switch scene
69
    {
70
        case -3:
71
            obj_heart_battle_fighting_parent.x = obj_heart_battle_fighting_parent.xstart
72
            obj_heart_battle_fighting_parent.y = obj_heart_battle_fighting_parent.ystart
73
            obj_heart_battle_fighting_parent.x += random_range(0.3, -0.3)
74
            obj_heart_battle_fighting_parent.y += random_range(0.3, -0.3)
75
            cutscene_wait(3)
76
            break
77
        case -2:
78
            instance_create_depth(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, (obj_heart_battle_fighting_parent.depth + 1), obj_ceroba_transform_soul_particles)
79
            audio_play_sound(snd_attackhitcrit, 1, 0)
80
            obj_heart_battle_fighting_parent.x = obj_heart_battle_fighting_parent.xstart
81
            obj_heart_battle_fighting_parent.y = obj_heart_battle_fighting_parent.ystart
82
            cutscene_advance()
83
            break
84
        case -1:
85
            cutscene_wait(2)
86
            break
87
        case 0:
88
            instance_create_depth((heart.x - 1), (heart.y + 90), (heart.depth + 1), obj_battle_enemy_attack_asgore_soul_capsule)
89
            obj_battle_enemy_attack_asgore_soul_capsule.image_index = obj_battle_enemy_attack_asgore_soul_capsule.image_number - 1
90
            audio_play_sound(snd_undertale_appear, 1, 0)
91
            cutscene_advance()
92
            break
93
        case 1:
94
            obj_battle_enemy_attack_asgore_soul_capsule.image_alpha += 0.05
95
            if (obj_battle_enemy_attack_asgore_soul_capsule.image_alpha >= 1)
96
            {
97
                obj_battle_enemy_attack_asgore_soul_capsule.image_alpha = 1
98
                cutscene_wait(2)
99
            }
100
            break
101
        case 2:
102
            audio_play_sound(snd_undertale_swoosh, 1, 0)
103
            obj_battle_enemy_attack_asgore_soul_capsule.vspeed = -4
104
            cutscene_advance()
105
            break
106
        case 3:
107
            if (obj_battle_enemy_attack_asgore_soul_capsule.y <= (heart.y + 30))
108
            {
109
                obj_battle_enemy_attack_asgore_soul_capsule.y = heart.y + 30
110
                obj_battle_enemy_attack_asgore_soul_capsule.vspeed = 0
111
                audio_play_sound(snd_undertale_impact, 1, 0)
112
                scr_screenshake_battle_custom
scr_screenshake_battle_custom

function scr_screenshake_battle_custom() //gml_Script_scr_screenshake_battle_custom { instance_destroy(obj_screenshake_battle) var screenshake = instance_create(0, 0, obj_screenshake_battle) screenshake.battle_screenshake_duration = argument[0] screenshake.battle_screenshake_intensity = argument[1] screenshake.battle_screenshake_dec = screenshake.battle_screenshake_intensity / screenshake.battle_screenshake_duration }
(6, 2)
113
                cutscene_advance()
114
            }
115
            break
116
        case 4:
117
            cutscene_wait(1.5)
118
            break
119
        case 5:
120
            obj_battle_enemy_attack_asgore_soul_capsule.image_speed = -1.5
121
            if (obj_battle_enemy_attack_asgore_soul_capsule.image_index <= 4)
122
            {
123
                audio_play_sound(snd_undertale_flash, 1, 0)
124
                obj_battle_enemy_attack_asgore_soul_capsule.flash_alpha = 1
125
                obj_battle_enemy_attack_asgore_soul_capsule.sprite_index = spr_container_open
126
                obj_battle_enemy_attack_asgore_soul_capsule.image_speed = 0
127
                obj_battle_enemy_attack_asgore_soul_capsule.image_index = 0
128
                obj_battle_enemy_attack_asgore_soul_capsule.soul_color = make_color_rgb(255, 255, 0)
129
                var new_soul = instance_create_depth(obj_battle_enemy_attack_asgore_soul_capsule.x, obj_battle_enemy_attack_asgore_soul_capsule.y, -1000, obj_barrier_soul_battle)
130
                new_soul.spawner = 2884
131
                new_soul.image_alpha = 1
132
                new_soul.image_xscale = 2
133
                new_soul.image_yscale = 2
134
                obj_heart_battle_fighting_parent.image_alpha = 0
135
                cutscene_advance()
136
            }
137
            break
138
        case 6:
139
            cutscene_wait(2.5)
140
            break
141
        case 7:
142
            soul_color[0] = make_color_rgb(0, 128, 0)
143
            soul_color[1] = make_color_rgb(255, 160, 64)
144
            soul_color[2] = make_color_rgb(128, 0, 128)
145
            soul_color[3] = make_color_rgb(0, 0, 255)
146
            soul_color[4] = make_color_rgb(0, 255, 255)
147
            for (var i = 0; i < 5; i++)
148
            {
149
                var new_capsule = instance_create_depth((192 + 64 * i), 384, -1010, obj_battle_enemy_attack_asgore_soul_capsule)
150
                new_capsule.sprite_index = spr_container_open
151
                new_capsule.image_speed = 0
152
                new_capsule.image_index = 0
153
                new_capsule.image_alpha = 0
154
                new_capsule.soul_color = other.soul_color[i]
155
                new_soul = instance_create_depth(new_capsule.x, new_capsule.y, -1020, obj_barrier_soul_battle)
156
                new_soul.spawner = new_capsule
157
                new_soul.image_alpha = 0
158
                new_soul.image_xscale = 2
159
                new_soul.image_yscale = 2
160
                new_soul.image_index = obj_barrier_soul_battle.image_index
161
            }
162
            audio_play_sound(snd_undertale_appear, 1, 0)
163
            cutscene_advance()
164
            break
165
        case 8:
166
            var yellow_col = make_color_rgb(255, 255, 0)
167
            with (obj_battle_enemy_attack_asgore_soul_capsule)
168
            {
169
                if (image_alpha < 1)
170
                    image_alpha += 0.05
171
                else if (soul_color != yellow_col)
172
                {
173
                    with (obj_barrier_soul_battle)
174
                        image_alpha = 1
175
                    with (obj_battle_enemy_attack_asgore_soul_capsule)
176
                        image_alpha = 1
177
                    other.scene = 9
178
                }
179
            }
180
            with (obj_barrier_soul_battle)
181
            {
182
                if (image_alpha < 1)
183
                    image_alpha += 0.05
184
            }
185
            break
186
        case 9:
187
            cutscene_wait(3)
188
            break
189
        case 10:
190
            if (!instance_exists(obj_dialogue_battle_asgore))
191
                msg = instance_create(x, y, obj_dialogue_battle_asgore)
192
            else if (!global.dialogue_open)
193
                cutscene_advance()
194
            with (msg)
195
            {
196
                sndfnt = 267
197
                message[0] = "       Rest well, young one."
198
                message[1] = "           I am sorry."
199
                skippable = false
200
                message_timer = 50
201
            }
202
            break
203
        case 11:
204
            cutscene_wait(3)
205
            break
206
        case 12:
207
            cymbal_sound = audio_play_sound(mus_cymbal, 1, 0)
208
            cutscene_advance()
209
            break
210
        case 13:
211
            fade_out_alpha = audio_sound_get_track_position(cymbal_sound) / audio_sound_length(cymbal_sound)
212
            if (fade_out_alpha >= 0.99)
213
            {
214
                with (obj_battle_enemy_attack_asgore_soul_capsule)
215
                    instance_destroy()
216
                with (obj_barrier_soul_battle)
217
                    instance_destroy()
218
                fade_out_alpha = 1
219
                scene++
220
            }
221
            break
222
        case 14:
223
            cutscene_wait(2)
224
            break
225
        case 15:
226
            fade_out_alpha -= 0.03
227
            if (fade_out_alpha <= 0)
228
                cutscene_wait(1.5)
229
            break
230
        case 16:
231
            room = rm_credits
232
            break
233
    }
234
235
}