Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_battlecontroller_Create_0

(view raw script w/o annotations or w/e)
1
if (global.flag[9 battle_music] == 1)
2
{
3
    var battlemusicvolume = 0.7;
4
    if (i_ex(obj_astream))
5
    {
6
        if (obj_astream.mystream == global.batmusic[0])
7
        {
8
            if (obj_astream.songname != "mus/battle.ogg")
9
                battlemusicvolume = 1;
10
        }
11
    }
12
    global.batmusic[1] = mus_loop_ext(global.batmusic[0], battlemusicvolume, 1);
13
}
14
victory = 0;
15
victoried = 0;
16
skipvictory = 0;
17
global.battleend = 0;
18
battlewriter = 19212912;
19
myface = 1913918291;
20
lbuffer = 0;
21
rbuffer = 0;
22
onebuffer = 0;
23
twobuffer = 0;
24
myfightreturntimer = 1;
25
messagepriority = -1;
26
attackpriority = -1;
27
hidemercy = 0;
28
cantspare[2] = 0;
29
global.darkzone = 1;
30
global.fighting = 1;
31
if (global.encounterno == 73)
32
{
33
    global.fc = 3;
34
    global.fe = 4;
35
    global.flag[62 nonnarrative_intro_text] = 1;
36
}
37
if (global.flag[62 nonnarrative_intro_text] == 0)
38
{
39
    global.fe = 0;
40
    global.fc = 0;
41
    global.typer = 4;
42
    global.battletyper = 4;
43
}
44
global.flag[62 nonnarrative_intro_text] = 0;
45
global.myfight = 0;
46
global.mnfight = 0;
47
global.bmenuno = 0;
48
global.attacking = 0;
49
global.acting = 0;
50
global.tension = 0;
51
global.spelldelay = 10;
52
global.turntimer = 120;
53
scr_spellinfo_all
scr_spellinfo_all

function
scr_spellinfo_all()
{ for (j = 0; j < 6; j += 1) { for (i = 0; i < 12; i += 1) { spellid = global.spell[j][i];
scr_spellinfo(spellid);
global.spellname[j][i] = spellname; global.spellnameb[j][i] = spellnameb; global.spelldescb[j][i] = spelldescb; global.spelldesc[j][i] = spelldesc; global.spellcost[j][i] = cost; global.spellusable[j][i] = spellusable; global.spelltarget[j][i] = spelltarget; } } }
();
54
global.tensionselect = 0;
55
for (j = 0; j < 3; j += 1)
56
{
57
    global.temptension[j] = global.tension;
58
    for (i = 0; i < 13; i += 1)
59
        tempitem[i][j] = global.item[i];
60
}
61
for (i = 0; i < 3; i += 1)
62
{
63
    global.charcond[i] = 0;
64
    global.automiss[i] = 0;
65
    if (global.char[i] != 0)
66
    {
67
        global.charmove[i] = 1;
68
        global.charcantarget[i] = 1;
69
        global.chardead[i] = 0;
70
    }
71
    else
72
    {
73
        global.charmove[i] = 0;
74
        global.charcantarget[i] = 0;
75
    }
76
}
77
itempage = 0;
78
spellpage = 0;
79
global.flag[50 last_encounter_end] = 0;
80
global.flag[51 last_monster_end_0] = 0;
81
global.flag[52 last_monster_end_1] = 0;
82
global.flag[53 last_monster_end_2] = 0;
83
global.flag[63 violenced_last] = 0;
84
for (i = 0; i < 3; i += 1)
85
    
scr_monster_statreset
scr_monster_statreset

