Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_flowey_battle_ow_controller_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
if (overlay_alpha > 0)
4
    overlay_alpha -= 0.1
5
if (spawn_vines == true)
6
{
7
    gui_fade_out = false
8
    var _play_sound = true
9
    attack_offset--
10
    if (attack_offset <= 0)
11
    {
12
        attack_offset = attack_offset_max + attack_delay
13
        audio_play_sound(snd_undertale_appear, 1, 0)
14
        var xdist = irandom_range(20, 60)
15
        do
16
        {
17
            var xx = obj_pl.x + xdist * (sign(obj_pl.x - obj_pl.xprevious))
18
            xdist -= 10
19
        } until (place_free(xx, (obj_pl.y + 15)) || x_dist <= 0);
20
        var ydist = irandom_range(20, 60)
21
        do
22
        {
23
            var yy = obj_pl.y + 15 + ydist * (sign(obj_pl.y - obj_pl.yprevious))
24
            ydist -= 10
25
        } until (place_free(yy, obj_pl.x) || y_dist <= 0);
26
        xx = (floor(xx / 20)) * 20
27
        yy = (floor(yy / 20)) * 20
28
        var grid_size = 5
29
        var grid_squared = grid_size * grid_size
30
        var start_point_x = xx - grid_size * 20 * 0.5
31
        var start_point_y = yy - grid_size * 20 * 0.5
32
        show_debug_message(start_point_x)
33
        var excluded_count = irandom_range(floor(grid_squared * 0.35), floor(grid_squared * 0.75))
34
        exclude_list = ds_list_create()
35
        for (var a = 0; a < excluded_count; a++)
36
        {
37
            do
38
            {
39
                var new_number = irandom_range(0, (grid_size * grid_size))
40
            } until (ds_list_find_index(exclude_list, new_number) == -1);
41
            ds_list_add(exclude_list, new_number)
42
        }
43
        var current_spawn = 0
44
        var can_play_sound = true
45
        for (var j = 0; j < grid_size; j++)
46
        {
47
            for (var i = 0; i < grid_size; i++)
48
            {
49
                var new_x = start_point_x + i * 20
50
                var new_y = start_point_y + j * 20
51
                if (ds_list_find_index(exclude_list, current_spawn) == -1 && (!(instance_position(new_x, new_y, obj_wall))))
52
                {
53
                    var new_vine = instance_create_depth(new_x, new_y, 0, obj_flowey_battle_ow_vine_warning)
54
                    new_vine.play_sound = can_play_sound
55
                    new_vine.alarm[0] = attack_delay
56
                    can_play_sound = false
57
                }
58
                current_spawn += 1
59
            }
60
        }
61
        ds_list_clear(exclude_list)
62
        ds_list_destroy(exclude_list)
63
    }
64
    with (obj_pl)
65
    {
66
        var col_vine = instance_place(x, y, obj_flowey_battle_ow_vine)
67
        if (col_vine != noone && col_vine.image_alpha >= 0.5 && other.player_vulnerable)
68
        {
69
            other.player_hurt = true
70
            other.player_vulnerable = false
71
        }
72
        if instance_exists(obj_flowey_battle_ow_determination)
73
        {
74
            if (point_distance(x, y, obj_flowey_battle_ow_determination.x, obj_flowey_battle_ow_determination.y) < 120)
75
                other.spawn_vines = false
76
        }
77
    }
78
}
79
else
80
    gui_fade_out = true
81
var damage = global.enemy_attack_stat - global.player_armor_defense - global.player_armor_modifier_defense - global.player_defense + 10
82
if (player_hurt == true)
83
{
84
    player_hurt = false
85
    player_alpha = 0.5
86
    audio_play_sound(snd_hurt, 20, false)
87
    scr_screenshake
scr_screenshake

function scr_screenshake(argument0, argument1) //gml_Script_scr_screenshake { if instance_exists(obj_screenshake_player) return; with (instance_create(__view_get((9 << 0), 0).x, __view_get((9 << 0), 0).y, obj_screenshake_player)) { alarm[0]
alarm[0]

other.player_vulnerable = true
intensity = argument1 } }
(12, 6)
88
    global.current_hp_self -= damage
89
    alarm[0] = global.invulnerability_self
alarm[0]

other.player_vulnerable = true
90
    alarm[1] = 5
alarm[1]

if (player_alpha == 0.5) player_alpha = 1 else player_alpha = 0.5 alarm[1] = 5
91
}
92
if (other.player_vulnerable == true)
93
{
94
    player_alpha = 1
95
    alarm[1] = -1
alarm[1]

if (player_alpha == 0.5) player_alpha = 1 else player_alpha = 0.5 alarm[1] = 5
96
}
97
if (global.current_hp_self < 0)
98
    global.current_hp_self = 0
99
if (global.current_hp_self == 0)
100
{
101
    global.heart_battle_fighting_x = (obj_pl.x - camera_get_view_x(view_camera[0])) * 2
102
    global.heart_battle_fighting_y = (obj_pl.y - camera_get_view_y(view_camera[0])) * 2
103
    with (obj_battle_generator)
104
        audio_extend = false
105
    audio_stop_all()
106
    room_goto(rm_death_screen Death screen)
107
    global.cutscene = true
108
    obj_pl.image_alpha = 0
109
}
110
depth = obj_pl.depth - 1
111
if instance_exists(obj_player_npc)
112
    obj_player_npc.image_alpha = 0
113
if (gui_fade_out == true)
114
{
115
    if (gui_alpha > 0)
116
        gui_alpha -= 0.1
117
}
118
else if (gui_alpha < 1)
119
    gui_alpha += 0.1