Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_dialogue_battle_win_enemy_Create_0

(view raw script w/o annotations or w/e)
1
switch global.enemy_count
2
{
3
    case 1:
4
        if (global.enemy_dead == false)
5
            global.enemy_exp = 0
6
        global.player_exp += global.enemy_exp
7
        global.player_gold += global.enemy_gold
8
        message[0] = "* YOU WON!#* You earned " + string(global.enemy_exp) + " XP and " + string(global.enemy_gold) + " gold."
9
        break
10
    case 2:
11
        if (global.enemy_dead == false)
12
            global.enemy_exp = 0
13
        if (global.enemy_dead_2 == false)
14
            global.enemy_exp_2 = 0
15
        global.player_exp += (global.enemy_exp + global.enemy_exp_2)
16
        global.player_gold += (global.enemy_gold + global.enemy_gold_2)
17
        message[0] = "* YOU WON!#* You earned " + (string(global.enemy_exp + global.enemy_exp_2)) + " XP and " + (string(global.enemy_gold + global.enemy_gold_2)) + " gold."
18
        break
19
    case 3:
20
        if (global.enemy_dead == false)
21
            global.enemy_exp = 0
22
        if (global.enemy_dead_2 == false)
23
            global.enemy_exp_2 = 0
24
        if (global.enemy_dead_3 == false)
25
            global.enemy_exp_3 = 0
26
        global.player_exp += (global.enemy_exp + global.enemy_exp_2 + global.enemy_exp_3)
27
        global.player_gold += (global.enemy_gold + global.enemy_gold_2 + global.enemy_gold_3)
28
        message[0] = "* YOU WON!#* You earned " + (string(global.enemy_exp + global.enemy_exp_2 + global.enemy_exp_3)) + " XP and " + (string(global.enemy_gold + global.enemy_gold_2 + global.enemy_gold_3)) + " gold."
29
        break
30
    default:
31
        message[0] = "* YOU WON!#* You earned 0 XP and 0 gold."
32
}
33
34
if (global.player_exp >= global.player_exp_next[global.player_level])
35
{
36
    var i = global.player_level
37
    while (i <= 20)
38
    {
39
        if (global.player_exp >= global.player_exp_next[i])
40
        {
41
            global.player_level = i + 1
42
            global.max_hp_self = global.player_hp_next[(i + 1)]
43
            global.player_attack = global.player_attack_next[(i + 1)]
44
            global.player_defense = global.player_defense_next[(i + 1)]
45
            i += 1
46
            continue
47
        }
48
        else
49
            break
50
    }
51
    audio_play_sound(snd_love_increased, 20, 0)
52
    message[0] = message[0] + "#* Your LOVE increased."
53
}
54
message_current = 0
55
message_end = 0
56
message_draw = ""
57
increase = global.text_speed
58
characters = 0
59
hold = 0
60
message_length = string_length(message[message_current])
61
moveable = true
62
script_execute(gml_Script_scr_generate_text_counters)