Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_pulley_elevator_Step_0

(view raw script w/o annotations or w/e)
1
if (elevator_can_collide)
2
{
3
    var elevator_collided_player;
4
    if (place_meeting(x, y, obj_pl))
5
        elevator_collided_player = true;
6
    else
7
        elevator_collided_player = false;
8
    if (elevator_active == false)
9
    {
10
        if (!elevator_collided_player)
11
            elevator_active = true;
12
        exit;
13
    }
14
    if (elevator_collided_player)
15
    {
16
        if (!alarm[0])
17
            alarm[0] = 30;
gml_Object_obj_pulley_elevator_Alarm_0.gml

elevator_can_collide = false; instance_create(obj_pl.x, obj_pl.y, obj_npc_clover_dunes_24); if (global.party_member != -4) { with (global.party_member) { var martlet_npc = instance_create(x, y, obj_martlet_npc); martlet_npc.npc_dynamic_depth = false; martlet_npc.x_dest[0] = other.follower_x_target; martlet_npc.y_dest[0] = other.follower_y_target; martlet_npc.end_direction = "down"; martlet_npc.can_walk = true; martlet_npc.image_blend = global.party_member.image_blend; instance_destroy(); } } if (instance_exists(obj_shadow_master)) obj_shadow_master.inst_number_last = 0;
18
    }
19
    else
20
    {
21
        alarm[0] = -1;
gml_Object_obj_pulley_elevator_Alarm_0.gml

elevator_can_collide = false; instance_create(obj_pl.x, obj_pl.y, obj_npc_clover_dunes_24); if (global.party_member != -4) { with (global.party_member) { var martlet_npc = instance_create(x, y, obj_martlet_npc); martlet_npc.npc_dynamic_depth = false; martlet_npc.x_dest[0] = other.follower_x_target; martlet_npc.y_dest[0] = other.follower_y_target; martlet_npc.end_direction = "down"; martlet_npc.can_walk = true; martlet_npc.image_blend = global.party_member.image_blend; instance_destroy(); } } if (instance_exists(obj_shadow_master)) obj_shadow_master.inst_number_last = 0;
22
    }
23
}
24
if (act == 0)
25
{
26
    if (scene == 1)
27
    {
28
        if (player_x == 0)
29
            player_x = obj_pl.x;
30
        if (player_y == 0)
31
            player_y = obj_pl.y;
32
        obj_pl.x = player_x;
33
        obj_pl.y = player_y;
34
        x = xstart;
35
        y = ystart;
36
        if (shake_strength > 0)
37
            shake_strength -= 0.05;
38
        var shake_x = random_range(-shake_strength, shake_strength);
39
        var shake_y = random_range(-shake_strength, shake_strength);
40
        x += shake_x;
41
        y += shake_y;
42
        obj_pl.x += shake_x;
43
        obj_pl.y += shake_y;
44
        if (instance_exists(obj_martlet_npc))
45
        {
46
            obj_martlet_npc.x = follower_x_target;
47
            obj_martlet_npc.y = follower_y_target;
48
            obj_martlet_npc.x += shake_x;
49
            obj_martlet_npc.y += shake_y;
50
            obj_martlet_npc.depth = depth - 1;
51
        }
52
        if (scr_timer
scr_timer

function scr_timer() { if (timer > 0) { timer--; return false; } else { return true; } }
())
53
        {
54
            x = xstart;
55
            y = ystart;
56
            timer = 30;
57
            layer_depth("ground_tiles", -9999998);
58
            layer_depth("grass_tiles", -9999999);
59
            scene++;
60
        }
61
    }
62
    if (scene == 2)
63
    {
64
        if (scr_timer
scr_timer

function scr_timer() { if (timer > 0) { timer--; return false; } else { return true; } }
())
65
        {
66
            if (!audio_is_playing(snd_helivator))
67
            {
68
                audio_sound_gain(snd_helivator, 0, 0);
69
                audio_sound_gain(snd_helivator, 1, 600);
70
                audio_play_sound(snd_helivator, 20, 1);
71
            }
72
            obj_pl.depth = depth - 1;
73
            obj_pl.y += (pull_speed * sign(target_y - starting_y));
74
            if (instance_exists(obj_martlet_npc))
75
            {
76
                obj_martlet_npc.y = obj_pl.y;
77
                obj_martlet_npc.depth = depth - 1;
78
            }
79
            y += (pull_speed * sign(target_y - starting_y));
80
            if (pull_speed < 2.5)
81
                pull_speed += (0.01 + (0.03 * abs(pull_speed)));
82
            if (abs(target_y - y) <= pull_speed)
83
            {
84
                if (!instance_exists(obj_transition))
85
                {
86
                    var trn = instance_create(x, y, obj_transition);
87
                    trn.newRoom = elevator_next_room;
88
                    trn.xx = 195;
89
                    trn.yy = 440;
90
                }
91
            }
92
        }
93
    }
94
}
95
if (act == 1)
96
{
97
    obj_pl.depth = depth - 1;
98
    if (scene == 0)
99
    {
100
        obj_pl.y += (pull_speed * sign(starting_y - y));
101
        if (instance_exists(obj_martlet_npc))
102
        {
103
            obj_martlet_npc.y = obj_pl.y;
104
            obj_martlet_npc.depth = depth - 1;
105
        }
106
        y += (pull_speed * sign(starting_y - y));
107
        if (abs(starting_y - y) <= 50 && pull_speed > 0)
108
            pull_speed -= (0.01 + (0.03 * abs(pull_speed)));
109
        if (abs(starting_y - y) <= pull_speed)
110
        {
111
            y = starting_y;
112
            timer = 15;
113
            scene++;
114
        }
115
    }
116
    if (scene == 1)
117
    {
118
        if (!scr_timer
scr_timer

function scr_timer() { if (timer > 0) { timer--; return false; } else { return true; } }
())
119
        {
120
            act = 0;
121
            pull_speed = 0;
122
            timer = 20;
123
            elevator_can_collide = true;
124
            scr_audio_fade_out
scr_audio_fade_out

function scr_audio_fade_out(arg0, arg1) { var snd = arg0; var fade_len = arg1; if (!audio_is_playing(snd)) return false; audio_sound_gain(snd, 0, fade_len); if (instance_exists(obj_audio_fade_helper)) { with (obj_audio_fade_helper) { if (audio_to_fade == snd) return false; } } with (instance_create(0, 0, obj_audio_fade_helper)) audio_to_fade = snd; }
(256, 600);
125
            if (instance_exists(obj_martlet_npc))
126
            {
127
                with (obj_martlet_npc)
128
                {
129
                    instance_create(x, y, obj_martlet_follower);
130
                    obj_martlet_follower.dir_new[1] = 270;
131
                    obj_martlet_follower.npc_reset = true;
132
                    obj_martlet_follower.image_blend = image_blend;
133
                    instance_destroy();
134
                }
135
            }
136
            if (room == rm_dunes_27)
137
            {
138
                layer_depth("grass_tiles", 1000000);
139
                layer_depth("ground_tiles", 1000001);
140
            }
141
            scene = 0;
142
            alarm[1] = 5;
143
        }
144
    }
145
}
146
if (instance_exists(obj_martlet_npc))
147
    obj_martlet_npc.image_blend = obj_pl.image_blend;