function
scr_monster_statreset(arg0)
{ global.monster[arg0] = 0; global.monsterx[arg0] = 0; global.monstery[arg0] = 0; global.monstername[arg0] = stringsetloc(
" ", "scr_monster_statreset_slash_scr_monster_statreset_gml_5_0"
);
global.monsterat[arg0] = 0; global.monsterdf[arg0] = 0; global.monsterhp[arg0] = 0; global.monstermaxhp[arg0] = 0; global.monsterinstance[arg0] = 12913921839; global.monstergold[arg0] = 0; global.monsterexp[arg0] = 0; global.sparepoint[arg0] = 0; global.hittarget[arg0] = 0; global.mercymod[arg0] = 0; global.mercymax[arg0] = 0; global.monstercomment[arg0] = " "; global.monsterattackname[arg0] = " "; global.monsterstatus[arg0] = 0;
scr_monster_actreset(arg0);
}
(i);
86
for (i = 0; i < 3; i += 1)
87
{
88
    if (global.monstertype[i] > 0)
89
        
scr_monster_makeinstance
scr_monster_makeinstance

function
scr_monster_makeinstance(arg0)
{ global.monster[arg0] = 1; with (global.monsterinstance[arg0]) instance_destroy(); global.monsterinstance[arg0] = instance_create(global.monstermakex[arg0], global.monstermakey[arg0], global.monsterinstancetype[arg0]); global.monsterinstance[arg0].myself = arg0; with (global.monsterinstance[arg0]) event_user(12); with (global.monsterinstance[arg0]) event_user(15); }
(i);
90
}
91
global.monstergold[3] = 0;
92
global.monsterexp[3] = 0;
93
global.charturn = 0;
94
global.currentactingchar = 0;
95
for (i = 0; i < 3; i += 1)
96
{
97
    global.acting[i] = 0;
98
    global.actingsingle[i] = 0;
99
    global.actingsimul[i] = 0;
100
    global.actingtarget[i] = 0;
101
    global.actingchoice[i] = 0;
102
    global.charaction[i] = 0;
103
    global.charspecial[i] = 0;
104
    global.chartarget[i] = 0;
105
    global.faceaction[i] = 0;
106
    global.rembmenuno[i] = 0;
107
    global.targeted[i] = 0;
108
    global.battleat[i] = global.at[global.char[i]] + global.itemat[global.char[i]][0] + global.itemat[global.char[i]][1] + global.itemat[global.char[i]][2];
109
    global.battledf[i] = global.df[global.char[i]] + global.itemdf[global.char[i]][0] + global.itemdf[global.char[i]][1] + global.itemdf[global.char[i]][2];
110
    global.battlemag[i] = global.mag[global.char[i]] + global.itemmag[global.char[i]][0] + global.itemmag[global.char[i]][1] + global.itemmag[global.char[i]][2];
111
    global.battleactcount[i] = 0;
112
    global.monsterattackname[i] = " ";
113
    for (j = 0; j < 18; j++)
114
    {
115
        global.battlespell[i][j] = 0;
116
        global.battlespellname[i][j] = " ";
117
        global.battlespelldesc[i][j] = " ";
118
        global.battlespellcost[i][j] = 0;
119
        global.battlespelltarget[i][j] = 2;
120
        global.battlespellspecial[i][j] = 0;
121
    }
122
}
123
scr_spellmenu_setup
scr_spellmenu_setup

