Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_fade_out_screen_Alarm_0

(view raw script w/o annotations or w/e)
1
if instance_exists(obj_dialogue_battle_flee)
2
{
3
    switch global.enemy_count
4
    {
5
        case 1:
6
            if (global.enemy_dead == false)
7
            {
8
                global.enemy_exp = 0
9
                global.enemy_gold = 0
10
            }
11
            global.player_exp += global.enemy_exp
12
            global.player_gold += global.enemy_gold
13
            break
14
        case 2:
15
            if (global.enemy_dead == false)
16
            {
17
                global.enemy_gold = 0
18
                global.enemy_exp = 0
19
            }
20
            if (global.enemy_dead_2 == false)
21
            {
22
                global.enemy_gold_2 = 0
23
                global.enemy_exp_2 = 0
24
            }
25
            global.player_exp += (global.enemy_exp + global.enemy_exp_2)
26
            global.player_gold += (global.enemy_gold + global.enemy_gold_2)
27
            break
28
        case 3:
29
            if (global.enemy_dead == false)
30
            {
31
                global.enemy_gold = 0
32
                global.enemy_exp = 0
33
            }
34
            if (global.enemy_dead_2 == false)
35
            {
36
                global.enemy_gold_2 = 0
37
                global.enemy_exp_2 = 0
38
            }
39
            if (global.enemy_dead_3 == false)
40
            {
41
                global.enemy_gold_3 = 0
42
                global.enemy_exp_3 = 0
43
            }
44
            global.player_exp += (global.enemy_exp + global.enemy_exp_2 + global.enemy_exp_3)
45
            global.player_gold += (global.enemy_gold + global.enemy_gold_2 + global.enemy_gold_3)
46
            break
47
    }
48
49
    if (global.player_exp >= global.player_exp_next[global.player_level])
50
    {
51
        var i = global.player_level
52
        while (i <= 20)
53
        {
54
            if (global.player_exp >= global.player_exp_next[i])
55
            {
56
                global.player_level = i + 1
57
                global.max_hp_self = global.player_hp_next[i]
58
                global.player_attack = global.player_attack_next[i]
59
                global.player_defense = global.player_defense_next[i]
60
                i += 1
61
                continue
62
            }
63
            else
64
                break
65
        }
66
    }
67
}
68
var game_mode = global.game_mode
69
if (game_mode == "customs")
70
{
71
    var battle_enemy_name = global.battle_enemy_name
72
    if (battle_enemy_name == "craniex")
73
    {
74
        if (global.enemy_spared == true)
75
            global.enemy_craniex_status = "spared"
76
        else if (global.enemy_dead == true)
77
            global.enemy_craniex_status = "dead"
78
    }
79
    if (battle_enemy_name == "ms mettaton")
80
    {
81
        if (global.enemy_spared == true)
82
            global.enemy_ms_mettaton_status = "spared"
83
        else if (global.enemy_dead == true)
84
            global.enemy_ms_mettaton_status = "dead"
85
    }
86
    room_goto(rm_black_screen_cutscene)
87
}
88
else if (game_mode == "yellow")
89
{
90
    obj_pl.image_alpha = 1
91
    if (global.party_member != noone && instance_exists(global.party_member))
92
        global.party_member.image_alpha = 1
93
    scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() //gml_Script_scr_cutscene_end { global.cutscene = false obj_pl.alarm[0] = 1 }
()
94
    room_goto(asset_get_index(global.current_room_overworld))
95
    instance_create(0, 0, obj_overworld_fade_in_screen)
96
    global.sound_carry_overworld = false
97
}