Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_heart_battle_menu_fight_Step_0

(view raw script w/o annotations or w/e)
1
var enemy_count = global.enemy_count
2
var enemy_dead = global.enemy_dead
3
var enemy_spared = global.enemy_spared
4
if (enemy_count >= 2)
5
{
6
    var enemy_dead_2 = global.enemy_dead_2
7
    var enemy_spared_2 = global.enemy_spared_2
8
}
9
if (enemy_count >= 3)
10
{
11
    var enemy_dead_3 = global.enemy_dead_3
12
    var enemy_spared_3 = global.enemy_spared_3
13
}
14
script_execute(gml_Script_scr_controls_battle_fight)
15
if key_select
16
{
17
    if (global.fight_number == 1)
18
    {
19
        global.last_action_selected = "Fight"
20
        global.last_action_selected_2 = "Nothing"
21
        global.last_action_selected_3 = "Nothing"
22
    }
23
    else if (global.fight_number == 2)
24
    {
25
        global.last_action_selected = "Nothing"
26
        global.last_action_selected_2 = "Fight"
27
        global.last_action_selected_3 = "Nothing"
28
    }
29
    else if (global.fight_number == 3)
30
    {
31
        global.last_action_selected = "Nothing"
32
        global.last_action_selected_2 = "Nothing"
33
        global.last_action_selected_3 = "Fight"
34
    }
35
    script_execute(gml_Script_scr_create_player_attack)
36
    audio_play_sound(snd_battle_item_weapon_select, 20, false)
37
    if instance_exists(obj_text_battle_move_selected_enemy_fight_parent)
38
    {
39
        with (obj_text_battle_move_selected_enemy_fight_parent)
40
            instance_destroy()
41
    }
42
    if instance_exists(obj_battle_hp_enemy_parent)
43
    {
44
        with (obj_battle_hp_enemy_parent)
45
            instance_destroy()
46
    }
47
    instance_destroy()
48
}
49
if (key_revert && key_select == 0)
50
{
51
    if instance_exists(obj_text_battle_move_selected_enemy_fight_parent)
52
    {
53
        with (obj_heart_battle_menu)
54
        {
55
            no_loop = false
56
            image_alpha = 1
57
        }
58
        with (obj_text_battle_move_selected_enemy_fight_parent)
59
            instance_destroy()
60
        with (obj_battle_hp_enemy_parent)
61
            instance_destroy()
62
        instance_destroy()
63
    }
64
}
65
if (key_select == 0 && key_revert == 0)
66
{
67
    if (key_down && key_up == 0)
68
    {
69
        if (global.fight_number >= 3)
70
            global.fight_number = 1
71
        else
72
            global.fight_number += 1
73
        check_sound = 0
74
        for (counter = 0; counter < 2; counter += 1)
75
        {
76
            if (global.fight_number == 1 && (!instance_exists(obj_text_battle_move_selected_enemy_fight)))
77
            {
78
                global.fight_number = 2
79
                check_sound += 1
80
            }
81
            if (global.fight_number == 2 && (!instance_exists(obj_text_battle_move_selected_enemy_fight_2)))
82
            {
83
                global.fight_number = 3
84
                check_sound += 1
85
            }
86
            if (global.fight_number == 3 && (!instance_exists(obj_text_battle_move_selected_enemy_fight_3)))
87
            {
88
                global.fight_number = 1
89
                check_sound += 1
90
            }
91
        }
92
        if (check_sound < 2)
93
            audio_play_sound(snd_mainmenu_select, 20, false)
94
    }
95
    if (key_up && key_down == 0)
96
    {
97
        if (global.fight_number <= 1)
98
            global.fight_number = 3
99
        else
100
            global.fight_number -= 1
101
        check_sound = 0
102
        for (counter = 0; counter < 2; counter += 1)
103
        {
104
            if (global.fight_number == 3 && (!instance_exists(obj_text_battle_move_selected_enemy_fight_3)))
105
            {
106
                global.fight_number = 2
107
                check_sound += 1
108
            }
109
            if (global.fight_number == 2 && (!instance_exists(obj_text_battle_move_selected_enemy_fight_2)))
110
            {
111
                global.fight_number = 1
112
                check_sound += 1
113
            }
114
            if (global.fight_number == 1 && (!instance_exists(obj_text_battle_move_selected_enemy_fight)))
115
            {
116
                global.fight_number = 3
117
                check_sound += 1
118
            }
119
        }
120
        if (check_sound < 2)
121
            audio_play_sound(snd_mainmenu_select, 20, false)
122
    }
123
}
124
x = obj_dialogue_box_battle.x + 44
125
if (global.fight_number == 1)
126
    y = obj_dialogue_box_battle.y + 36
127
else if (global.fight_number == 2)
128
    y = obj_dialogue_box_battle.y + 68
129
else if (global.fight_number == 3)
130
    y = obj_dialogue_box_battle.y + 100