Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_heart_battle_menu_mercy_Step_0

(view raw script w/o annotations or w/e)
1
script_execute(gml_Script_scr_controls_battle_mercy)
2
if key_select
3
{
4
    if (global.mercy_number == 1)
5
    {
6
        if (global.enemy_count == 1 && global.enemy_sparing == true && global.enemy_dead == false && global.enemy_spared == false)
7
        {
8
            with (obj_battle_generator)
9
                audio_extend = false
10
            audio_stop_all()
11
            if (global.battling_boss == true)
12
            {
13
                instance_create(0, 0, obj_dialogue_battle_win_pacifist)
14
                instance_create(0, 0, obj_battle_justice_effect)
15
            }
16
            else
17
                instance_create(0, 0, obj_dialogue_battle_win_enemy)
18
            global.spare_selected_count += 1
19
            global.last_action_selected = "Spare"
20
            global.last_action_selected_2 = "Spare"
21
            global.last_action_selected_3 = "Spare"
22
            global.enemy_spared = true
23
            moveable = false
24
            audio_play_sound(snd_monster_damage_death, 20, false)
25
            with (obj_text_battle_move_selected_mercy_parent)
26
                instance_destroy()
27
            instance_destroy()
28
        }
29
        else if (global.enemy_count == 2)
30
        {
31
            if (global.enemy_sparing == true && global.enemy_dead == false && global.enemy_spared == false)
32
            {
33
                global.enemy_spared = true
34
                audio_play_sound(snd_monster_damage_death, 20, false)
35
            }
36
            if (global.enemy_sparing_2 == true && global.enemy_dead_2 == false && global.enemy_spared_2 == false)
37
            {
38
                global.enemy_spared_2 = true
39
                if (!audio_is_playing(snd_monster_damage_death))
40
                    audio_play_sound(snd_monster_damage_death, 20, false)
41
            }
42
            if ((global.enemy_dead == true || global.enemy_spared == true) && (global.enemy_dead_2 == true || global.enemy_spared_2 == true))
43
            {
44
                with (obj_battle_generator)
45
                    audio_extend = false
46
                audio_stop_all()
47
                instance_create(0, 0, obj_dialogue_battle_win_enemy)
48
                global.spare_selected_count += 1
49
                global.last_action_selected = "Spare"
50
                global.last_action_selected_2 = "Spare"
51
                global.last_action_selected_3 = "Spare"
52
                moveable = false
53
                audio_play_sound(snd_monster_damage_death, 20, false)
54
                with (obj_text_battle_move_selected_mercy_parent)
55
                    instance_destroy()
56
                instance_destroy()
57
            }
58
            else
59
                execute_sparing_false = true
60
        }
61
        else if (global.enemy_count == 3)
62
        {
63
            if (global.enemy_sparing == true && global.enemy_dead == false && global.enemy_spared == false)
64
            {
65
                global.enemy_spared = true
66
                audio_play_sound(snd_monster_damage_death, 20, false)
67
            }
68
            if (global.enemy_sparing_2 == true && global.enemy_dead_2 == false && global.enemy_spared_2 == false)
69
            {
70
                global.enemy_spared_2 = true
71
                if (!audio_is_playing(snd_monster_damage_death))
72
                    audio_play_sound(snd_monster_damage_death, 20, false)
73
            }
74
            if (global.enemy_sparing_3 == true && global.enemy_dead_3 == false && global.enemy_spared_3 == false)
75
            {
76
                global.enemy_spared_3 = true
77
                if (!audio_is_playing(snd_monster_damage_death))
78
                    audio_play_sound(snd_monster_damage_death, 20, false)
79
            }
80
            if ((global.enemy_dead == true || global.enemy_spared == true) && (global.enemy_dead_2 == true || global.enemy_spared_2 == true) && (global.enemy_dead_3 == true || global.enemy_spared_3 == true))
81
            {
82
                with (obj_battle_generator)
83
                    audio_extend = false
84
                audio_stop_all()
85
                instance_create(0, 0, obj_dialogue_battle_win_enemy)
86
                global.spare_selected_count += 1
87
                global.last_action_selected = "Spare"
88
                global.last_action_selected_2 = "Spare"
89
                global.last_action_selected_3 = "Spare"
90
                moveable = false
91
                audio_play_sound(snd_monster_damage_death, 20, false)
92
                with (obj_text_battle_move_selected_mercy_parent)
93
                    instance_destroy()
94
                instance_destroy()
95
            }
96
            else
97
                execute_sparing_false = true
98
        }
99
        if (global.enemy_sparing == false || execute_sparing_false == true)
100
        {
101
            global.spare_selected_count += 1
102
            global.last_action_selected = "Spare"
103
            global.last_action_selected_2 = "Spare"
104
            global.last_action_selected_3 = "Spare"
105
            global.no_hit_count += 1
106
            if (global.enemy_count >= 2)
107
                global.no_hit_count_2 += 1
108
            if (global.enemy_count >= 3)
109
                global.no_hit_count_3 += 1
110
            scr_determine_special_effect_enemy
scr_determine_special_effect_enemy

function scr_determine_special_effect_enemy(argument0) //gml_Script_scr_determine_special_effect_enemy { var battle_enemy_name = global.battle_enemy_name if (global.game_mode == "customs") { } else if (global.game_mode == "yellow") { switch battle_enemy_name { case "martlet pacifist": scr_enemy_mode_shift_martlet_pacifist(argument0) break case "martlet genocide": scr_enemy_mode_shift_martlet_genocide(argument0) break } } global.special_effect_end_value = argument0 }
("Spare")
111
            global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking)
112
            global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking)
113
            if (global.important_cutscene == false && global.can_attack == true)
114
                global.enemy_attacking = true
115
            if (global.can_attack == false)
116
            {
117
                with (obj_dialogue_box_battle)
118
                    no_loop_can_attack = false
119
            }
120
            execute_sparing_false = false
121
            audio_play_sound(snd_battle_item_weapon_select, 20, false)
122
            with (obj_text_battle_move_selected_mercy_parent)
123
                instance_destroy()
124
            instance_destroy()
125
        }
