Deltarune (Chapter 3) 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
    {
7
        global.interact = 3;
8
        with (obj_mainchara)
9
            freeze = true;
10
    }
11
    init = 1;
12
}
13
if (con == 0)
14
{
15
    timer++;
16
    _alpha1 = lerp(0, 1, timer / 5);
17
    draw_sprite_ext(spr_zapper_tvturnoff1, 0, camerax() + 320, cameray() + 240 + yoff, 6, 10, 0, c_white, _alpha1);
18
    if (timer == 5)
19
    {
20
        con = 1;
21
        timer = 0;
22
    }
23
    if (i_ex(obj_tenna_board4_enemy))
24
    {
25
        with (obj_zapper_enemy)
26
            image_alpha = 0;
27
        with (obj_tenna_board4_enemy)
28
            hidetvcount = true;
29
        with (obj_actor_tenna)
30
            preset = 0;
31
    }
32
}
33
if (con == 1)
34
{
35
    timer++;
36
    if (timer == 4)
37
        snd_play(snd_tvturnoff);
38
    _yscale1 = lerp(_yscale1, 0.05, timer / 8);
39
    draw_sprite_ext(spr_zapper_tvturnoff1, 0, camerax() + 320, cameray() + 240 + yoff, 6, _yscale1, 0, c_white, 1);
40
    draw_sprite_ext(spr_zapper_tvturnoff2, 2, camerax() + 320, cameray() + 240 + yoff, 0.1, 0.1, 0, c_white, 1);
41
    if (timer == 8)
42
    {
43
        con = 2;
44
        timer = 0;
45
        snd_play(snd_tvturnoff2);
46
        if (kind == 0)
47
            audio_pause_sound(global.batmusic[1]);
48
        if (kind == 1 || kind == 2)
49
            audio_pause_sound(global.currentsong[1]);
50
    }
51
}
52
if (con == 2)
53
{
54
    timer++;
55
    var timing = 10;
56
    if (timer <= timing)
57
    {
58
        _xscale1 = lerp(_xscale1, 0, timer / timing);
59
        _yscale1 = lerp(_yscale1, 0.01, timer / timing);
60
    }
61
    timer2++;
62
    var timing2 = 5;
63
    if (timer2 <= timing2)
64
    {
65
        _xscale2 = lerp(_xscale2, 0.4, timer2 / timing2);
66
        _yscale2 = lerp(_yscale2, 0.4, timer2 / timing2);
67
    }
68
    else
69
    {
70
        _xscale2 = lerp(_xscale2, 0, (timer2 - timing2) / timing2);
71
        _yscale2 = lerp(_yscale2, 0, (timer2 - timing2) / timing2);
72
    }
73
    draw_sprite_ext(spr_zapper_tvturnoff1, 0, camerax() + 320, cameray() + 240 + yoff, _xscale1, _yscale1, 0, c_white, 1);
74
    draw_sprite_ext(spr_zapper_tvturnoff2, 2, camerax() + 320, cameray() + 240 + yoff, _xscale2, _yscale2, 0, c_white, 1);
75
    if (timer == 30 && tennaending == true)
76
    {
77
        image_alpha = 6;
78
        if (i_ex(obj_tenna_enemy))
79
        {
80
            
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; } }
();
81
            with (obj_battlecontroller)
82
                skipvictory = 1;
83
            with (obj_shadowman_sharpshoot_target)
84
                instance_destroy();
85
            with (obj_screen_channel_change)
86
                instance_destroy();
87
            with (obj_lightemup_controller)
88
                instance_destroy();
89
            with (obj_shadowman_sharpshoot_heart)
90
                instance_destroy();
91
            with (obj_tenna_enemy)
92
                instance_destroy();
93
        }
94
        with (obj_actor_tenna)
95
            darkenalpha = 1;
96
    }
97
    if (timer == 30 && tennaending == false)
98
    {
99
        con = 3;
100
        timer = 0;
101
        if (kind == 1)
102
        {
103
            if (entrance != "none")
104
                global.entrance = entrance;
105
            if (facing != -1)
106
                global.facing = facing;
107
            if (room_exists(roomtarg))
108
            {
109
                global.interact = 3;
110
                if (roomtarg == 182)
111
                    
scr_setparty
scr_setparty

function
scr_setparty(arg0, arg1, arg2)
{ 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);
112
                else
113
                    
scr_setparty
scr_setparty

function
scr_setparty(arg0, arg1, arg2)
{ 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);
114
                room_goto(roomtarg);
115
            }
116
        }
117
        if (kind == 2)
118
        {
119
            obj_mainchara.x = 
scr_even
scr_even

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

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(targy);
121
            if (kind == 2)
122
                global.facing = 1;
123
            with (obj_caterpillarchara)
124
            {
125
                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));
126
                if (name == "susie")
127
                {
128
                    x -= 12;
129
                    y -= 16;
130
                }
131
                else
132
                {
133
                    x -= 20;
134
                    y += 14;
135
                }
136
                
scr_caterpillar_interpolate
scr_caterpillar_interpolate

function
scr_caterpillar_interpolate()
{ _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; } }
();
137
                
scr_caterpillar_facing
scr_caterpillar_facing

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