function
scr_spellmenu_setup()
{ var __actnamecheck = 0; var __monstertype = global.monstertype[0]; for (__i = 1; __i < 3; __i++) { if (global.monster[__i] == 1 && global.monstertype[__i] != __monstertype) __actnamecheck = 1; } for (__i = 0; __i < 3; __i++) { for (__fj = 0; __fj < 6; __fj++) { global.battlespell[__i][__fj] = 0; if (global.char[__i] == 1) { if (global.canact[0][__fj] == 1) { global.battlespell[__i][__fj] = -1; if (global.battleactcount[__i] < (__fj + 1)) global.battleactcount[__i] = __fj + 1; global.battlespellcost[__i][__fj] = global.actcost[0][__fj]; global.battlespellname[__i][__fj] = global.actname[0][__fj]; global.battlespelldesc[__i][__fj] = global.actdesc[0][__fj]; global.battlespelltarget[__i][__fj] = 0; global.battlespellspecial[__i][__fj] = 1; } } if (global.char[__i] == 2) { if (global.canactsus[0][__fj] == 1) { global.battlespell[__i][__fj] = -1; if (global.battleactcount[__i] < (__fj + 1)) global.battleactcount[__i] = __fj + 1; global.battlespellcost[__i][__fj] = global.actcostsus[0][__fj]; global.battlespellname[__i][__fj] = global.actnamesus[0][__fj]; if (__actnamecheck) global.battlespellname[__i][__fj] = stringsetloc(
S-Action
"S-Action", "scr_monstersetup_slash_scr_monstersetup_gml_1053_0"
);
if (__actnamecheck && global.chapter == 3 && i_ex(obj_elnina_lanino_controller)) global.battlespellname[__i][__fj] = stringsetloc(
ILoveTV
"ILoveTV", "scr_spellmenu_setup_slash_scr_spellmenu_setup_gml_39_0"
);
global.battlespelldesc[__i][__fj] = global.actdescsus[0][__fj]; global.battlespelltarget[__i][__fj] = 2; global.battlespellspecial[__i][__fj] = 2; } } if (global.char[__i] == 3) { if (global.canactral[0][__fj] == 1) { global.battlespell[__i][__fj] = -1; if (global.battleactcount[__i] < (__fj + 1)) global.battleactcount[__i] = __fj + 1; global.battlespellcost[__i][__fj] = global.actcostral[0][__fj]; global.battlespellname[__i][__fj] = global.actnameral[0][__fj]; if (__actnamecheck) global.battlespellname[__i][__fj] = stringsetloc(
R-Action
"R-Action", "scr_monstersetup_slash_scr_monstersetup_gml_1057_0"
);
if (__actnamecheck && global.chapter == 3 && i_ex(obj_elnina_lanino_controller)) global.battlespellname[__i][__fj] = stringsetloc(
ILoveTV
"ILoveTV", "scr_spellmenu_setup_slash_scr_spellmenu_setup_gml_54_0"
);
global.battlespelldesc[__i][__fj] = global.actdescral[0][__fj]; global.battlespelltarget[__i][__fj] = 2; global.battlespellspecial[__i][__fj] = 3; } } if (global.char[__i] == 4) { if (global.canactnoe[0][__fj] == 1) { global.battlespell[__i][__fj] = -1; if (global.battleactcount[__i] < (__fj + 1)) global.battleactcount[__i] = __fj + 1; global.battlespellcost[__i][__fj] = global.actcostnoe[0][__fj]; global.battlespellname[__i][__fj] = global.actnamenoe[0][__fj]; if (__actnamecheck) global.battlespellname[__i][__fj] = stringsetloc(
N-Action
"N-Action", "scr_monstersetup_slash_scr_monstersetup_gml_1061_0"
);
global.battlespelldesc[__i][__fj] = global.actdescnoe[0][__fj]; global.battlespelltarget[__i][__fj] = 2; global.battlespellspecial[__i][__fj] = 4; } } } }
scr_spellinfo_all();
for (__i = 0; __i < 3; __i++) { for (__fj = 0; __fj < 12; __fj++) { __ib = global.battleactcount[__i] + __fj; global.battlespell[__i][__ib] = global.spell[global.char[__i]][__fj]; global.battlespellcost[__i][__ib] = global.spellcost[global.char[__i]][__fj]; global.battlespellname[__i][__ib] = global.spellnameb[global.char[__i]][__fj]; global.battlespelldesc[__i][__ib] = global.spelldescb[global.char[__i]][__fj]; global.battlespelltarget[__i][__ib] = global.spelltarget[global.char[__i]][__fj]; } } }
();
124
for (i = 0; i < 20; i += 1)
125
{
126
    for (j = 0; j < 20; j += 1)
127
        global.bmenucoord[i][j] = 0;
128
}
129
movenoise = 0;
130
selnoise = 0;
131
laznoise = 0;
132
damagenoise = 0;
133
grazenoise = 0;
134
bcolor = merge_color(c_purple, c_black, 0.7);
135
bcolor = merge_color(bcolor, c_dkgray, 0.5);
136
tp = 0;
137
tpy = 50;
138
bp = 0;
139
bpy = 152;
140
intro = 1;
141
chartotal = 0;
142
charpos[0] = -1;
143
charpos[1] = -1;
144
charpos[2] = -1;
145
charpos[3] = -1;
146
havechar[0] = 0;
147
havechar[1] = 0;
148
havechar[2] = 0;
149
havechar[3] = 0;
150
global.charinstance[0] = 12129292;
151
global.charinstance[1] = 12129292;
152
global.charinstance[2] = 12129292;
153
with (global.charinstance[0])
154
    myself = 0;
155
with (global.charinstance[1])
156
    myself = 1;
157
with (global.charinstance[2])
158
    myself = 2;
159
mmy[0] = 0;
160
mmy[1] = 0;
161
mmy[2] = 0;
162
mmy[3] = 0;
163
for (i = 0; i < 3; i += 1)
164
{
165
    if (global.char[i] != 0)
166
        chartotal += 1;
167
    if (global.char[i] == 1)
168
    {
169
        havechar[0] = 1;
170
        charpos[0] = i;
171
        global.charinstance[i] = instance_create(global.heromakex[i], global.heromakey[i], obj_herokris);
172
        global.charinstance[i].myself = i;
173
        global.charinstance[i].char = 1;
174
        global.charinstance[i].depth = 200 - (i * 20);
175
    }
176
    if (global.char[i] == 2)
177
    {
178
        havechar[1] = 1;
179
        charpos[1] = i;
180
        global.charinstance[i] = instance_create(global.heromakex[i], global.heromakey[i], obj_herosusie);
181
        global.charinstance[i].myself = i;
182
        global.charinstance[i].char = 2;
183
        global.charinstance[i].depth = 200 - (i * 20);
184
    }
185
    if (global.char[i] == 3)
186
    {
187
        havechar[2] = 1;
188
        charpos[2] = i;
189
        global.charinstance[i] = instance_create(global.heromakex[i], global.heromakey[i], obj_heroralsei);
190
        global.charinstance[i].myself = i;
191
        global.charinstance[i].char = 3;
192
        global.charinstance[i].depth = 200 - (i * 20);
193
    }
194
    if (global.char[i] == 4)
195
    {
196
        havechar[3] = 1;
197
        charpos[3] = i;
198
        global.charinstance[i] = instance_create(global.heromakex[i], global.heromakey[i], obj_heronoelle);
199
        global.charinstance[i].myself = i;
200
        global.charinstance[i].char = 4;
201
        global.charinstance[i].depth = 200 - (i * 20);
202
    }
203
}
204
slmxx = 0;
205
slmyy = 0;
206
s_siner = 0;
207
t_siner = 0;
208
instance_create(0, 0, obj_tensionbar);
209
reset = 0;
210
timeron = 1;
211
noreturn = 0;
212
hpcolor[0] = c_aqua;
213
hpcolor[1] = c_fuchsia;
214
hpcolor[2] = c_lime;
215
hpcolor[3] = c_yellow;
216
for (i = 0; i < 4; i++)
217
    hpcolorsoft[i] = merge_color(hpcolor[i], c_white, 0.5);
