Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_scr_auto_spare_enemy_solo

(view raw script w/o annotations or w/e)
1
function scr_auto_spare_enemy_solo
scr_auto_spare_enemy_solo

function scr_auto_spare_enemy_solo(argument0) //gml_Script_scr_auto_spare_enemy_solo { enemy_a_dead = false enemy_a_spared = false enemy_b_dead = false enemy_b_spared = false if (argument0 == 1) { global.enemy_sparing = true global.enemy_spared = true if (global.enemy_count >= 2) { enemy_a_dead = global.enemy_dead_2 enemy_a_spared = global.enemy_spared_2 } if (global.enemy_count >= 3) { enemy_b_dead = global.enemy_dead_3 enemy_b_spared = global.enemy_spared_3 } } else if (argument0 == 2) { global.enemy_sparing_2 = true global.enemy_spared_2 = true enemy_a_dead = global.enemy_dead enemy_a_spared = global.enemy_spared if (global.enemy_count >= 3) { enemy_b_dead = global.enemy_dead_3 enemy_b_spared = global.enemy_spared_3 } } else if (argument0 == 3) { global.enemy_sparing_3 = true global.enemy_spared_3 = true enemy_a_dead = global.enemy_dead enemy_a_spared = global.enemy_spared enemy_b_dead = global.enemy_dead_2 enemy_b_spared = global.enemy_spared_2 } if (global.enemy_count == 1) { with (obj_battle_generator) audio_extend = false audio_stop_all() instance_create(0, 0, obj_dialogue_battle_win_enemy) } else if (global.enemy_count == 2 && (enemy_a_dead + enemy_a_spared) >= 1) { with (obj_battle_generator) audio_extend = false audio_stop_all() instance_create(0, 0, obj_dialogue_battle_win_enemy) } else if (global.enemy_count == 3 && (enemy_a_dead + enemy_a_spared + enemy_b_dead + enemy_b_spared) >= 2) { with (obj_battle_generator) audio_extend = false audio_stop_all() instance_create(0, 0, obj_dialogue_battle_win_enemy) } else { 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 } } }
(argument0) //gml_Script_scr_auto_spare_enemy_solo
2
{
3
    enemy_a_dead = false
4
    enemy_a_spared = false
5
    enemy_b_dead = false
6
    enemy_b_spared = false
7
    if (argument0 == 1)
8
    {
9
        global.enemy_sparing = true
10
        global.enemy_spared = true
11
        if (global.enemy_count >= 2)
12
        {
13
            enemy_a_dead = global.enemy_dead_2
14
            enemy_a_spared = global.enemy_spared_2
15
        }
16
        if (global.enemy_count >= 3)
17
        {
18
            enemy_b_dead = global.enemy_dead_3
19
            enemy_b_spared = global.enemy_spared_3
20
        }
21
    }
22
    else if (argument0 == 2)
23
    {
24
        global.enemy_sparing_2 = true
25
        global.enemy_spared_2 = true
26
        enemy_a_dead = global.enemy_dead
27
        enemy_a_spared = global.enemy_spared
28
        if (global.enemy_count >= 3)
29
        {
30
            enemy_b_dead = global.enemy_dead_3
31
            enemy_b_spared = global.enemy_spared_3
32
        }
33
    }
34
    else if (argument0 == 3)
35
    {
36
        global.enemy_sparing_3 = true
37
        global.enemy_spared_3 = true
38
        enemy_a_dead = global.enemy_dead
39
        enemy_a_spared = global.enemy_spared
40
        enemy_b_dead = global.enemy_dead_2
41
        enemy_b_spared = global.enemy_spared_2
42
    }
43
    if (global.enemy_count == 1)
44
    {
45
        with (obj_battle_generator)
46
            audio_extend = false
47
        audio_stop_all()
48
        instance_create(0, 0, obj_dialogue_battle_win_enemy)
49
    }
50
    else if (global.enemy_count == 2 && (enemy_a_dead + enemy_a_spared) >= 1)
51
    {
52
        with (obj_battle_generator)
53
            audio_extend = false
54
        audio_stop_all()
55
        instance_create(0, 0, obj_dialogue_battle_win_enemy)
56
    }
57
    else if (global.enemy_count == 3 && (enemy_a_dead + enemy_a_spared + enemy_b_dead + enemy_b_spared) >= 2)
58
    {
59
        with (obj_battle_generator)
60
            audio_extend = false
61
        audio_stop_all()
62
        instance_create(0, 0, obj_dialogue_battle_win_enemy)
63
    }
64
    else
65
    {
66
        global.important_cutscene = script_execute(gml_Script_scr_determine_important_cutscene_attacking)
67
        global.can_attack = script_execute(gml_Script_scr_determine_can_attack_attacking)
68
        if (global.important_cutscene == false && global.can_attack == true)
69
            global.enemy_attacking = true
70
        if (global.can_attack == false)
71
        {
72
            with (obj_dialogue_box_battle)
73
                no_loop_can_attack = false
74
        }
75
    }
76
}