Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attacking_code_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 < 0)
21
    global.current_hp_enemy = 0
22
if (global.current_hp_enemy == 0)
23
{
24
    var enemy_count = global.enemy_count
25
    global.enemy_dead = true
26
    if (enemy_count == 1)
27
    {
28
        with (obj_battle_generator)
29
            audio_extend = false
30
        audio_stop_all()
31
        instance_create(0, 0, obj_dialogue_battle_win_enemy)
32
        audio_play_sound(snd_monster_damage_death, 20, false)
33
    }
34
    else if (enemy_count == 2)
35
    {
36
        if (global.enemy_dead_2 == true || global.enemy_spared_2 == true)
37
        {
38
            with (obj_battle_generator)
39
                audio_extend = false
40
            audio_stop_all()
41
            instance_create(0, 0, obj_dialogue_battle_win_enemy)
42
            audio_play_sound(snd_monster_damage_death, 20, false)
43
        }
44
        else
45
        {
46
            global.enemy_sparing = false
47
            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 1")
48
            global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking)
49
            global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking)
50
            if (global.important_cutscene == false && global.can_attack == true)
51
                global.enemy_attacking = true
52
            if (global.can_attack == false)
53
            {
54
                with (obj_dialogue_box_battle)
55
                    no_loop_can_attack = false
56
            }
57
        }
58
    }
59
    else if (enemy_count == 3)
60
    {
61
        if ((global.enemy_dead_2 == true || global.enemy_spared_2 == true) && (global.enemy_dead_3 == true || global.enemy_spared_3 == true))
62
        {
63
            with (obj_battle_generator)
64
                audio_extend = false
65
            audio_stop_all()
66
            instance_create(0, 0, obj_dialogue_battle_win_enemy)
67
            audio_play_sound(snd_monster_damage_death, 20, false)
68
        }
69
        else
70
        {
71
            global.enemy_sparing = false
72
            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 1")
73
            global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking)
74
            global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking)
75
            if (global.important_cutscene == false && global.can_attack == true)
76
                global.enemy_attacking = true
77
            if (global.can_attack == false)
78
            {
79
                with (obj_dialogue_box_battle)
80
                    no_loop_can_attack = false
81
            }
82
        }
83
    }
84
}
85
else
86
{
87
    if (!attack_missed)
88
        global.enemy_sparing = false
89
    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 1")
90
    global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking)
91
    global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking)
92
    if (global.important_cutscene == false && global.can_attack == true)
93
        global.enemy_attacking = true
94
    if (global.can_attack == false)
95
    {
96
        with (obj_dialogue_box_battle)
97
            no_loop_can_attack = false
98
    }
99
}
100
instance_destroy()