Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attacking_code_2_Alarm_1

(view raw script w/o annotations or w/e)
1
var attack_missed = false
2
if instance_exists(obj_text_damage_count)
3
{
4
    with (obj_text_damage_count)
5
        instance_destroy()
6
}
7
if instance_exists(obj_text_miss)
8
{
9
    attack_missed = true
10
    with (obj_text_miss)
11
        instance_destroy()
12
}
13
with (obj_target_bar_battle)
14
    instance_destroy()
15
if instance_exists(obj_battle_hp_enemy_attacking_parent)
16
{
17
    with (obj_battle_hp_enemy_attacking_parent)
18
        instance_destroy()
19
}
20
if (global.current_hp_enemy_2 < 0)
21
    global.current_hp_enemy_2 = 0
22
if (global.current_hp_enemy_2 == 0)
23
{
24
    var enemy_count = global.enemy_count
25
    global.enemy_dead_2 = true
26
    if (enemy_count == 2)
27
    {
28
        if (global.enemy_dead == true || global.enemy_spared == true)
29
        {
30
            with (obj_battle_generator)
31
                audio_extend = false
32
            audio_stop_all()
33
            instance_create(0, 0, obj_dialogue_battle_win_enemy)
34
            audio_play_sound(snd_monster_damage_death, 20, false)
35
        }
36
        else
37
        {
38
            global.enemy_sparing_2 = false
39
            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 }
("Fight 2")
40
            global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking)
41
            global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking)
42
            if (global.important_cutscene == false && global.can_attack == true)
43
                global.enemy_attacking = true
44
            if (global.can_attack == false)
45
            {
46
                with (obj_dialogue_box_battle)
47
                    no_loop_can_attack = false
48
            }
49
        }
50
    }
51
    else if (enemy_count == 3)
52
    {
53
        if ((global.enemy_dead == true || global.enemy_spared == true) && (global.enemy_dead_3 == true || global.enemy_spared_3 == true))
54
        {
55
            with (obj_battle_generator)
56
                audio_extend = false
57
            audio_stop_all()
58
            instance_create(0, 0, obj_dialogue_battle_win_enemy)
59
            audio_play_sound(snd_monster_damage_death, 20, false)
60
        }
61
        else
62
        {
63
            global.enemy_sparing_2 = false
64
            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 }
("Fight 2")
65
            global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking)
66
            global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking)
67
            if (global.important_cutscene == false && global.can_attack == true)
68
                global.enemy_attacking = true
69
            if (global.can_attack == false)
70
            {
71
                with (obj_dialogue_box_battle)
72
                    no_loop_can_attack = false
73
            }
74
        }
75
    }
76
}
77
else
78
{
79
    if (!attack_missed)
80
        global.enemy_sparing_2 = false
81
    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 }
("Fight 2")
82
    global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking)
83
    global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking)
84
    if (global.important_cutscene == false && global.can_attack == true)
85
        global.enemy_attacking = true
86
    if (global.can_attack == false)
87
    {
88
        with (obj_dialogue_box_battle)
89
            no_loop_can_attack = false
90
    }
91
}
92
instance_destroy()