Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_ch2_room_mansion_kitchen_Step_0

(view raw script w/o annotations or w/e)
1
if (global.flag[362 mauswheel_defeated] == 0)
2
{
3
    if (obj_mainchara.x < 280 && con == -1)
4
    {
5
        con = 1;
6
        timer = 0;
7
        alarm[0] = 15;
8
        global.interact = 1;
9
        snd_play(snd_mouse);
10
        with (mouse_a)
11
        {
12
            scr_emote
scr_emote

function scr_emote() { __dmult = 1 + global.darkzone; __emotebubble = instance_create(x, y - 15, obj_excblcon); __emotebubble.alarm[0] = argument[1]; __emotebubble.image_xscale = __dmult; __emotebubble.image_yscale = __dmult; __emotexoff = 0; __anchorx = sprite_get_xoffset(sprite_index); if (argument[0] == "!") { __emotebubble.sprite_index = spr_exc; __emotebubble.y = y - (10 * __dmult); __emotexoff = 10 * __dmult; } if (argument[0] == "?") { __emotebubble.sprite_index = spr_emote_questionmark; __emotebubble.y = y - (10 * __dmult); __emotexoff = 10 * __dmult; } if (argument[0] == "...") { __emotebubble.sprite_index = spr_emote_ellipsis; __emotebubble.y = y - (10 * __dmult); __emotexoff = 10 * __dmult; } if (argument_count >= 3) __emotexoff = argument[2]; if (image_xscale > 0) __emotebubble.x = (((x - (__anchorx * image_xscale)) + ((sprite_width / 2) * sign(image_xscale))) - (__emotebubble.sprite_width / 2)) + __emotexoff; else __emotebubble.x = ((x + (__anchorx * image_xscale)) - ((sprite_width / 2) * sign(image_xscale)) - (__emotebubble.sprite_width / 2)) + __emotexoff; }
("!", 20);
13
            scr_flip
scr_flip

function scr_flip(arg0) { if (arg0 == "h" || arg0 == "x") { x += ((sprite_get_width(sprite_index) - (sprite_get_xoffset(sprite_index) * 2)) * image_xscale); image_xscale = -image_xscale; } else { y += ((sprite_get_height(sprite_index) - (sprite_get_yoffset(sprite_index) * 2)) * image_yscale); image_yscale = -image_yscale; } }
("x");
14
        }
15
        with (mouse_b)
16
        {
17
            scr_emote
scr_emote

function scr_emote() { __dmult = 1 + global.darkzone; __emotebubble = instance_create(x, y - 15, obj_excblcon); __emotebubble.alarm[0] = argument[1]; __emotebubble.image_xscale = __dmult; __emotebubble.image_yscale = __dmult; __emotexoff = 0; __anchorx = sprite_get_xoffset(sprite_index); if (argument[0] == "!") { __emotebubble.sprite_index = spr_exc; __emotebubble.y = y - (10 * __dmult); __emotexoff = 10 * __dmult; } if (argument[0] == "?") { __emotebubble.sprite_index = spr_emote_questionmark; __emotebubble.y = y - (10 * __dmult); __emotexoff = 10 * __dmult; } if (argument[0] == "...") { __emotebubble.sprite_index = spr_emote_ellipsis; __emotebubble.y = y - (10 * __dmult); __emotexoff = 10 * __dmult; } if (argument_count >= 3) __emotexoff = argument[2]; if (image_xscale > 0) __emotebubble.x = (((x - (__anchorx * image_xscale)) + ((sprite_width / 2) * sign(image_xscale))) - (__emotebubble.sprite_width / 2)) + __emotexoff; else __emotebubble.x = ((x + (__anchorx * image_xscale)) - ((sprite_width / 2) * sign(image_xscale)) - (__emotebubble.sprite_width / 2)) + __emotexoff; }
("!", 20);
18
            scr_flip
scr_flip

function scr_flip(arg0) { if (arg0 == "h" || arg0 == "x") { x += ((sprite_get_width(sprite_index) - (sprite_get_xoffset(sprite_index) * 2)) * image_xscale); image_xscale = -image_xscale; } else { y += ((sprite_get_height(sprite_index) - (sprite_get_yoffset(sprite_index) * 2)) * image_yscale); image_yscale = -image_yscale; } }
("x");
19
        }
20
        with (mouse_c)
21
        {
22
            scr_emote
scr_emote

function scr_emote() { __dmult = 1 + global.darkzone; __emotebubble = instance_create(x, y - 15, obj_excblcon); __emotebubble.alarm[0] = argument[1]; __emotebubble.image_xscale = __dmult; __emotebubble.image_yscale = __dmult; __emotexoff = 0; __anchorx = sprite_get_xoffset(sprite_index); if (argument[0] == "!") { __emotebubble.sprite_index = spr_exc; __emotebubble.y = y - (10 * __dmult); __emotexoff = 10 * __dmult; } if (argument[0] == "?") { __emotebubble.sprite_index = spr_emote_questionmark; __emotebubble.y = y - (10 * __dmult); __emotexoff = 10 * __dmult; } if (argument[0] == "...") { __emotebubble.sprite_index = spr_emote_ellipsis; __emotebubble.y = y - (10 * __dmult); __emotexoff = 10 * __dmult; } if (argument_count >= 3) __emotexoff = argument[2]; if (image_xscale > 0) __emotebubble.x = (((x - (__anchorx * image_xscale)) + ((sprite_width / 2) * sign(image_xscale))) - (__emotebubble.sprite_width / 2)) + __emotexoff; else __emotebubble.x = ((x + (__anchorx * image_xscale)) - ((sprite_width / 2) * sign(image_xscale)) - (__emotebubble.sprite_width / 2)) + __emotexoff; }
("!", 20);
23
            scr_flip
scr_flip

function scr_flip(arg0) { if (arg0 == "h" || arg0 == "x") { x += ((sprite_get_width(sprite_index) - (sprite_get_xoffset(sprite_index) * 2)) * image_xscale); image_xscale = -image_xscale; } else { y += ((sprite_get_height(sprite_index) - (sprite_get_yoffset(sprite_index) * 2)) * image_yscale); image_yscale = -image_yscale; } }
("x");
24
        }
25
    }
26
    if (con == 2)
27
    {
28
        timer++;
29
        if (timer < 30)
30
        {
31
            cx = 90;
32
            cy = 200;
33
            turnspeed = 40;
34
            radius = 40;
35
            lerpspeed = 0.125;
36
            mouse_b.x = lerp(mouse_b.x, cx + (sin(30 / turnspeed) * 40), lerpspeed);
37
            mouse_b.y = lerp(mouse_b.y, cy + (cos(30 / turnspeed) * 40), lerpspeed);
38
            mouse_a.x = lerp(mouse_a.x, cx + (sin(2.0943951023931953 + (30 / turnspeed)) * 40), lerpspeed);
39
            mouse_a.y = lerp(mouse_a.y, cy + (cos(2.0943951023931953 + (30 / turnspeed)) * 40), lerpspeed);
40
            mouse_c.x = lerp(mouse_c.x, cx + (sin(4.1887902047863905 + (30 / turnspeed)) * 40), lerpspeed);
41
            mouse_c.y = lerp(mouse_c.y, cy + (cos(4.1887902047863905 + (30 / turnspeed)) * 40), lerpspeed);
42
        }
43
        if (timer >= 30)
44
        {
45
            if (turnspeed > 3)
46
                turnspeed = lerp(turnspeed, 3, 0.1);
47
            if (turnspeed < 10)
48
            {
49
                with (mouse_a)
50
                    scr_afterimage
scr_afterimage

function scr_afterimage() { afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
();
51
                with (mouse_b)
52
                    scr_afterimage
scr_afterimage

function scr_afterimage() { afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
();
53
                with (mouse_c)
54
                    scr_afterimage
scr_afterimage

function scr_afterimage() { afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
();
55
            }
56
            if (turnspeed < 6)
57
            {
58
                if (radius > 1)
59
                {
60
                    radius = lerp(radius, 0, 0.25);
61
                }
62
                else
63
                {
64
                    radius = 0;
65
                    snd_play(snd_great_shine);
66
                    con = 2.1;
67
                }
68
            }
69
            if (radius < 10)
70
            {
71
                if (whiteall.image_alpha == 0)
72
                    whiteall.image_alpha = 0.03;
73
                whiteall.image_alpha *= 1.2;
74
            }
75
            mouse_a.x = cx + (sin(timer / turnspeed) * radius);
76
            mouse_a.y = cy + (cos(timer / turnspeed) * radius);
77
            mouse_b.x = cx + (sin(2.0943951023931953 + (timer / turnspeed)) * radius);
78
            mouse_b.y = cy + (cos(2.0943951023931953 + (timer / turnspeed)) * radius);
79
            mouse_c.x = cx + (sin(4.1887902047863905 + (timer / turnspeed)) * radius);
80
            mouse_c.y = cy + (cos(4.1887902047863905 + (timer / turnspeed)) * radius);
81
        }
82
    }
83
    if (con == 2.1)
84
    {
85
        whiteall.image_alpha *= 1.2;
86
        if (whiteall.image_alpha >= 1)
87
        {
88
            timer = 0;
89
            con = 2.2;
90
        }
91
    }
92
    if (con == 2.2)
93
    {
94
        if (timer == 0)
95
        {
96
            with (mouse_a)
97
                visible = 0;
98
            with (mouse_b)
99
                visible = 0;
100
            with (mouse_c)
101
                visible = 0;
102
            with (cheese_a)
103
                visible = 0;
104
            with (cheese_b)
105
                visible = 0;
106
            with (cheese_c)
107
                visible = 0;
108
            if (mauswheel == -4)
109
            {
110
                mauswheel = scr_dark_marker
scr_dark_marker

function scr_dark_marker(arg0, arg1, arg2) { thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; image_xscale = 2; image_yscale = 2; } return thismarker; }
(20, 160, spr_mauswheel_idle);
111
                mauswheel.image_speed = 0.5;
112
            }
113
        }
114
        timer++;
115
        if (timer > 15)
116
            whiteall.image_alpha *= 0.9;
117
        if (whiteall.image_alpha <= 0.01)
118
        {
119
            with (whiteall)
120
            {
121
                instance_destroy();
122
                other.con = 3;
123
            }
124
        }
125
    }
126
    if (con == 3)
127
    {
128
        con = 4;
129
        alarm[0] = 15;
130
    }
131
    if (con == 5)
132
    {
133
        con = 9;
134
        alarm[0] = 30;
135
        encounterflag = 543;
136
        global.flag[54 encounter_pointer] = encounterflag;
137
        global.flag[9 battle_music] = 2;
138
        scr_battle
scr_battle

function scr_battle(arg0, arg1, arg2, arg3, arg4) { global.specialbattle = arg1; global.encounterno = arg0; if (global.flag[9 battle_music] != 2) { global.flag[9 battle_music] = 1; global.batmusic[0] = snd_init("battle.ogg"); } instance_create(0, 0, obj_battleback); instance_create(0, 0, obj_encounterbasic); __enemymarker[0] = arg2; __enemymarker[1] = arg3; __enemymarker[2] = arg4; for (__ien = 0; __ien < 3; __ien++) { if (global.monstertype[__ien] != 0(None)) { if (!i_ex(__enemymarker[__ien])) { __enemymarker[__ien] = scr_dark_marker(global.monstermakex[__ien] + 300, global.monstermakey[__ien], object_get_sprite(global.monsterinstancetype[__ien])); __enemymarker[__ien].depth = -__ien; } __enemymarker[__ien].__ien = __ien; with (__enemymarker[__ien]) { scr_move_to_point_over_time(global.monstermakex[__ien], global.monstermakey[__ien], 20); __doom = instance_create(x, y, obj_doom); __doom.target = id; __doom.alarm[0] = 25; } } } }
(83, 0, mauswheel, 0, 0);
139
    }
140
    if (con == 10 && !i_ex(obj_battlecontroller))
141
    {
142
        global.flag[362 mauswheel_defeated] = 1;
143
        global.flag[9 battle_music] = 0;
144
        scr_tempsave
scr_tempsave

function scr_tempsave() { filechoicebk2 = global.filechoice; global.filechoice = 9; scr_saveprocess(global.filechoice); global.filechoice = filechoicebk2; }
();
145
        with (swatchling_npc_a)
146
            sprite_index = spr_npc_swatchling_down;
147
        with (cheese_a)
148
        {
149
            image_index = 1;
150
            visible = 1;
151
        }
152
        with (cheese_b)
153
        {
154
            image_index = 1;
155
            visible = 1;
156
        }
157
        with (cheese_c)
158
        {
159
            image_index = 1;
160
            visible = 1;
161
        }
162
    }
163
}