Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_tvturnoff_manager_Other_10

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    if (kind == 0)
4
        persistent = false;
5
    if (kind == 1)
6
        global.interact = 1;
7
    init = 1;
8
}
9
if (con == 0)
10
{
11
    timer++;
12
    _alpha1 = lerp(0, 1, timer / 5);
13
    draw_sprite_ext(spr_zapper_tvturnoff1, 0, camerax() + 320, cameray() + 240 + yoff, 6, 10, 0, c_white, _alpha1);
14
    if (timer == 5)
15
    {
16
        con = 1;
17
        timer = 0;
18
    }
19
    if (i_ex(obj_tenna_board4_enemy))
20
    {
21
        with (obj_zapper_enemy)
22
            image_alpha = 0;
23
        with (obj_tenna_board4_enemy)
24
            hidetvcount = true;
25
        with (obj_actor_tenna)
26
            preset = 0;
27
    }
28
}
29
if (con == 1)
30
{
31
    timer++;
32
    if (timer == 4)
33
        snd_play(snd_tvturnoff);
34
    _yscale1 = lerp(_yscale1, 0.05, timer / 8);
35
    draw_sprite_ext(spr_zapper_tvturnoff1, 0, camerax() + 320, cameray() + 240 + yoff, 6, _yscale1, 0, c_white, 1);
36
    draw_sprite_ext(spr_zapper_tvturnoff2, 2, camerax() + 320, cameray() + 240 + yoff, 0.1, 0.1, 0, c_white, 1);
37
    if (timer == 8)
38
    {
39
        con = 2;
40
        timer = 0;
41
        snd_play(snd_tvturnoff2);
42
        if (kind == 0)
43
            audio_pause_sound(global.batmusic[1]);
44
        if (kind == 1 || kind == 2)
45
            audio_pause_sound(global.currentsong[1]);
46
    }
47
}
48
if (con == 2)
49
{
50
    timer++;
51
    var timing = 10;
52
    if (timer <= timing)
53
    {
54
        _xscale1 = lerp(_xscale1, 0, timer / timing);
55
        _yscale1 = lerp(_yscale1, 0.01, timer / timing);
56
    }
57
    timer2++;
58
    var timing2 = 5;
59
    if (timer2 <= timing2)
60
    {
61
        _xscale2 = lerp(_xscale2, 0.4, timer2 / timing2);
62
        _yscale2 = lerp(_yscale2, 0.4, timer2 / timing2);
63
    }
64
    else
65
    {
66
        _xscale2 = lerp(_xscale2, 0, (timer2 - timing2) / timing2);
67
        _yscale2 = lerp(_yscale2, 0, (timer2 - timing2) / timing2);
68
    }
69
    draw_sprite_ext(spr_zapper_tvturnoff1, 0, camerax() + 320, cameray() + 240 + yoff, _xscale1, _yscale1, 0, c_white, 1);
70
    draw_sprite_ext(spr_zapper_tvturnoff2, 2, camerax() + 320, cameray() + 240 + yoff, _xscale2, _yscale2, 0, c_white, 1);
71
    if (timer == 30 && tennaending == true)
72
    {
73
        image_alpha = 6;
74
        if (i_ex(obj_tenna_enemy))
75
        {
76
            
scr_wincombat
scr_wincombat

function
scr_wincombat()
{ if (global.flag[60 dojo_next_encounter] == 0 || global.flag[36 dojo_failure] == 1) { global.myfight = 7; global.mnfight = -1; with (obj_battlecontroller) victory = 1; for (i = 0; i < 3; i += 1) { if (global.monster[i] == 1 && i_ex(global.monsterinstance[i])) { with (global.monsterinstance[i])
scr_monsterdefeat();
} } } else { for (i = 0; i < 3; i += 1) { if (global.monster[i] == 1 && i_ex(global.monsterinstance[i])) { with (global.monsterinstance[i])
scr_monsterdefeat();
} } global.encounterno = global.flag[60 dojo_next_encounter];
scr_encountersetup(global.encounterno);
global.flag[60 dojo_next_encounter] = 0; for (__j = 0; __j < 3; __j++) { if (global.monstertype[__j] != 0(None)) { _newmonster =
scr_monster_add(global.monstertype[__j], global.monsterinstancetype[__j]);
global.monsterinstance[_newmonster].x = camerax() + 800; global.monsterinstance[_newmonster].y = global.monstermakey[__j]; with (global.monsterinstance[_newmonster])
scr_move_to_point_over_time(global.monstermakex[myself], global.monstermakey[myself], 10);
} } global.myfight = 5; myfightreturntimer = 15; global.mnfight = -1; } }
();
77
            with (obj_battlecontroller)
78
                skipvictory = 1;
79
            with (obj_shadowman_sharpshoot_target)
80
                instance_destroy();
81
            with (obj_screen_channel_change)
82
                instance_destroy();
83
            with (obj_lightemup_controller)
84
                instance_destroy();
85
            with (obj_shadowman_sharpshoot_heart)
86
                instance_destroy();
87
            with (obj_tenna_enemy)
88
                instance_destroy();
89
        }
90
        with (obj_actor_tenna)
91
            darkenalpha = 1;
92
    }
93
    if (timer == 30 && tennaending == false)
94
    {
95
        con = 3;
96
        timer = 0;
97
        if (kind == 1)
98
        {
99
            if (entrance != "none")
100
                global.entrance = entrance;
101
            if (facing != -1)
102
                global.facing = facing;
103
            if (room_exists(roomtarg))
104
            {
105
                global.interact = 3;
106
                if (roomtarg == room_dw_b3bs_zapper_d)
107
                    
scr_setparty
scr_setparty

function
scr_setparty(arg0 = false, arg1 = false, arg2 = false)
{ var kris = obj_mainchara; var slot = 0; var __make = true; if (!i_ex(kris)) __make = false;
scr_losechar();
safe_delete(obj_caterpillarchara); if (arg0 == true) {
scr_getchar(2);
if (__make) { with (
scr_makecaterpillar(kris.x, kris.y, 2, slot))
{ halign = (global.darkzone == 0) ? 3 : 6; valign = (global.darkzone == 0) ? 6 : 16; x -= halign; y -= valign; } } slot++; } if (arg1 == true) {
scr_getchar(3);
if (__make) { with (
scr_makecaterpillar(kris.x, kris.y, 3, slot))
{ halign = 2; valign = 12; x -= halign; y -= valign; } } slot++; } if (arg2 == true) {
scr_getchar(4);
if (__make) { with (
scr_makecaterpillar(kris.x, kris.y, 4, slot))
{ halign = (global.darkzone == 0) ? 2 : 4; valign = (global.darkzone == 0) ? 9 : 18; x -= halign; y -= valign; } } slot++; } }
(0, 0, 0);
108
                else
109
                    
scr_setparty
scr_setparty

function
scr_setparty(arg0 = false, arg1 = false, arg2 = false)
{ var kris = obj_mainchara; var slot = 0; var __make = true; if (!i_ex(kris)) __make = false;
scr_losechar();
safe_delete(obj_caterpillarchara); if (arg0 == true) {
scr_getchar(2);
if (__make) { with (
scr_makecaterpillar(kris.x, kris.y, 2, slot))
{ halign = (global.darkzone == 0) ? 3 : 6; valign = (global.darkzone == 0) ? 6 : 16; x -= halign; y -= valign; } } slot++; } if (arg1 == true) {
scr_getchar(3);
if (__make) { with (
scr_makecaterpillar(kris.x, kris.y, 3, slot))
{ halign = 2; valign = 12; x -= halign; y -= valign; } } slot++; } if (arg2 == true) {
scr_getchar(4);
if (__make) { with (
scr_makecaterpillar(kris.x, kris.y, 4, slot))
{ halign = (global.darkzone == 0) ? 2 : 4; valign = (global.darkzone == 0) ? 9 : 18; x -= halign; y -= valign; } } slot++; } }
(1, 1, 0);
110
                room_goto(roomtarg);
111
            }
112
        }
113
        if (kind == 2)
114
        {
115
            obj_mainchara.x = 
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(targx);
116
            obj_mainchara.y = 
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(targy);
117
            if (kind == 2)
118
                global.facing = 1;
119
            with (obj_caterpillarchara)
120
            {
121
                setxy(
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(obj_mainchara.x - 10),
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(obj_mainchara.y - 16));
122
                if (name == "susie")
123
                {
124
                    x -= 12;
125
                    y -= 16;
126
                }
127
                else
128
                {
129
                    x -= 20;
130
                    y += 14;
131
                }
132
                
scr_caterpillar_interpolate
scr_caterpillar_interpolate

function
scr_caterpillar_interpolate(arg0 = "none")
{ if (arg0 == "all") { with (obj_caterpillarchara) scr_caterpillar_interpolate_old(); } else if (arg0 == "none") { if (object_index == obj_caterpillarchara) scr_caterpillar_interpolate_old(); } else { with (obj_caterpillarchara) { if (name == arg0) scr_caterpillar_interpolate_old(); } } } function scr_caterinterp(arg0 = "none") {
scr_caterpillar_interpolate(arg0);
} function scr_caterpillar_interpolate_old() { _newfacing =
scr_facing_letter_to_number(
scr_get_cardinal_direction(point_direction(x, y, obj_mainchara.x, obj_mainchara.y)));
remx[0] = obj_mainchara.x; remy[0] = obj_mainchara.y; facing[0] = _newfacing; for (_iaia = target; _iaia > 0; _iaia -= 1) { remx[_iaia] = lerp(obj_mainchara.x, x, _iaia / target); if (global.darkzone == 1) remy[_iaia] = lerp(obj_mainchara.y, y + 16, _iaia / target); else remy[_iaia] = lerp(obj_mainchara.y, y + 6, _iaia / target); facing[_iaia] = _newfacing; } }
();
133
                
scr_caterpillar_facing
scr_caterpillar_facing

function
scr_caterpillar_facing(arg0 = 0, arg1 = "all")
{ with (obj_caterpillarchara) { if (name == arg1 || arg1 == "all") { for (var _i = 0; _i < 25; _i += 1) facing[_i] = arg0; } } }
(1);
134
            }
135
        }
136
    }
137
}
138
if (con == 3)
139
{
140
    timer++;
141
    if (i_ex(obj_tenna_board4_enemy))
142
    {
143
        with (obj_heroparent)
144
            x = -9999;
145
    }
146
    if ((i_ex(obj_tenna_board4_enemy) && timer > 60) || !i_ex(obj_tenna_board4_enemy))
147
    {
148
        if (image_alpha == 1 && muted == 0)
149
        {
150
            if (kind == 0)
151
                audio_resume_sound(global.batmusic[1]);
152
            if (kind == 1)
153
            {
154
                mus_volume(global.currentsong[1], 0, 0);
155
                audio_resume_sound(global.currentsong[1]);
156
                mus_volume(global.currentsong[1], 1, 10);
157
            }
158
        }
159
        if (tennaending == true)
160
        {
161
        }
162
        else
163
        {
164
            image_alpha -= 0.1;
165
            if (image_alpha < 0)
166
            {
167
                snd_stop(snd_tvturnoff2);
168
                instance_destroy();
169
                if (kind == 1 || kind == 2)
170
                    global.interact = 0;
171
            }
172
        }
173
    }
174
}