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

function scr_screenshake(arg0, arg1) { if (instance_exists(obj_screenshake_player)) exit; with (instance_create(__view_get(e__VW.Object, 0).x, __view_get(e__VW.Object, 0).y, obj_screenshake_player)) { alarm[0] intensity = arg1; } } enum e__VW { XView, YView, WView, HView, Angle, HBorder, VBorder, HSpeed, VSpeed, Object, Visible, XPort, YPort, WPort, HPort, Camera, SurfaceID }
(12, 6);
94
    global.current_hp_self -= damage;
95
    alarm[0] = global.invulnerability_self;
96
    alarm[1] = 5;
gml_Object_obj_flowey_battle_ow_controller_Alarm_1.gml

if (player_alpha == 0.5) player_alpha = 1; else player_alpha = 0.5; alarm[1] = 5;
97
}
98
if (other.player_vulnerable == true)
99
{
100
    player_alpha = 1;
101
    alarm[1] = -1;
gml_Object_obj_flowey_battle_ow_controller_Alarm_1.gml

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