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
    if place_meeting(x, y, obj_pl)
4
        var elevator_collided_player = true
5
    else
6
        elevator_collided_player = false
7
    if (elevator_active == false)
8
    {
9
        if (!elevator_collided_player)
10
            elevator_active = true
11
        return;
12
    }
13
    if elevator_collided_player
14
    {
15
        if (!alarm[0])
16
            alarm[0] = 30
alarm[0]

elevator_can_collide = false instance_create(obj_pl.x, obj_pl.y, obj_npc_clover_dunes_24) if (global.party_member != noone) { 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
17
    }
18
    else
19
        alarm[0] = -1
alarm[0]

elevator_can_collide = false instance_create(obj_pl.x, obj_pl.y, obj_npc_clover_dunes_24) if (global.party_member != noone) { 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
20
}
21
if (act == 0)
22
{
23
    if (scene == 1)
24
    {
25
        if (player_x == 0)
26
            player_x = obj_pl.x
27
        if (player_y == 0)
28
            player_y = obj_pl.y
29
        obj_pl.x = player_x
30
        obj_pl.y = player_y
31
        x = xstart
32
        y = ystart
33
        if (shake_strength > 0)
34
            shake_strength -= 0.05
35
        var shake_x = random_range((-shake_strength), shake_strength)
36
        var shake_y = random_range((-shake_strength), shake_strength)
37
        x += shake_x
38
        y += shake_y
39
        obj_pl.x += shake_x
40
        obj_pl.y += shake_y
41
        if instance_exists(obj_martlet_npc)
42
        {
43
            obj_martlet_npc.x = follower_x_target
44
            obj_martlet_npc.y = follower_y_target
45
            obj_martlet_npc.x += shake_x
46
            obj_martlet_npc.y += shake_y
47
            obj_martlet_npc.depth = depth - 1
48
        }
49
        if scr_timer
scr_timer

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

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

function scr_timer() //gml_Script_scr_timer { if (timer > 0) { timer-- return false; } else return true; }
())
116
        {
117
            act = 0
118
            pull_speed = 0
119
            timer = 20
120
            elevator_can_collide = true
121
            scr_audio_fade_out
scr_audio_fade_out

function scr_audio_fade_out(argument0, argument1) //gml_Script_scr_audio_fade_out { var snd = argument0 var fade_len = argument1 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 }
(snd_helivator, 600)
122
            if instance_exists(obj_martlet_npc)
123
            {
124
                with (obj_martlet_npc)
125
                {
126
                    instance_create(x, y, obj_martlet_follower)
127
                    obj_martlet_follower.dir_new[1] = 270
128
                    obj_martlet_follower.npc_reset = true
129
                    obj_martlet_follower.image_blend = image_blend
130
                    instance_destroy()
131
                }
132
            }
133
            if (room == rm_dunes_27)
134
            {
135
                layer_depth("grass_tiles", 1000000)
136
                layer_depth("ground_tiles", 1000001)
137
            }
138
            scene = 0
139
            alarm[1] = 5
140
        }
141
    }
142
}
143
if instance_exists(obj_martlet_npc)
144
    obj_martlet_npc.image_blend = obj_pl.image_blend