Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attacking_code_Step_0

(view raw script w/o annotations or w/e)
1
if (global.current_hp_enemy < 0)
2
    global.current_hp_enemy = 0
3
if (global.current_hp_enemy_draw > global.current_hp_enemy)
4
    global.current_hp_enemy_draw -= ((global.last_hp_enemy - global.current_hp_enemy) / 10)
5
if (global.current_hp_enemy_draw <= global.current_hp_enemy)
6
    global.current_hp_enemy_draw = global.current_hp_enemy
7
if (global.current_hp_enemy_draw == global.current_hp_enemy && execute_code == true && no_loop == false)
8
{
9
    if (instance_exists(obj_text_damage_count) && obj_text_damage_count.y == obj_text_damage_count.starting_point)
10
    {
11
        alarm[1] = 15
alarm[1]

var attack_missed = false if instance_exists(obj_text_damage_count) { with (obj_text_damage_count) instance_destroy() } if instance_exists(obj_text_miss) { attack_missed = true with (obj_text_miss) instance_destroy() } with (obj_target_bar_battle) instance_destroy() if instance_exists(obj_battle_hp_enemy_attacking_parent) { with (obj_battle_hp_enemy_attacking_parent) instance_destroy() } if (global.current_hp_enemy < 0) global.current_hp_enemy = 0 if (global.current_hp_enemy == 0) { var enemy_count = global.enemy_count global.enemy_dead = true if (enemy_count == 1) { with (obj_battle_generator) audio_extend = false audio_stop_all() instance_create(0, 0, obj_dialogue_battle_win_enemy) audio_play_sound(snd_monster_damage_death, 20, false) } else if (enemy_count == 2) { if (global.enemy_dead_2 == true || global.enemy_spared_2 == true) { with (obj_battle_generator) audio_extend = false audio_stop_all() instance_create(0, 0, obj_dialogue_battle_win_enemy) audio_play_sound(snd_monster_damage_death, 20, false) } else { global.enemy_sparing = false scr_determine_special_effect_enemy("Fight 1") global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking) global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking) if (global.important_cutscene == false && global.can_attack == true) global.enemy_attacking = true if (global.can_attack == false) { with (obj_dialogue_box_battle) no_loop_can_attack = false } } } else if (enemy_count == 3) { if ((global.enemy_dead_2 == true || global.enemy_spared_2 == true) && (global.enemy_dead_3 == true || global.enemy_spared_3 == true)) { with (obj_battle_generator) audio_extend = false audio_stop_all() instance_create(0, 0, obj_dialogue_battle_win_enemy) audio_play_sound(snd_monster_damage_death, 20, false) } else { global.enemy_sparing = false scr_determine_special_effect_enemy("Fight 1") global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking) global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking) if (global.important_cutscene == false && global.can_attack == true) global.enemy_attacking = true if (global.can_attack == false) { with (obj_dialogue_box_battle) no_loop_can_attack = false } } } } else { if (!attack_missed) global.enemy_sparing = false scr_determine_special_effect_enemy("Fight 1") global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking) global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking) if (global.important_cutscene == false && global.can_attack == true) global.enemy_attacking = true if (global.can_attack == false) { with (obj_dialogue_box_battle) no_loop_can_attack = false } } instance_destroy()
12
        no_loop = true
13
    }
14
    else if (instance_exists(obj_text_miss) && obj_text_miss.y == obj_text_miss.starting_point)
15
    {
16
        alarm[1] = 15
alarm[1]

var attack_missed = false if instance_exists(obj_text_damage_count) { with (obj_text_damage_count) instance_destroy() } if instance_exists(obj_text_miss) { attack_missed = true with (obj_text_miss) instance_destroy() } with (obj_target_bar_battle) instance_destroy() if instance_exists(obj_battle_hp_enemy_attacking_parent) { with (obj_battle_hp_enemy_attacking_parent) instance_destroy() } if (global.current_hp_enemy < 0) global.current_hp_enemy = 0 if (global.current_hp_enemy == 0) { var enemy_count = global.enemy_count global.enemy_dead = true if (enemy_count == 1) { with (obj_battle_generator) audio_extend = false audio_stop_all() instance_create(0, 0, obj_dialogue_battle_win_enemy) audio_play_sound(snd_monster_damage_death, 20, false) } else if (enemy_count == 2) { if (global.enemy_dead_2 == true || global.enemy_spared_2 == true) { with (obj_battle_generator) audio_extend = false audio_stop_all() instance_create(0, 0, obj_dialogue_battle_win_enemy) audio_play_sound(snd_monster_damage_death, 20, false) } else { global.enemy_sparing = false scr_determine_special_effect_enemy("Fight 1") global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking) global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking) if (global.important_cutscene == false && global.can_attack == true) global.enemy_attacking = true if (global.can_attack == false) { with (obj_dialogue_box_battle) no_loop_can_attack = false } } } else if (enemy_count == 3) { if ((global.enemy_dead_2 == true || global.enemy_spared_2 == true) && (global.enemy_dead_3 == true || global.enemy_spared_3 == true)) { with (obj_battle_generator) audio_extend = false audio_stop_all() instance_create(0, 0, obj_dialogue_battle_win_enemy) audio_play_sound(snd_monster_damage_death, 20, false) } else { global.enemy_sparing = false scr_determine_special_effect_enemy("Fight 1") global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking) global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking) if (global.important_cutscene == false && global.can_attack == true) global.enemy_attacking = true if (global.can_attack == false) { with (obj_dialogue_box_battle) no_loop_can_attack = false } } } } else { if (!attack_missed) global.enemy_sparing = false scr_determine_special_effect_enemy("Fight 1") global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking) global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking) if (global.important_cutscene == false && global.can_attack == true) global.enemy_attacking = true if (global.can_attack == false) { with (obj_dialogue_box_battle) no_loop_can_attack = false } } instance_destroy()
17
        no_loop = true
18
    }
19
}