Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_board_event_bridgepuzzle_Step_0

(view raw script w/o annotations or w/e)
1
if (alwaysactive)
2
    active = true;
3
scr_board_populatevars
scr_board_populatevars

function
scr_board_populatevars()
{ if (!variable_instance_exists(id, "kris")) kris = 0; if (!variable_instance_exists(id, "susie")) susie = 0; if (!variable_instance_exists(id, "ralsei")) ralsei = 0; if (kris == 0) { with (obj_mainchara_board) { if (name == "kris") other.kris = id; } } if (ralsei == 0) { with (obj_mainchara_board) { if (name == "ralsei") other.ralsei = id; } } if (susie == 0) { with (obj_mainchara_board) { if (name == "susie") other.susie = id; } } }
();
4
if (tenna == 0)
5
{
6
    with (obj_actor_tenna)
7
        other.tenna = id;
8
}
9
if (susiereal == 0)
10
{
11
    with (obj_caterpillarchara)
12
    {
13
        if (name == "susie")
14
            other.susiereal = id;
15
    }
16
}
17
if (ralseireal == 0)
18
{
19
    with (obj_caterpillarchara)
20
    {
21
        if (name == "ralsei")
22
            other.ralseireal = id;
23
    }
24
}
25
if (krisreal == 0)
26
{
27
    with (obj_mainchara)
28
        other.krisreal = id;
29
}
30
if (active == 1)
31
{
32
    if (reset == true)
33
    {
34
        reset = false;
35
        with (obj_board_grabobject)
36
        {
37
            if (grabbedid.object_index == obj_board_bridge)
38
            {
39
                grabdaddy.grabbed = 0;
40
                grabdaddy.grab = 0;
41
                instance_destroy();
42
            }
43
        }
44
        with (obj_board_bridge)
45
        {
46
            if (puzzleid == other.puzzleid)
47
                instance_destroy();
48
        }
49
        with (obj_board_bridge_placed)
50
        {
51
            if (puzzleid == other.puzzleid)
52
                instance_destroy();
53
        }
54
        with (obj_board_breakableblock)
55
        {
56
            if (puzzleid == other.puzzleid)
57
                instance_destroy();
58
        }
59
        with (obj_board_grabbablegrass)
60
        {
61
            if (puzzleid == other.puzzleid)
62
                instance_destroy();
63
        }
64
        with (obj_board_bridgespawner)
65
        {
66
            if (puzzleid == other.puzzleid)
67
                made = false;
68
        }
69
    }
70
    var solvecleanup = false;
71
    if (solved == 0)
72
    {
73
        if (dosolve == true)
74
        {
75
            solved = true;
76
            dosolve = false;
77
            snd_play(snd_bell);
78
            snd_play_delay(snd_applause_single, 15);
79
            solvecleanup = true;
80
        }
81
        with (obj_board_solvedtrigger)
82
        {
83
            if (puzzleid == other.puzzleid)
84
            {
85
                if (place_meeting(x, y, obj_board_bridge_placed))
86
                {
87
                    other.solved = true;
88
                    snd_play(snd_bell);
89
                    snd_play_delay(snd_applause_single, 15);
90
                    solvecleanup = true;
91
                }
92
            }
93
        }
94
        if (specialsolve == true && solved == 0)
95
        {
96
            if (puzzleid == 203)
97
            {
98
                var remainingtilecount = 0;
99
                with (obj_board_breakableblock)
100
                {
101
                    if (puzzleid == other.puzzleid)
102
                        remainingtilecount++;
103
                }
104
                if (remainingtilecount == 0)
105
                {
106
                    snd_play(snd_won);
107
                    solved = true;
108
                    specialsolve = false;
109
                }
110
            }
111
            if (puzzleid == 204)
112
            {
113
                var tilecount = 0;
114
                with (obj_board_solvedtrigger)
115
                {
116
                    if (puzzleid == 204)
117
                    {
118
                        if (place_meeting(x, y, obj_board_breakableblock))
119
                            tilecount++;
120
                    }
121
                }
122
                if (tilecount == 0)
123
                {
124
                    solved = true;
125
                    solvecleanup = true;
126
                }
127
            }
128
        }
129
    }
130
    if (puzzleid == 204)
131
    {
132
        if (specialsolve == true)
133
        {
134
            var remainingtilecount = 0;
135
            with (obj_board_breakableblock)
136
            {
137
                if (puzzleid == 204)
138
                    remainingtilecount++;
139
            }
140
            if (remainingtilecount == 0)
141
            {
142
                snd_play(snd_won);
143
                specialsolve = false;
144
            }
145
        }
146
    }
147
    if (solvecleanup == true)
148
    {
149
        with (obj_board_bridgespawner)
150
        {
151
            if (puzzleid == other.puzzleid)
152
                instance_destroy();
153
        }
154
        with (obj_board_grabbablegrassspawner)
155
        {
156
            if (puzzleid == other.puzzleid)
157
                instance_destroy();
158
        }
159
        with (obj_board_breakableblockspawner)
160
        {
161
            if (puzzleid == other.puzzleid)
162
                instance_destroy();
163
        }
164
        with (obj_board_resettile)
165
        {
166
            if (puzzleid == other.puzzleid)
167
            {
168
                var puff = instance_create(x, y, obj_board_smokepuff);
169
                puff.image_blend = #FFF200;
170
                instance_destroy();
171
            }
172
        }
173
    }
174
}
175
else if (!solved)
176
{
177
    with (obj_board_bridge)
178
    {
179
        if (puzzleid == other.puzzleid)
180
            instance_destroy();
181
    }
182
    with (obj_board_bridge_placed)
183
    {
184
        if (puzzleid == other.puzzleid)
185
            instance_destroy();
186
    }
187
    with (obj_board_breakableblock)
188
    {
189
        if (puzzleid == other.puzzleid)
190
            instance_destroy();
191
    }
192
    with (obj_board_grabbablegrass)
193
    {
194
        if (puzzleid == other.puzzleid)
195
            instance_destroy();
196
    }
197
}