Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_generator_Step_2

(view raw script w/o annotations or w/e)
1
if (global.current_hp_self < 0)
2
    global.current_hp_self = 0
3
var enemy_count = global.enemy_count
4
if (global.current_hp_enemy < 0)
5
    global.current_hp_enemy = 0
6
else if (enemy_count >= 2)
7
{
8
    if (global.current_hp_enemy_2 < 0)
9
        global.current_hp_enemy_2 = 0
10
}
11
else if (enemy_count >= 3)
12
{
13
    if (global.current_hp_enemy_3 < 0)
14
        global.current_hp_enemy_3 = 0
15
}
16
if (global.current_pp_self > global.max_pp_self)
17
    global.current_pp_self = global.max_pp_self
18
if (global.current_pp_self < 0)
19
    global.current_pp_self = 0
20
if (global.current_sp_self > global.max_sp_self)
21
    global.current_sp_self = global.max_sp_self
22
if (global.current_sp_self < 0)
23
    global.current_sp_self = 0
24
if (instance_exists(obj_dialogue_box_battle_transformation_any) && obj_heart_battle_fighting_parent.moveable == true && global.image_alpha_enemy_attacking_immunity == false)
25
{
26
    if (global.image_alpha_enemy_attacking > 0.5)
27
    {
28
        global.image_alpha_enemy_attacking -= 0.05
29
        if (global.image_alpha_enemy_attacking <= 0.5)
30
            global.image_alpha_enemy_attacking = 0.5
31
    }
32
}
33
else if (global.image_alpha_enemy_attacking < 1)
34
{
35
    global.image_alpha_enemy_attacking += 0.05
36
    if (global.image_alpha_enemy_attacking >= 1)
37
        global.image_alpha_enemy_attacking = 1
38
}
39
if (audio_extend == true)
40
{
41
    if (!audio_is_playing(audio_initial_music))
42
    {
43
        audio_sound_gain(audio_extend_music, 0.8, 0)
44
        audio_play_sound(audio_extend_music, 20, true)
45
        audio_extend = false
46
    }
47
}