126
    }
127
    else if (global.mercy_number == 2)
128
    {
129
        var random_number = irandom_range(0, 1)
130
        if (global.player_armor_modifier == "Patch")
131
            random_number = 1
132
        if (random_number == 0)
133
        {
134
            global.no_hit_count += 1
135
            if (global.enemy_count >= 2)
136
                global.no_hit_count_2 += 1
137
            if (global.enemy_count >= 3)
138
                global.no_hit_count_3 += 1
139
            scr_determine_special_effect_enemy
scr_determine_special_effect_enemy

function scr_determine_special_effect_enemy(argument0) //gml_Script_scr_determine_special_effect_enemy { var battle_enemy_name = global.battle_enemy_name if (global.game_mode == "customs") { } else if (global.game_mode == "yellow") { switch battle_enemy_name { case "martlet pacifist": scr_enemy_mode_shift_martlet_pacifist(argument0) break case "martlet genocide": scr_enemy_mode_shift_martlet_genocide(argument0) break } } global.special_effect_end_value = argument0 }
("Flee")
140
            global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking)
141
            global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking)
142
            if (global.important_cutscene == false && global.can_attack == true)
143
                global.enemy_attacking = true
144
            if (global.can_attack == false)
145
            {
146
                with (obj_dialogue_box_battle)
147
                    no_loop_can_attack = false
148
            }
149
            audio_play_sound(snd_battle_item_weapon_select, 20, false)
150
            with (obj_text_battle_move_selected_mercy_parent)
151
                instance_destroy()
152
            instance_destroy()
153
        }
154
        else if (random_number == 1)
155
        {
156
            instance_create(0, 0, obj_dialogue_battle_flee)
157
            instance_create(x, y, obj_heart_battle_menu_flee)
158
            moveable = false
159
            audio_play_sound(snd_flee, 20, false)
160
            with (obj_text_battle_move_selected_mercy_parent)
161
                instance_destroy()
162
            instance_destroy()
163
        }
164
    }
165
}
166
if (key_revert && key_select == 0)
167
{
168
    if instance_exists(obj_text_battle_move_selected_spare)
169
    {
170
        with (obj_heart_battle_menu)
171
        {
172
            no_loop = false
173
            image_alpha = 1
174
        }
175
        with (obj_text_battle_move_selected_mercy_parent)
176
            instance_destroy()
177
        instance_destroy()
178
    }
179
}
180
if (key_select == 0 && key_revert == 0 && instance_exists(obj_text_battle_move_selected_flee))
181
{
182
    if (key_down && key_up == 0)
183
    {
184
        if (global.mercy_number >= 2)
185
            global.mercy_number = 1
186
        else
187
            global.mercy_number += 1
188
        audio_play_sound(snd_mainmenu_select, 20, false)
189
    }
190
    else if (key_up && key_down == 0)
191
    {
192
        if (global.mercy_number <= 1)
193
            global.mercy_number = 2
194
        else
195
            global.mercy_number -= 1
196
        audio_play_sound(snd_mainmenu_select, 20, false)
197
    }
198
}
199
x = obj_dialogue_box_battle.x + 44
200
if (global.mercy_number == 1)
201
    y = obj_dialogue_box_battle.y + 36
202
else if (global.mercy_number == 2)
203
    y = obj_dialogue_box_battle.y + 68