218
global.flag[36 dojo_failure] = 0;
219
global.flag[39 dojo_abort?] = 0;
220
if (global.ambush == 1)
221
{
222
    
scr_ambush
scr_ambush

function
scr_ambush()
{ with (obj_writer) instance_destroy(); with (obj_face) instance_destroy(); global.charturn = 3; global.mnfight = 1; global.myfight = -1; with (obj_monsterparent) ambushed = 1; }
();
223
    global.ambush = 0;
224
}
225
if (global.ambush == 2)
226
{
227
    with (obj_monsterparent)
228
        firststrike = 1;
229
    global.tension = round(global.maxtension / 4);
230
    global.ambush = 0;
231
}
232
disablesusieact = 0;
233
mercytotal = 0;
234
idefendedthisturn = 0;
235
ypostenna = 0;
236
oopsallacts = 0;
237
spadebuttonenabled = false;
238
spadebuttoncount = 0;
239
spadebuttontimer = 0;
240
heartbuttoncount = 0;
241
heartbuttontimer = 0;
242
heartbuttondirection = 270;
243
heartsuccesstimer = 0;
244
heartsuccesscon = 0;
245
recentlyhighlightingheart = 0;
246
recentlyhighlightingheartvalue = 0;
247
rouxlsbuttontimer = 0;
248
rouxlsbuttoncount = -6;
249
rouxlsbuttoncount2 = -6;
250
rouxlsbuttoncount_y = 0;
251
rouxlsgridenabled = false;
252
recentlyhighlightingspade = 0;
253
recentlyhighlightingspadevalue = 0;
254
gridchangedirections = true;
255
spadebuttondirection = 0;
256
rouxlsbuttondirection = 270;
257
rouxlsbuttondirection2 = 270;
258
rouxlserrorcon = 0;
259
rouxlserrortimer = 0;
260
rouxlstelegraphtimer = 0;
261
rouxlstelegraphcon = 0;
262
spadetelegraphtimer = 0;
263
spadetelegraphcon = 0;
264
spadesuccesstimer = 0;
265
spadesuccesscon = 0;
266
rouxlsbuttonendcon = 0;
267
buttonorder = 0;
268
spadefail = false;
269
buttonspeed = 0;
270
norouxlsbutton = false;
271
dogtimer = 0;
272
dogcon = 0;
273
dogselectedcount = 0;
274
if (global.chapter == 3 && (room == room_board_1 || room == room_board_2 || room == room_board_3) && !i_ex(obj_elnina_enemy) && !i_ex(obj_rouxls_ch3_enemy) && global.encounterno != 111 && global.flag[1022 tenna_board_absent] == 0)
275
    instance_create(x, y, obj_tennabattleconvo_controller);
276
if (global.chapter == 3)
277
{
278
    battletimer = 0;
279
    battleseconds = 0;
280
    battleminutes = 0;
281
    boardend = 0;
282
    global.boardbattleresult = "won";
283
    rabbickvar = choose(0, 1);
284
}
285
tripticket = 0;
286
tripticketcon = 0;
287
triptickettimer = 0;
288
if (global.chapter == 3)
289
{
290
    if (global.encounterno == 131 || global.encounterno == 126 || global.encounterno == 125)
291
    {
292
        if (
scr_keyitemcheck
scr_keyitemcheck

function
scr_keyitemcheck(arg0)
{ haveit = 0; itemcount = 0; for (i = 0; i < 12; i += 1) { if (global.keyitem[i] == arg0) haveit = 1; if (global.keyitem[i] == arg0) itemcount += 1; } return haveit; }
(18))
293
            tripticket = 1;
294
    }
295
}